-
Notifications
You must be signed in to change notification settings - Fork 11
Description
I want to be able to cmorise anomalies rather than actual values. In ODS2.6 it specifies 3 things in order to do this:
- the variable name should have 'anom' appended, e.g., hussanom.
- the 'long_name' variable attribute should contain the climatological reference period, e.g. 'near-surface (~2m) specific humidity monthly mean anomalies from the 1991-2020 climatological reference period'
- the 'units_metadata' variable attribute has to be added to specify that the variable is a difference e.g., "units_metadata": "specific humidity: difference".
Item 1. is ok - this is now a variable in obs4mips_Amon.json.
Item 3. is ok - we can add >cmor.set_variable_attribute(varid, 'units_metadata', 'c', 'specific humidity: difference') within the script to cmorise the data.
Item 2. is not currently ok - script fails (and highlights some related issues). "long_name" is specified for each variable within the obs4MIPs_Amon.json which is set as the table_id within the cmorisation script. It is not possible to reset this using cmor.set_variable_attribute(..). I have tried - it results in an error in the logfile stating that this attribute must be set by cmor.variable(). However, the only way to do this is through the table_id. The "long_name" set for the variable in obs4MIPs_Amon.json is generic and rightly should not state a specific climatology period because the same variable name could be used by other products that use different climatology periods. So, in order for us to comply with ODS2.6 (and ensure that users know which climatology period was used) there needs to be a way to overwrite the 'long_name' variable attribute.
Relatedly, some of the variable attributes set within obs4MIPs_Amon.json are not correct for all products. For example, the 'cell_methods' attribute is set to "area: time: mean" for hussanom (and most/all variables?). For my insitu product (and likely others) this is not true - it should be "time: mean over station month, area: mean over gridbox". I create a time mean for each station first, and then a mean of all the station months for that gridbox. The order of calculation can make a difference.
Solution?
- Is there a way within cmor to overwrite variable attributes already set by the table id?
- If not, should those attributes that are likely to be different for different products be removed from the table_id (obs4MIPs_Amon.json and equivalent) tables? This would definitely be 'long_name' and 'cell_methods', and possibly 'cell_measures' and 'comment'. I see that 'valid_min' and 'valid_max' are specified as "" within the obs4MIPs_Amon.json table and are able to be reset using cmor.set_variable_attribute() within the cmorisation script. THIS OPTION IS MY PREFERENCE
- Failing the above, then we need another way to record the climatological reference period information and this needs to be changed in the ODS too? This could be done in the 'units_metadata' variable attribute which could then be set to 'specific humidity: difference from 1991-2020 climatological mean'.