-
Notifications
You must be signed in to change notification settings - Fork 38
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 preprocessor function to resample time and compute x-hourly statistics #696
Conversation
Could they be added in the init list to be called in the recipe? In this way you get rid of the data before continuing with the preprocessing. I guess the output product would need to have the frequency updated then. |
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.
nice addition, Javi! 🍺
Added. |
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.
Hi @jvegasbsc , I just had a look at this pull request. It looks like it is more or less complete. I think we should try to get this merged. It just needs a bit of polish to get it finished. Please see my review comments.
Also, could you have a look at the Dockerfile so that it does not conflict with master and fix the Codacy complaints?
Co-authored-by: Stef Smeets <[email protected]>
Co-authored-by: Stef Smeets <[email protected]>
1f2361f
to
0395ea7
Compare
Co-authored-by: Stef Smeets <[email protected]>
Nice work @jvegasbsc ! Can you fix the last CI errors: commit/documentation:
Codacy: Then I think this is ready to be merged! |
Done! |
Hi @axel-lauer , this PR is finished from a technical point of view. We need a scientific review to get this merged, but I'm not entirely sure who to ask. Do you have any idea who we could ask? |
Maybe you could take a look at this issue: ESMValGroup/ESMValTool#1818. The list is still a draft and far from complete but I would guess we might ask e.g. someone listed under 'extreme events'. |
Thanks @axel-lauer ! Let's see if we can do this 😉 Hi @jhardenberg @maritsandstad, could I ask one of you to do a scientific review of this PR? We already did a technical review and would like to get this merged. You can perhaps start by looking at the documentation (https://github.com/ESMValGroup/ESMValCore/blob/f8bfd90e93c30e0f4935dfbb4d7bc618274ac37d/doc/recipe/preprocessor.rst), particularly the sections on Hourly statistics, Resample time, and Resample hours, and see if that makes sense and go from there. Thanks! |
Hi, looks like a very useful addition indeed! The difference between Both seem useful, but would the exact same functionality of Isn't As you write this sampling makes sense only for instantaneous data and would be clearly wrong for cumulated data (or time-averaged) data (all mass or energy fluxes). Would it maybe be better to add a check in the variable attributes to prevent users to apply it to such variables, like e.g. precipitation? Should the name "resample_hours" maybe be changed to something like "resample_inst_hours" to make this clear and avoid abuse? Actually it would be nice in the future to develop a similar functionality also for time-averaged variables (e.g. precipitation, radiative fluxes), so that one can change from 3hr frequency to 6hr etc .... In this case, since the variables are in units like Kg/m^2/s or W/m^2, they should be averaged between timesteps. E.g. 3hr data would become 6hr data averaging the 1st and 2nd timestep, the 3rd and 4th etc. Also in this case an offset could be specified. |
Co-authored-by: Stef Smeets <[email protected]>
Yes, that's the difference
Yes, but in that case I feel inclined to also allow lists on the other options and this will lead to frequencies that we are not currently supporting
Yes, certain configurations of this function can do exactly what other functions already do.
A check in the cell methods to check if
The hourly statistics will do this, although an offset can not be specified |
Hi @jhardenberg , if you are happy with the response, could you please approve this PR? Then I think this can be merged 😄 |
Hi, the responses are fine for me, thanks. As said, I would just add at least a clear warning about the fact that the sampling provided by this function should be used only for instantaneous data and not for fluxes (which should be averaged). |
Hi @ESMValGroup/esmvaltool-coreteam , this PR is ready to be merged! |
…to resample_time
The pending errors are related to the documentation and they already exist on master |
@jvegasbsc It would have been nice if this comment by @jhardenberg could have been addressed before merging this, but it's too late now I guess. |
* operator: operation to apply. Accepted values are 'mean', | ||
'median', 'std_dev', 'min', 'max' and 'sum'. Default is 'mean' | ||
|
||
See also :func:`esmvalcore.preprocessor.daily_statistics`. |
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 should be:
See also :func:esmvalcore.preprocessor.hourly_statistics
.
I guess
@sloosvel found a use case in which we needed to convert 3-hourly data to 6-hourly and we found that this capability is missing in the core, as we don't go futher than
daily_statistics
. This pull requests add support for x-hourly statisticsBut in this case we are working with instantaneous data and so we don't really want to compute but just to extract some values. I added the functionality for this, so we can now convert data frequencies by resampling it.
Tasks
yamllint
to check that your YAML files do not contain mistakes