PCMDI / cmor

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

The value of the realm global attribute in netCDF file for tasmin is not equal to the value of the modeling_realm in CMIP6_day.json MIP table #97

Closed ehogan closed 7 years ago

ehogan commented 8 years ago

I have produced an output netCDF file for tasmin using the CMIP6_day.json MIP table. The value for the modeling_realm attribute in the CMIP6_day.json MIP table for tasmin is atmos (https://github.com/PCMDI/cmor/blob/master/TestTables/CMIP6_day.json#L2932), but the value of the realm global attribute in the output netCDF file is seaIce ocean, which is equal to the value of the realm attribute in the header of the CMIP6_day.json MIP table (https://github.com/PCMDI/cmor/blob/master/TestTables/CMIP6_day.json#L5). Should the value for the modeling_realm attribute be used instead?

dnadeau4 commented 8 years ago

I talked to @taylor13 and he told me the WIP has not decided how to handle this yet.

Sorry about the confusion, the Table header have realm which is a global attribute and the Variable has modeling_realm which is a variable attribute. It seems as well that the CMIP6_day table has a mixture of seaIce ocean and atmos variables. We might have to create 2 tables for day stuff, I am not sure how to handle this just yet.

durack1 commented 8 years ago

@dnadeau4 not certain what my role in this is?

dnadeau4 commented 7 years ago

@taylor13 What is the difference between realm (GLOBAL) attribute and modeling_realm (variable attribute). Can they be so different realm=atmos modeling_realm=seaIce ocean in the same file.

dnadeau4 commented 7 years ago

Solution: used the variable modeling_realm as the global attribute realm.

dnadeau4 commented 7 years ago

Will do soon....

ehogan commented 7 years ago

This appears to be working in CMOR 3.2.2. I did notice the realm in the Header of the CMIP6_day.json MIP table is now atmos (see https://github.com/PCMDI/cmor/blob/master/TestTables/CMIP6_day.json#L5), which matches with tasmin. However, in the CMIP6_Amon.json MIP table, the realm in the Header is atmos atmosChem (see https://github.com/PCMDI/cmor/blob/master/TestTables/CMIP6_Amon.json#L5), but the realm in the output netCDF files is atmos for e.g. ps, (see https://github.com/PCMDI/cmor/blob/master/TestTables/CMIP6_Amon.json#L766) :)

dnadeau4 commented 7 years ago

I need to use modeling_realm from tje variable metadata and pass it as Global Attribute realm. I have not got to this just yet. If I remember, the WIP decided to use the first modeling_realm value when you have 2 values.

ehogan commented 7 years ago

Apologies for not being clear; I believe that the value of the modeling_realm attribute from the variable metadata is already being used as the value of the realm global attribute in the output netCDF file :)

dnadeau4 commented 7 years ago

Thanks! I just check the code and use modeling_realm if it exist in the variable, otherwise I use realm from the table. If we have 2 realms, both are passed to the file.

ehogan commented 7 years ago

@dnadeau4 I'm just testing CMOR 3.2.2 and this issue has been reintroduced (the issue was resolved in CMOR 3.2.1), i.e. the realm is being used instead of the modeling_realm. Is there any chance you could take a look at this?

dnadeau4 commented 7 years ago

I did not change anything there....

https://github.com/PCMDI/cmor/blob/master/Src/cmor.c#L2621-L2633 Should take the variable realm first and then the table realm.

(I think the second table vars should be indexed with var_id not nVarRefTblID). Can you send me your variable and table as an example?

ehogan commented 7 years ago

I'm so sorry @dnadeau4, I got myself confused (again!) :( Everything is working fine, please ignore me :)