-
Notifications
You must be signed in to change notification settings - Fork 164
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
fix for time units attribute when IAU used with netcdf format #2
Closed
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6bb6800
fix for time units attribute when IAU used with netcdf format
jswhit2 b05be21
modify time units in module_fcst_grid_comp instead of module_write_ne…
jswhit2 623dc0c
remove unused vars
jswhit2 0e695bd
Merge remote-tracking branch 'upstream/develop' into feature/nc_time_…
jswhit2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can this manipulation of 'units' attribute be done outside of this subroutine? At the place where data and attributes are added to ESMF_FieldBundle. This routine (write_netcdf) should be as generic as possible. It shouldn't "know" anything about iau_offset.
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.
Ideally yes, but I'm afraid that model may use this ESMF units attribute internally. Maybe @junwang-noaa can confirm whether it's used or not?
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.
I looked at the code again. Write grid component actually uses IO_BASETIME ( ESMF_Time) and IO_CURRTIMEDIFF (ESMF_TimeInterval) in its internal state to specify output initial date and the forecast hours related to initial output date. These two variable can be changed from forecast state due to various reasons, and in current code write grid component already adjusts the two time variables if iau_offset>0. Instead getting the initial output time from write grid, I think you can pass these two time variables into write_netcdf subroutine.
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.
The "time:units" attribute is set in module_fcst_grid_comp.F90. I see iau_offset is available in that module. Can "time:units" attribute be created with correct value in that module and passed to write_netcdf routine via FieldBundle. Instead of writing incorrect value, reading it back, parsing individual time components, adjusting based on iau_offset, constructing new "hours since ..." string and finally overwriting the one already written.
Passing IO_BASETIME and IO_CURRTIMEDIFF instead of iau_offset and doing the same or similar manipulation is equally bad.
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.
"Time:units" in fcst_grid_comp is to control the forecast integration and it is correct to provide time information from forecast point of view (starting integration from 2019103121 for 2019110100 cycle, but we decided only to take forecast results for 2019110100 history output). In my point of view "Time:units" on forecast grid comp should not be changed, because it is write grid comp decided what to output with the data. In the case of running with IAU, it's 2019110100 is the corresponding f00. That is why we use the two time variables IO_BASETIME and IO_CURRTIMEDIFF owned by write grid comp to have consistent time stamp for all the tasks done on write grid comp(output files, inline_post etc).
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.
The "time:units" is a string attribute added to the export state for the purpose of passing that information (and many other) to the routine that writes that state to a (netcdf) file (convention="NetCDF"). I do not see how it can "control the forecast". Where exactly is "time:units" attribute used, except in the write_netcdf routine? If it's used then that's also not the best way of controlling the forecast. We use various esmf objects (clocks, time, time intervals and alarms) for that, not string attributes.
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.
Sorry, I should say "time:units" on forecast grid component shows the time stamp on forecast integration, no matter what downstream routine(s) will use it, we should not change it. Write grid comp should be allowed to make decision on what to output.
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.
I implemented Dusan's suggestion and it seems to work.