ESMValGroup / ESMValCore

ESMValCore: A community tool for pre-processing data from Earth system models in CMIP and running analysis scripts.
https://www.esmvaltool.org
Apache License 2.0
42 stars 38 forks source link

Anomalies relative to fx-clim or piControl simulations #2016

Open rebeccaherman1 opened 1 year ago

rebeccaherman1 commented 1 year ago

Reading the description of the anomalies pre-processing functionality, it seems that it is only possible to calculate anomalies relative to some time period within the dataset itself. Is it possible instead to calculate anomalies relative to the climatological values from the fixed clim experiment, or from the matching piControl simulation? If it's not possible, could it be implemented? Thanks!

schlunma commented 1 year ago

At the moment, this is only possible for experiments that can be trivially concatenated, e.g., historical and ssp runs (the first ends in 2014, the latter start in 2015). It can be achieved by concatenating two experiments and then using the respective time ranges in the anomaly preprocessor.

Unfortunately, for the PI control runs, this is much more tricky, since basically every model uses different time ranges. Just have a look at this recipe! When trying to concatenate two experiments with a gap, ESMValTool would (rightfully!) complain about that gap.

One possibility to achieve this are the branch_time_in_parent and parent_time_units in the files. There is already some discussion about this in https://github.com/ESMValGroup/ESMValCore/issues/1161. However, before implementing this we would first need to agree on a suitable syntax. You are very welcome to post any ideas here or in the corresponding issue :+1: One further problem about this is that many datasets either specify wrong values for these attributes (or do not give them at all!)...

rebeccaherman1 commented 1 year ago

I suppose that actually what I imagine would not be to concatenate the piControl runs with historical or scenario runs, but to include the piControl experiment as a supplementary dataset. Then the mean of the piControl simulations can be calculated and subtracted from the experiment of interest.

rebeccaherman1 commented 8 months ago

I think that my desired anomaly approach actually doesn't require concatenation as long as the anomaly process could be modified to use the piControl as a supplementary dataset that provides the mean to remove from the other simulations. It does seem like concatenating the piControl experiment with historical runs may be more trouble than it's worth. Do you think this simpler approach might have some promise? It's been a while since anyone commented here, but I am still interested in this functionality.

schlunma commented 8 months ago

I agree that this doesn't require concatenation. I just mentioned this since this is currently the only way to calculate anomalies relative to another experiment.

Implementing this with supplementary_variables sounds interesting. However, while flexible, this feature is currently not able to load data sets with different time coordinates. I am quite sure that this won't be easy at all to implement, since the data will basically be attached to the cube. If the shape of the data differs (e.g., due to a different number of years), this won't work at all.

Another idea could be to implement this as a multi-dataset preprocessor, e.g., like the bias one. However, the hard part here would be to match the different datasets properly while staying as flexible as possible. It might even make sense to add a generalized "math operation" preprocessor here that is able to add, subtract, multiply and divide different datasets.

@ESMValGroup/technical-lead-development-team does anyone have other ideas how to implement this? I really like the idea of calculating anomalies relative to other experiments, but the implementation into our current framework is really hard.

bouweandela commented 7 months ago

Would it work to calculate the required reference and time period of interest as two separate variable groups in the recipe and then calculate the anomaly in the diagnostic?

rebeccaherman1 commented 7 months ago

@bouweandela if I understand correctly what you and @schlunma said here and in the comments in #2308, I think that would work! I liked what you said in the other thread:

we could consider making it possible to pass an cube representing the reference as the reference argument to the anomalies preprocessor function.