WCRP-CORDEX / cordex-cmip6-cmor-tables

JSON Tables for CMOR3 to create CORDEX-CMIP6 datasets
https://wcrp-cordex.github.io/cordex-cmip6-cmor-tables
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

evaluate regular expressions #98

Open sol1105 opened 3 months ago

sol1105 commented 3 months ago

There is a typo in the CV attribute driving_variant_label. It is currently called driving_variant_labelin the required_global_attributes, but missing the driving_ prefix in the actual CV entry (so just being called variant_label).

:1438        "variant_label": [
:1439            "r[[:digit:]]\\{1,\\}i[[:digit:]]\\{1,\\}p[[:digit:]]\\{1,\\}f[[:digit:]]\\{1,\\}$"
sol1105 commented 3 months ago

version_realization does not have an entry, it could have an entry similar to driving_variant_label.

        "version_realization": [
            "v[[:digit:]]\\{1,\\}-r[[:digit:]]\\{1,\\}$"

Since 0 is not allowed(?!), maybe this example would have to be modified, eg.

 "version_realization": [
            "v[1-9]\\{1,\\}[[:digit:]]\\{0,\\}-r[1-9]\\{1,\\}[[:digit:]]\\{0,\\}$"
larsbuntemeyer commented 3 months ago

Thanks for pointin this out. That's another relict from the original CMIP6 CV. We did not really change the convention on the variant label so keepin the original regex should be fine. However, i could not really figure out how to evaluate these regex, e.g., have the same questions as in https://github.com/PCMDI/cmip6-cmor-tables/issues/281. Do you know, if cmor actually evaluates regex during cmorization?

larsbuntemeyer commented 3 months ago

My closest approach to evaluate regex is this: https://github.com/euro-cordex/cmor-check/blob/2eb19b36bf39cc1dd1f1a6c93b993a37a1b27331/cmor_check/cmor_check.py#L11-L14

However, that won't work for most of the regular expressions, e.g., in the CMIP6_CV.

sol1105 commented 2 months ago

The problem seems to be that the re module in python doesn't know [[:digit:]]. It also seems to not like all the backslashes. Without those, and with [[:digit:]] replaced by \d it works.