cedadev/cf-checker

Issue with 'region' in CMIP6 Ofx variable 'basin'

Closed this issue · 10 comments

When the cmip6 variable 'basin', which has the standard_name 'region' as dictated by the cmip6/cmor tables, is run through cfchecks, it results in a TypeError: e.g.,

...

Checking variable: basin

Traceback (most recent call last):
File "/g/data3/hh5/public/apps/miniconda3/envs/cmip6-publication/bin/cfchecks", line 11, in
sys.exit(main())
File "/g/data3/hh5/public/apps/miniconda3/envs/cmip6-publication/lib/python2.7/site-packages/cfchecker/cfchecks.py", line 3021, in main
inst.checker(file)
File "/g/data3/hh5/public/apps/miniconda3/envs/cmip6-publication/lib/python2.7/site-packages/cfchecker/cfchecks.py", line 488, in checker
return self._checker()
File "/g/data3/hh5/public/apps/miniconda3/envs/cmip6-publication/lib/python2.7/site-packages/cfchecker/cfchecks.py", line 723, in _checker
self.chkDescription(var)
File "/g/data3/hh5/public/apps/miniconda3/envs/cmip6-publication/lib/python2.7/site-packages/cfchecker/cfchecks.py", line 2651, in chkDescription
if not region in self.region_name_lh.list:
TypeError: unhashable type: 'MaskedArray'
...

The test CMIP6 file for this (although others also give the same error) is:
https://esgf-data3.ceda.ac.uk/thredds/dodsC/esg_cmip6/CMIP6/CMIP/MOHC/UKESM1-0-LL/piControl/r1i1p1f2/Ofx/basin/gn/v20190705/basin_Ofx_UKESM1-0-LL_piControl_r1i1p1f2_gn.nc.html

Hi Chloe,

Thanks for reporting this. I will put a fix in to trap the TypeError for region variables so it raises an informative error rather than crash in a messy heap. As a variable with the standard_name = "region", basin should contain values from the standard name region list.

Cheers,
Ros

Hi Ros, Chloe,

the CMIP6 request and CMOR have been written on the assumption that the change discussed and agreed here (trac #151) 3 years ago would be implemented. It appears that this hasn't happened ... so there will be a lot of CMIP6 files with this error.

Hi Martin,
Thanks for the link. I was going to raise a query on the CMOR repository but if it's already known about I won't.
Cheers,
Ros.

Hi Ros,

could you go ahead with the query on the CMOR repository? I only realised that the problem existed when I saw your response to Chloe yesterday, it is not, as far as I know, a registered issue on the CMOR repository yet. If you raise the issue, I can add some comments,

regards,
Martin

I also would like to mention https://cf-trac.llnl.gov/trac/ticket/147 where the use of the attribute 'formula_terms' in the coordinate_bounds variable raises an error. The recommendation was to allow it due to CMOR writing the attributes in this way, however it also has not been integrated into cf-checker.
E.g. the variable 'ta' in the CMIP6 table 6hrLev (as well as other variables reported on model levels) results in this error.

@martinjuckes: Ok. Yes I'll raise it on the CMOR repository.

@chloemackallah: I'll take a look at the other problem you raise above. I'll create a new issue for that one as it looks like that is in the CF convention and thus I should be able to fix the CF Checker for that it.

@martinjuckes: I've raised this on CMOR repository as issue256:

@chloemackallah: The second issue that you raised is the one outstanding check in issue #32 still to implement as it is not straightforward. We will look to implement this very soon.

Section 3.5 has been updated to allow use of flag_values/flag_meanings to indicate region_names. CF Checker will be updated accordingly.