PCMDI / cmor

Climate Model Output Rewriter
BSD 3-Clause "New" or "Revised" License
51 stars 33 forks source link

order in `required_global_attributes` matters #737

Open larsbuntemeyer opened 4 months ago

larsbuntemeyer commented 4 months ago

Just wanted to dump this here, since we now have fixed our required global attributes for CORDEX. I'm not sure if it's by intention, but it seems like the order of variables in the required_global_attributes tables seems to matter when they are evaluated during cmorization. This is probably related to https://github.com/PCMDI/cmor/issues/628. For example, if if have...

{
    "CV": {
        "required_global_attributes": [
            "domain_id",
            "domain",
        ],
        "domain_id": {
            "EUR-50": {
                "domain": "Europe",
                "domain_id": "EUR-50"
            }
        }
    }
}

... and my input dataset file contains domain_id: "EUR-50", cmor will correctly and automatically add the global attributes domain: "Europe" to the file. However, this wil not work if the domain attribute comes before the domain_id attribute in the list of required_global_attributes, e.g., this will not work...

"required_global_attributes": [
       "domain",
       "domain_id",
],

This is somehow confusing and it's not the case for attributes like, e.g., source_id and source....

larsbuntemeyer commented 4 months ago

Sorry, I'll try to provide a minmal example, but, e.g., see here...