diff --git a/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 b/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 index 57978d7f6..2f543bbd2 100644 --- a/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90 @@ -747,13 +747,12 @@ subroutine ice_write_hist (ns) !----------------------------------------------------------------- ! write time variable !----------------------------------------------------------------- + + ltime2 = timesecs/secday ! hist_time_axis = 'end' (default) - if (trim(hist_time_axis) == 'begin') then - ltime2 = time_beg(ns) - elseif (trim(hist_time_axis) == 'middle') then - ltime2 = p5*(time_beg(ns)+time_end(ns)) - else ! hist_time_axis == 'end' (default) - ltime2 = timesecs/secday + if (hist_avg(ns)) then + if (trim(hist_time_axis) == "begin" ) ltime2 = time_beg(ns) + if (trim(hist_time_axis) == "middle") ltime2 = p5*(time_beg(ns)+time_end(ns)) endif status = nf90_inq_varid(ncid,'time',varid) diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 index bbae5f5c2..a92326c58 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 @@ -704,12 +704,11 @@ subroutine ice_write_hist (ns) ! write time variable !----------------------------------------------------------------- - if (trim(hist_time_axis) == 'begin') then - ltime2 = time_beg(ns) - elseif (trim(hist_time_axis) == 'middle') then - ltime2 = p5*(time_beg(ns)+time_end(ns)) - else ! hist_time_axis == 'end' (default) - ltime2 = timesecs/secday + ltime2 = timesecs/secday ! hist_time_axis = 'end' (default) + + if (hist_avg(ns)) then + if (trim(hist_time_axis) == "begin" ) ltime2 = time_beg(ns) + if (trim(hist_time_axis) == "middle") ltime2 = p5*(time_beg(ns)+time_end(ns)) endif status = pio_inq_varid(File,'time',varid)