-
Notifications
You must be signed in to change notification settings - Fork 39
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
Solve bug in ACCESS1 dataset fix for calendar. #671
Conversation
I'm not sure if the current test actually represents an actual case, or it's just a random different calendar. Also not sure if it's okay to just test the calendar name without seeing if the data are still okay. I'll try to add a test case for the proleptic_gregorian calendar with different time offset tomorrow. |
I updated the test cases, now including two reference dates: one representative for e.g. piControl, one for more recent dates. The updated test checks not just the name of the calendar, but also if the represented datetimes are unaffected. Only question I have is: why did the original test case use a 'julian' calendar? Was that a random pick, or was it based on a real use case? I'm guessing it was random, for all I see on ESGF is proleptic_gregorian. So I'm assuming it's safe to change the test. Is that okay, @jvegasbsc ? @katjaweigel can you verify that this updated works for your use cases as well? |
Yes, it's ok |
It's fine but what puzzles me is why we have not had this fix in from the get going ie has ACCESS1 data changed in the meantime? 🍺 |
Thanks for the fix, I start a test now. |
I get an error with concatenating cubes running esmvaltool/recipes/recipe_deangelis15nat.yml with access1_0 and this fix, testing now if the fix is really the reason or if it is not related. |
Thanks for checking! One side-effect that I noticed is that years before 1850 now get negative time points (like 1 Jan 1849 is "-365 days since 1850-01-01") , but I suppose that shouldn't matter for concatenating the cubes, or does it? |
Seems to be cause by the fix, the error does not occur with the current ESMValCore master (I added two prints for the time but the error occurred also without): 2020-06-09 15:08:52,512 UTC [18856] ERROR Failed to run concatenate([<iris 'Cube' of toa_incoming_shortwave_flux / (W m-2) (time: 1140; latitude: 145; longitude: 192)>], {}) I'll try to find out what happens ... |
@bouweandela and myself have recently fixed a bug in concatenation, please merge the latest |
So it seems in the first print, the calendar has not been fixed. But I wonder why... |
Thanks @valeriupredoi , you are right, if I merge in master into fix_access1_calendar:
It should be, I printed the time before and after the fix to see the difference. |
Ah okay, I misunderstood. I thought they were the 2 cubes that had to be concatenated. Thanks again for testing! I merged master into this PR, so now everything should work fine. Do you want to test it again? |
I guess it should work because but I started it with the update to be really sure, takes about 20 minutes (but usually only 3 if it fails). |
Thanks you, after merging the master it works. |
The access1 datasets have time units
Unit('days since 0001-01-01', calendar='proleptic_gregorian')
. The existing fix only changes the calendar, but that results in a wrong interpretation of the time points, where the days are offset by ~2 days. This PR changes the time offset first to 'days since 1850-01-01', usingconvert_units
to make sure that time points are updated as well. For the recent period (after 1582 or so), both calendars should be the same, and hence the calendar can now safely be changed to 'gregorian'.Tasks
Public functions should have a numpy-style docstring so they appear properly in the API documentation. For all other functions a one line docstring is sufficient.If writing a new/modified preprocessor function, please update the documentationPlease useyamllint
to check that your YAML files do not contain mistakesIf you make backward incompatible changes to the recipe format, make a new pull request in the ESMValTool repository and add the link belowIf you need help with any of the tasks above, please do not hesitate to ask by commenting in the issue or pull request.
Closes #669