-
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
Variable derivation for ERA5 on-the-fly CMORizer #1806
Comments
Are era5_toa_incident_solar_radiation and era5_top_net_solar_radiation available in a cmor table? If they are, the usual derivation can be used because the |
@bouweandela Excellent idea! I believe the two variables in question are in a CMOR table. I'll give that a try and then report back. |
If the solution proposed by @bouweandela does not work, you may be hitting #1388. There is still an issue regarding the derivation of some custom ERA5 variables, such as rsus and rlus (see ESMValGroup/ESMValTool#2396) |
I tried the method proposed by @bouweandela, unfortunately with limited success. I succeeded in implementing derivation scripts for rsut and rsutcs that calculate these variables from the existing ERA5 variables. I did not, however, succeed in calculating a variable derived from rsut, rsutcs (in this case: swcre). When trying to do so, the preprocessor fails due to missing data. As deriving rsut and rsutcs individually works, I guess the problem might be this kind of “double-derivation”. I think the cleanest way would be to add support for variable derivation with more than one input variable directly to the on-the-fly cmorizer for ERA5. That would also make defining new CMOR tables specifically tailored to ERA5 variables needed for the variable derivation obsolete. Any thoughts on this? |
Indeed "double-derivation" is not supported, but I also suspect it is not needed. If you can do it in two steps, it should also be possible to do it in a single step. Which input variables do have data available and what are the derivation formulas? |
I am not sure I can picture how to combine those two derivation steps without hard-coding the special ERA5 case in the combined derivation script. I would find such hard-coding somewhat undesirable. If you have any ideas, I would be very happy to hear more about this. |
For my understanding, could you please provide:
|
ERA5 input variables
Step1: CMOR variables to be derived from ERA5 data for calculation of swcre
Step 2: target variable to be derived
In case of ERA5 this could also be calculated directly as: swcre =mtnswrf - mtnswrfcs _derive/swcre.py already exists, which calculates swcre as rsutcs - rsut. I am therefore not sure how to implement the direct calculation of swcre from the ERA5 variables without hard-coding an "ERA5 case" in swcre.py. |
Thanks for explaining, I think I get it now.
It looks like this would be the most convenient solution because if it is done by computing
It's not supported by
and put the files in a directory called |
I am afraid I am not sure how this approach could work without additional processing steps outside of the tool. As far as I understand, the two ERA5 variables
I then placed these files into RAWOBS/Tier3/ERA5/v1/mon/swcre. This procedure works with the Here is the test recipe is used: recipe_test_era5.yml.txt But even with this method, I do not know how to avoid having to do this kind of processing the ERA5 files downloaded with era5cli. As this processing happens outside of the tool, this this seems very cumbersome and quite confusing from a user's point of view. Would you possibly have any ideas or suggestions? @schlunma would you know what to do or how to improve this? |
Given that the input file DRS for native6 is just Long story short, I think this preprocessing with |
Thanks for your quick reply @schlunma . I tried this before and this approach failed with this error message:
Am I missing something or did I implement the class "Swcre" in era5.py in a wrong way? |
Hmm...then apparently the theory is wrong 🤦 Could you send the full debug log? |
Here is the full debug log: main_log_debug.txt |
Found the problem. The tool indeed only runs https://github.com/ESMValGroup/ESMValCore/blob/main/esmvalcore/cmor/fix.py#L108-L114 The input argument is in fact a |
I'll try to work on this in the next couple of days 👍 |
Draft PR open here: #2551, will move any discussion there. |
I ran into the problem of not being able to figure out how to derive variables (using more than 1 input variable) with the ERA5 on-the-fly CMORizer. In this concrete case, I would like to calculate the CMOR variable rsut (TOA Outgoing Shortwave Radiation), which is not readily available from ERA5. rsut needs to be calculated from the available ERA5 variables as
rsut = era5_toa_incident_solar_radiation - era5_top_net_solar_radiation
The problem is (as it seems) that it is not possible to have 2 different variables at the time the functions from cmor/_fixes/native6/era5.py are called.
I guess one possible solution could be to have all variables needed for the variable derivation in the ERA5 "raw" files and then follow a similar approach as @schlunma implemented for the on-the-fly CMORizer for EMAC. But I am not sure this is supported by era5cli we use to download ERA5 data and would probably make obtaining the ERA5 data more complicated.
@ESMValGroup/esmvaltool-coreteam would you have an idea how to address the variable derivation problem for ERA5 data?
The text was updated successfully, but these errors were encountered: