-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
driver: icedrv_history: fix start time for NetCDF history output #426
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ module icedrv_history | |
|
||
subroutine history_write() | ||
|
||
use icedrv_calendar, only: idate0, days_per_year, use_leap_years | ||
use icedrv_calendar, only: days_per_year, use_leap_years, year_init | ||
use icedrv_calendar, only: time, time0, secday, istep1, idate, sec | ||
use icedrv_state, only: aice, vice, vsno, uvel, vvel, divu, shear, strength | ||
use icedrv_state, only: trcr, trcrn | ||
|
@@ -68,7 +68,11 @@ subroutine history_write() | |
count1(1), count2(2), count3(3), count4(4), & ! cdf start/count arrays | ||
varid, & ! cdf varid | ||
status, & ! cdf status flag | ||
iflag ! history file attributes | ||
iflag, & ! history file attributes | ||
sec0, & ! number of seconds into the day at istep0 | ||
h0, & ! start hour | ||
m0, & ! start minute | ||
s0 ! start second | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these actually used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah good catch. Those are not actually used. They were used in the original way that I had fixed this. But since we've decided that the start point will always be January 1 00:00:00 and we just use the time variable they are not needed. I'll remove them in the NetCDF restart branch. |
||
|
||
character (len=8) :: & | ||
cdate ! date string | ||
|
@@ -164,9 +168,8 @@ subroutine history_write() | |
if (status /= nf90_noerr) call icedrv_system_abort(string=subname//' ERROR: def_var time') | ||
status = nf90_put_att(ncid,varid,'long_name','model time') | ||
if (status /= nf90_noerr) call icedrv_system_abort(string=subname//' ERROR: put_att time long_name') | ||
write(cdate,'(i8.8)') idate0 | ||
write(tmpstr,'(a,a,a,a,a,a,a,a)') 'days since ', & | ||
cdate(1:4),'-',cdate(5:6),'-',cdate(7:8),' 00:00:00' | ||
write(tmpstr,'(a,i0,a)') 'days since ', & | ||
year_init,'-01-01 00:00:00' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to be careful here. I guess it is ok for the Icepack driver. idate0 was used here to correspond to the CICE driver for history. |
||
status = nf90_put_att(ncid,varid,'units',trim(tmpstr)) | ||
if (status /= nf90_noerr) call icedrv_system_abort(string=subname//' ERROR: put_att time units') | ||
if (days_per_year == 360) then | ||
|
@@ -282,7 +285,7 @@ subroutine history_write() | |
|
||
status = nf90_inq_varid(ncid,'time',varid) | ||
if (status /= nf90_noerr) call icedrv_system_abort(string=subname//' ERROR: inq_var '//'time') | ||
value = (time-time0)/secday | ||
value = time/secday | ||
status = nf90_put_var(ncid,varid,value,start=(/timcnt/)) | ||
if (status /= nf90_noerr) call icedrv_system_abort(string=subname//' ERROR: put_var '//'time') | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems strange to me. The variable time should be the time since the beginning of the run. However, I see that this is upon initialization and that later in the calendar subroutine, the call to sec2time needs the time since the first step. So, I think this is correct.