-
Notifications
You must be signed in to change notification settings - Fork 140
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
Add flexible timining feature in modern diag_manager #1077
Add flexible timining feature in modern diag_manager #1077
Conversation
…the axis writes, set up time related variables in the file object
…mUpdate Conflicts: diag_manager/fms_diag_file_object.F90 diag_manager/fms_diag_object.F90 diag_manager/fms_diag_time_utils.F90
character(len=*) , intent(in) :: long_name !< The long_name of the variable | ||
character(len=*) , intent(in) :: units !< The units of the variable | ||
|
||
!TODO harcodded double |
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.
Is this for reproducibility?
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 hardcoded the double to make things easy for me.
I think in the old diag manager if you compile with r8 all of the time related variables were r8 and if you compile with r4 all of the time related variables were r4.
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 see there is a TODO for this, so we can move on. We are supporting all types, and netcdf files can have all types in them.
!< Register the "nv" dimension that it needed for the time_bounds | ||
call register_axis(fileobj, "nv", 2) | ||
!TODO hardcodded double | ||
call register_field(fileobj, "nv", "double", (/"nv"/)) | ||
call register_variable_attribute(fileobj, "nv", "long_name", "vertex number", str_len=13) | ||
|
||
!< Register the "time_bounds" as a variable | ||
dimensions(1) = "nv" | ||
dimensions(2) = trim(time_var_name) | ||
bounds_name = trim(time_var_name)//"_bounds" |
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 wonder if we can think of something better than just repeating this
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.
Combine the repetitive subroutines.
Add a namelist check for your new variable to make sure it's running with the modern diag
class(fmsDiagFileContainer_type), intent(in), target :: this !< The file object | ||
TYPE(time_type), intent(in) :: time_step !< Current model step time | ||
subroutine write_time_data(this) | ||
class(fmsDiagFileContainer_type), intent(in), target :: this !< The file object |
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 isn't the file object. This is the diag file object container. Why does this have to take the whole container and not just the diag file object?
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.
It's only 1 container object being sent in, not the whole thing.
character(len=*) , intent(in) :: long_name !< The long_name of the variable | ||
character(len=*) , intent(in) :: units !< The units of the variable | ||
|
||
!TODO harcodded double |
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 see there is a TODO for this, so we can move on. We are supporting all types, and netcdf files can have all types in them.
domain => null() | ||
diag_file => null() | ||
end subroutine open_diag_file | ||
|
||
!< @brief Writes the time average variables (*_T1, *_T2, *_DT) in the netcdf file | ||
subroutine write_avg_time_metadata(fileobj, variable_name, dimensions, long_name, units) |
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.
Please combine the repetitive routines for maintainability
…g use_clock_average = .true. with the old diag_manager
@uramirez8707 can we use this feature using diag_table ? is yes can you provide a sample ? thanks |
@jiandewang unfortunately this feature is only going to be available for diag_table.yaml and the new diag_manager, which won't be production for at least a couple of months. |
@uramirez8707 thanks for the heads up |
@uramirez8707 can you tell me whether diag_table.yaml and the new diag_manager is available in FMS now ? I need to use diag_yaml to control the output frequency. I checked the commit log in current FMS but can't find b0334fc commit |
@jiandewang The updated diag manager is almost ready. We are coding the updated reduction routines which will be the last step before testing can begin. The reduction routines are needed so that the diag manager can be run through. The time frame we are looking at is October/November. When it's ready for testing, we would appreciate the help testing the flexible timing feature because we at GFDL don't have a use case and it appears you do. |
@thomas-robinson thank you very much for the headup. Please let me know when it's ready. In EMC we are looking for this feature in our coupled system end-to-end global-worlkflow due to special requirement from DA group |
@thomas-robinson can you tell me whether the new diag_manage and diag_table.yaml feature is in FMA main repo. ? |
@jiandewang we are currently testing the tag 2024.01-beta5 which is on the dmUpdate branch. If the tests all pass (which it seems like they finally will), we will be merging the code into main and releasing it at the end of this week as 2024.01. There is likely to be a follow on patch next week or the week after. |
@thomas-robinson I just started my first try but without success. for the ocean model I tested, using the following original diag_table works fine: now I switched to diag_table.yaml but failed:
error message I got: what's wrong in my yaml file ? Is there a namelist/flag to tell the system that we are using yaml style instead of traditioanl style ? |
I think you are missing setting the |
thanks @uramirez8707. Now I got "You must compile with -Duse_yaml to use the option use_modern_diag". Let me recompile it and try again |
I add "Duse_yaml" to compile FMS and that worked fine. But when I tried to compile MOM6 I got error: do I need to also add "Duse_yaml" to compile MOM6 ? |
Are you compiling FMS with cmake? You shouldn't need to add that MOM6. |
no, I followed the compiling steps from MOM6-examples. See https://github.com/NOAA-GFDL/MOM6-examples/wiki/Getting-started#compiling-the-models |
What system are you using? You do need to install libyaml: https://github.com/yaml/libyaml |
I am using intel. Let me try to follow your information. Thanks @uramirez8707 |
Description
Fixes need flexible output average capability #956 Adds use_clock_average namelist to diag_manager_nml
If .true. the averaging is done based on the clock. For example, if doing daily averages and your start the simulation in day1_hour3, it will do the average between day1_hour3 to day2_hour 0. The default behavior will do the average between day1 hour3 to day2 hour3
Adds the capability to allow for different file frequencies for the same file.
For example, for this diag_file yaml entry
It will create a file every 6 hours for 12 hours
flexible_timing_0002_01_01_01.nc
- using data from hour 0 to hour 6flexible_timing_0002_01_01_07.nc
- using data from hour 6 to hour 12Then it will create a file every 3 hours for 3 hours
flexible_timing_0002_01_01_13.nc
- using data from hour 12 to hour 15Then it will create a file every 1 hour for 9 hours.
flexible_timing_0002_01_01_16.nc
- using data from hour 15 to hour 16flexible_timing_0002_01_01_17.nc
- using data from hour 17 to hour 18etc
etc
The filenames still need some more work.
time_bounds
,T1
,T2
,DT
)How Has This Been Tested?
CI including added tests
Checklist:
make distcheck
passes