-
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
Conversation
io/module_write_netcdf.F90
Outdated
|
||
! if iau_offset set, update time units attribute. | ||
if ( trim(dim_name) == "time" .and. iau_offset > 0) then | ||
! get time units just written to file | ||
ncerr = nf90_get_att(ncid, dim_varid, 'units', time_units); NC_ERR_STOP(ncerr) | ||
! idate: year,month,day,hour,minute,second | ||
idate = get_idate_from_time_units(time_units) | ||
! idat: year,month,day,time zone,hour,minute,second,millsecond | ||
idat = 0 | ||
idat(1:3) = idate(1:3) | ||
idat(5:7) = idate(4:6) | ||
! rinc: days,hours,minutes,seconds,milliseconds | ||
rinc = 0; rinc(2) = iau_offset | ||
call w3movdat(rinc,idat,jdat) | ||
! update idate using iau_offset | ||
idate(1:3)=jdat(1:3) | ||
idate(4:6)=jdat(5:7) | ||
time_units = get_time_units_from_idate(idate) | ||
! rewrite time units attribute. | ||
ncerr = nf90_put_att(ncid, dim_varid, 'units', trim(time_units)); NC_ERR_STOP(ncerr) | ||
endif |
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.
The |
add Ferrier-Aligo MP scheme changes on host model side
The code is committed, close the pull request. |
Add README.md containing disclaimer
…m_mods Gfsv16 updates from IPD - update .gitmodule and submodule pointer for ccpp-physics
Adding Eddy Diffusivity Output
adding kind=kind_phys to Noah MP subroutines
…dom_20211018 Merra2 thompson updates dom 20211018
VLab Issue #68141
update noaa-psd fork with EMC develop branch
- bugfix for GNU compiler - reduce noise in stdout Squashed commit of the following: commit 86c127f5b810b87004aeed3a625f9445d469c27e Merge: ce66d6a f9bbb4f Author: Dom Heinzeller <dom.heinzeller@icloud.com> Date: Fri Apr 10 11:32:21 2020 -0600 Merge pull request NOAA-EMC#11 from climbfuji/update_dtc_develop_from_dev_emc_20200409 Update dtc/develop from dev/emc 2020/04/09 commit f9bbb4f12e032378050cef4b7e5ac4b65a16bb70 Author: Dom Heinzeller <climbfuji@ymail.com> Date: Thu Apr 9 20:14:24 2020 -0600 Bugfix for GNU compiler in model/fv_regional_bc.F90, reduce verbosity in driver/fvGFS/atmosphere.F90 commit ecca9978802ec9cc39dc114fd7363386f7ad9422 Merge: ce66d6a 80ce8ce Author: Dom Heinzeller <climbfuji@ymail.com> Date: Thu Apr 9 09:38:48 2020 -0600 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit ce66d6a56e89b6330a2bef763755c7154047d829 Merge: 4279bf7 9bacf55 Author: Dom Heinzeller <dom.heinzeller@icloud.com> Date: Fri Mar 13 13:00:41 2020 -0600 Merge pull request NOAA-EMC#10 from climbfuji/update_from_dev_emc_20200312_and_other_changes Update from dev/emc 2020/03/12 commit 9bacf554ed078dfa8c09ee662e7608442288e2d5 Merge: 4279bf7 371a29a Author: Dom Heinzeller <climbfuji@ymail.com> Date: Thu Mar 12 10:33:44 2020 -0600 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit 4279bf78eb4ae0bad908eb991e3fb216018b7aea Merge: 846f5a5 4858d33 Author: Dom Heinzeller <dom.heinzeller@icloud.com> Date: Mon Mar 9 12:41:51 2020 -0600 Merge pull request NOAA-EMC#9 from climbfuji/update_dtc_develop_from_emc Update dtc/develop from dev/emc 2020/03/04 commit 4858d33838adcd87c1cd000ab4737dc0e7e56731 Merge: 846f5a5 db3acfb Author: Dom Heinzeller <climbfuji@ymail.com> Date: Fri Feb 28 08:46:55 2020 -0700 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit 846f5a54b0764db1478c9aca49a74bd38322d9ad Merge: 3a4dfd8 9a290ee Author: Dom Heinzeller <dom.heinzeller@icloud.com> Date: Mon Feb 3 07:43:08 2020 -0700 Merge pull request NOAA-EMC#7 from climbfuji/update_dtc_develop_from_dev-emc dtc/develop: update from dev/emc 2020/01/27 commit 9a290ee5f3307a9d7b02762fe6c29a1f5ccd7f55 Merge: 3a4dfd8 a56907a Author: Dom Heinzeller <climbfuji@ymail.com> Date: Mon Jan 27 09:28:57 2020 -0700 Merge branch 'dev/emc' of https://github.com/noaa-emc/GFDL_atmos_cubed_sphere into HEAD commit 3a4dfd8c6c4ceb8cec06397f25cb229ecd98065b Merge: 0c9ab9e 68576a6 Author: Dom Heinzeller <dom.heinzeller@icloud.com> Date: Tue Dec 3 15:19:24 2019 -0700 Merge pull request NOAA-EMC#6 from climbfuji/dtc_develop_udpate_from_emc_20191127 dtc/develop: update from EMC 2019/11/27 commit 68576a61f2a57236931e5ef1b8bd73a4256b0a5f Merge: 0c9ab9e 452333a Author: Dom Heinzeller <climbfuji@ymail.com> Date: Wed Nov 27 14:13:08 2019 -0700 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit 0c9ab9e3dfe6cda6fc78315b86a107a369756024 Merge: 9871607 b280b37 Author: Dom Heinzeller <dom.heinzeller@icloud.com> Date: Fri Nov 22 16:17:57 2019 -0700 Merge pull request NOAA-EMC#5 from mzhangw/HAFS_fer_hires minimal changes to make nwat =4 compatible with Ferrier-Aligo MP scheme commit b280b373b421fcb9d84bd1196a40ec56fcf279ff Author: Man.Zhang <Man.Zhang@noaa.gov> Date: Tue Nov 19 14:53:57 2019 -0700 bug fix commit 98c58ad3d0444859aae54c31bc2b86ba30b4a9ac Author: Man.Zhang <Man.Zhang@noaa.gov> Date: Tue Nov 19 14:35:10 2019 -0700 bug fix commit 8805acd93152bb76d5c4d0900f314631f549fbe2 Author: Man.Zhang <Man.Zhang@noaa.gov> Date: Tue Nov 19 14:16:22 2019 -0700 From Chunxi: The file fv_mapz.F90 also needs to be modified (K_warm) commit f8a257a922a9047e98c176affec054e2a4d9c6a9 Author: Man.Zhang <Man.Zhang@noaa.gov> Date: Thu Nov 14 19:12:39 2019 -0700 use upper-case CCPP commit 77f4fbad9311ad406c6486ad0912069de3085f07 Author: Man.Zhang <Man.Zhang@noaa.gov> Date: Thu Nov 14 13:40:59 2019 -0700 implement FA scheme water loading option if nwat =4 commit 987160799b3a1c0f11de9883843f20421eb03fe8 Merge: ed75004 786447c Author: Dom Heinzeller <climbfuji@ymail.com> Date: Tue Nov 5 06:59:34 2019 +0900 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit ed75004634374b02f8b222dd873190a91126ce4f Merge: 1d6035a f627bfb Author: Dom Heinzeller <dom.heinzeller@icloud.com> Date: Sat Oct 12 08:45:14 2019 +0900 Merge pull request NOAA-EMC#4 from climbfuji/update_gmtb_develop_with_vlab_master_20191006 Update NCAR gmtb/develop with NOAA-EMC dev/emc 2019/10/06 commit f627bfb177dc1f2d0bd10371540c43c51ce8eec4 Author: Dom Heinzeller <climbfuji@ymail.com> Date: Mon Oct 7 12:12:24 2019 +0900 Add missing change in fv_cmp.F90 - now identical with EMC code commit e868186fd7d64fc2eeb7ec2c59e88c889e62fc93 Author: Dusan Jovic <dusan.jovic@noaa.gov> Date: Tue Sep 24 01:57:11 2019 +0000 change delz from positive value to the original value in the model commit 672eb0e8d67c008437724681250e7aa8aa81ec31 Author: fanglin.yang <fanglin.yang@noaa.gov> Date: Thu Sep 5 19:24:09 2019 +0000 VLab Issue #68141 modified: docs/FV3_citations.bib modified: model/fv_cmp.F90 1) Add an option (namelist parameter: intqs) to use temperature instead of the liquid frozen temperature to calculate saturation mixing ratio in deriving GFDLMP PDF cloud cover. 2) Add a literature reference. commit 1d6035ab053a6b5257b32dd9b4a49faa7ee4c78d Merge: 94ab0e1 fec8205 Author: Dom Heinzeller <dom.heinzeller@icloud.com> Date: Mon Sep 23 09:32:55 2019 -0600 Merge pull request NOAA-EMC#2 from climbfuji/remove_transition_mode Remove TRANSITION mode commit fec8205b9418dea28de4e2c9f05f347f3cf460d2 Author: climbfuji <dom.heinzeller@icloud.com> Date: Fri Sep 20 08:52:01 2019 -0600 Remove TRANSITION mode commit 94ab0e1317ffa50279dd6269a462999a2bea15e7 Author: Jun.Wang <Jun.Wang@noaa.gov> Date: Mon Aug 26 21:03:55 2019 +0000 add option to output omega commit b700cae673038f82189a1e6e0cb48a10a58ea726 Author: climbfuji <dom.heinzeller@icloud.com> Date: Fri Aug 30 11:58:00 2019 -0600 model/fv_dynamics.F90: replicating previous change to gmtb/develop branch of FV3, always allocate dtdt_m for IPD version commit 3df11713e0ba9299d95512476a9ee784048629c9 Author: Laurie Carson <carson@ucar.edu> Date: Fri Aug 16 10:46:56 2019 -0600 Add codeowners for NCAR fork
Port of https://vlab.ncep.noaa.gov/redmine/issues/69735
When
iau_offset
> 0, the forecast hour is reset but the initial time is not reset when netcdf output is enabled. This update modifies theunits
attribute of the time variable in the output netcdf files wheniau_offset
> 0. This update is necessary for IAU to work with netcdf io enabled.