-
Notifications
You must be signed in to change notification settings - Fork 32
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
implement lead time coordinate #634
Conversation
I noticed in the new coordinates table, the standard_name given for reftime1 is "leadtime", but according to @martinjuckes at #623 (comment) it should be "forecast_period". "reftime1" in the coordinates table should have "must_have_bounds = "no" and bounds_values should be set to the null string. I think it's also probably a mistake to define a default value for "reftime1", since this will probably vary from one forecast to the next. [Also, although reftime may be a restricted key word in cftime, that shouldn't preclude its use as the identifier for the reftime coordinate variable in CMOR should it? If it shouldn't, then what is the reason for naming it "reftime1" instead of simply "reftime"? (Of course this makes no difference to the output variable name which is outname="reftime".)] Normally a forecast field will be a synoptically sampled ("instantaneous") meteorological field, in which case "must_have_bounds" should be set to "no" for leadtime. If some of the forecast fields should be accumulated or "time-means" and others will be instantaneous snapshots, then 2 different "leadtime" coordinates should be defined (e.g. analogous to "time" and "time1"). Does the presence of "reftime1" in the list of "coordinates" appearing with a variable in the amon.json file trigger CMOR to create leadtime and store both leadtime and reftime in the file (and include both of these variables in the netcdf "coordinates" attribute list? Where is the test code that is used to check whether the changes produce correct output (sorry, my familiarity with pull requests is still weak). I'd like to review it. Also, could you post somewhere an ncdump of the first part of the file produced by the test code? |
Hi Karl,
|
Hi Karl,
This is just a placeholder value, as it's what triggers coordinate's interpretation as a scalar in CMOR's code. I think it would require much more work to change this behaviour, and make it backwards compatible at the same time, although I could probably add both reftime and leadtime in one go, as a separate API call. I have removed bounds from the CV_coordinates file (sorry, missed that one yesterday).
The cftime issue was a bit of a conjecture on my part (I investigated it early on, when I wasn't familiar with CMOR's code at all, and I vaguely remember the namespace conflict was present in Python netCDF4). The fact is that CMOR segfaults during writing of the variable to the file (in
Ahh I see. Okay, I will need to have a think how to resolve this.
Only if the new function ( |
@piotr-florek-mohc You will want to merge the latest from master to remove the Python 3.6 tests since we are no longer supporting Python 3.6 in an upcoming release. |
thanks @mauzey1, that has been done |
@piotr-florek-mohc I noticed that you included a Python test but it is not part of the continuous integration test suite. Please add the following line to the file Makefile.in under the
I tried running the test but it experienced an error.
|
Thanks @mauzey1, I missed the fact that I hadn't put my test CV under version control... |
Hi @mauzey1 would you be able to briefly take a look and check how sensible the solution is, and if it requires major reworking? Many thanks! |
I think these changes are reasonable. However, I would like to have a new entry in the documentation for the @durack1 @taylor13 Are you fine with these changes? Do you want me to perform any tests before merging? |
@taylor13 over to you.. |
@piotr-florek-mohc - I wonder if you have tested this version as part of your regular job stream in post-processing CMIP6 output (including cases when the new parts of the code are not needed). If not, do you think such a test is needed to be safe, or are you confident that the coding you've included can't disrupt the older code. (I know you settled on an implementation strategy that would minimize possible impact, so perhaps the answer is yes, but please confirm.) Thanks. |
@taylor13 All of the current tests are passing, and the |
That's great. I'm happy. |
This is my first go at issue #623. Adding scalar reference time could be achieved just by specifying a value of
reftime1
inmip_tables
, which can be later overridden during runtime (please note thatreftime
is a restricted keyword in the cfunits namespace).Adding leadtime has been achieved by implementing a simple function which creates an auxiliary lead time coordinate, and populates it with differences between time coordinate values and the reftime. Calendars and units should be the same, and the reftime should be outside the bounds of the time coordinate (i.e. must be earlier than the opening bound of the first time step).
I've also added a small tweak to
cmor_write()
function, to allow me to retrieve thencid
after the write is complete.cc @matthew-mizielinski