-
Hi everybody. I am a newcomer to ESMValTool, so please forgive any mistake in the method, and shallow knowledge of the tool and doc. In the ESMValCore doc, there are nice explanations about dataset fix. The section about common errors claims that
However, the case of wrong variable name is not actually presented, and I would like to handle it. What is not clear for me is :
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 7 replies
-
I discovered that Issue #1249 does address a nearby but different concern regarding finding variables with 'wrong' name, and @valeriupredoi stated there (back in aug 2019):
I also noticed that maybe there was some progress on that topic, because there is a file esmvalcore/cmor/variables_alt_names with that doc :
but was not able to find more explanations about the use of that feature for actually handling the case where in a given project, e.g. variable 'tas' is named 't2m' |
Beta Was this translation helpful? Give feedback.
-
I also discovered that #950 should give at least part of the answer but :
|
Beta Was this translation helpful? Give feedback.
-
Hi @senesis, welcome to the ESMValTool! I'm fairly new myself, but I've also worked a bit on a cmorizer as a fix that renames variables and I may be able to provide some help (although I'm not sure if it's there are better ways to do it). Something you can try is to use the AllVars class. This one receives all the cubes and not only the ones for the specific variable. Here you can loop through the cubes looking for the ones that have the wrong name and substitute the right name. You can look at the very early prototype I was doing here: https://github.com/ESMValGroup/ESMValCore/blob/86d170ba74e74a05ef482958af9ed87430af71bc/esmvalcore/cmor/_fixes/native6/emac.py#L25-L29 I'm not sure if that's your specific case, so you can see another kind of renaming in this other fix: https://github.com/ESMValGroup/ESMValCore/blob/master/esmvalcore/cmor/_fixes/obs4mips/ssmi.py Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Digging hard first in the doc, then in the code, I discovered that :
This means that I can solve my problem by :
Elaborating that solution was a bit tedious. I would be glad if an EsmValCore expert could validate that this is the most sensible way to achieve my goal ; this could help other users Maybe would it be safer to define another way than extending file esmvalcore/cmor/variable_alt_names.yml ? AFAIU, that alias mechanism is rather for define alias across cmor_types, not for aliasing across projects; so I think we could e.g. configuring an aliases dict :
(this doesn't answer the specific question above about how to name the fix methods) |
Beta Was this translation helpful? Give feedback.
-
Hi @senesis that's some great digging! Maybe I can elaborate a bit. So there's 2 things here,
input_dir:
default: 'Tier{tier}/{dataset}/{latestversion}/{frequency}/{short_name}'
input_file:
default: '*.nc' So in this case the files should be stored following the If you want to support yet another filenaming convention, the easiest way is probably to add that DRS to the config-developer file. If it is variable-specific, you can add additional information to the recipe, like we initially did for ERA5. See e.g.:
However, we encourage adhering to existing convention rather than adding custom ones. So if for some reason the existing solutions don't fit for you, we're happy to think along about how to best support your specific use case. In that case, please provide some more information about the specific file naming system used for your data. Hope that helps. |
Beta Was this translation helpful? Give feedback.
-
hello @senesis and cheers for using our Discussions forum! If you need to use a custom variable as it is native to the model you are looking to analyze but not native to CMOR, then I would look at the custom CMOR tables and see if your variable(s) are there already - if not, then you can prepare one or more of those tables for your variables (and create derivation scripts, if the variable can be derived from CMOR variables, but I believe that's not the case for you); altering the |
Beta Was this translation helpful? Give feedback.
-
I suggest to close this discussion with that summary : If some input data files, belonging to some weird project having cmor_type=CMIP6, represents, say, some CMIP6 CMOR variables but have their filename formed using another value that the CMOR variable name (let us say, they use Implementing the change proposed in that issue would allow to describe, at the level of the project declaration, the variable name aliasing scheme to apply to filenames and so to avoid renaming files |
Beta Was this translation helpful? Give feedback.
-
ESMValTool Version 2.3 introduced the extra facets, which allow to nicely solve the issue . See an example of its use in this fix code , which uses this config file |
Beta Was this translation helpful? Give feedback.
ESMValTool Version 2.3 introduced the extra facets, which allow to nicely solve the issue . See an example of its use in this fix code , which uses this config file