iris: CF variable group not found in netCDF4 file; also not being able to load cube should tell the user why

Hi guys, I have been asked by @ledm why a certain NetCDF_v4 (priority 5) file can not be loaded by iris but ncdump works fine and in actuality it is a netCDF file with metadata and data in it (I am attaching the ncdump -h output; the results of load_raw or load are empty lists and load_cube returns iris.exceptions.ConstraintMismatchError: no cubes found). It proves out that the reason iris can not load any cube out of the file is iris.fileformats.netcdf.load_cubes() returns no cube since it can not find any CF variable ie the dict cf.cf_group.data_variables is totally empty. Why this is is beyond my paygrade, my two cents is that the attribute :Conventions = "CF-1.7 CMIP-6.2" ; is wonky. But you know better! Can I suggest one thing and ask anthoer pls:

  • in such cases it’d be nice if iris actually told the user I can't bloody load the cube because I couldn't find any CF vars;
  • why would it not be able to find any CF vars? Many thanks in advance! 🍺 @bjlittle @pelson @lbdreyer problem_file.txt

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 51 (21 by maintainers)

Most upvoted comments

Just a post scriptum on the pyke installation error: This happened to me when I set up an environment first with conda create -n evt python=3 and then did an update with conda env update -n evt --file environment.yml. Turns out in my case the reason was that the creation of the environment installed a python 3.8 which was downgraded to python 3.7 in the update step which worked out completely ok, except that pip was somehow confused in looking things up until I deactivated and reactivated the environment (I may even have logged out in between), at which point everything worked smoothly.

…and now volcello is a data variable:

CFGROUP = {'volcello': CFDataVariable('volcello', <class 'netCDF4._netCDF4.Variable'>
float32 volcello(lev, nlat, nlon)
    _FillValue: 1e+20
    cell_measures: area: areacello volume: volcello
    cell_methods: area:
...

😄

Cheers, Bill! In theory all deps should have been installed by conda in the esmvaltool env, unless iris 3 has new deps vs 2.2.1. Ill try as soon as I get in work. Much thanks to Bill for being so on the ball 🍺

Dr Valeriu Predoi. Computational scientist NCAS-CMS University of Reading Department of Meteorology Reading RG6 6BB United Kingdom

On Wed, 20 Nov 2019, 10:59 Bill Little, notifications@github.com wrote:

Actually, lets continue that discussion on the ESMValTool github: ESMValGroup/ESMValTool#1442 https://github.com/ESMValGroup/ESMValTool/issues/1442

@ledm https://github.com/ledm Yeah, that kinda make sense to me.

Ideally, you’d just want to conda install -c conda-forge iris=3.*, but that’s not available just yet, well most likely not until next month.

Until then, perhaps you’re happy to run with something like installing all the iris dependencies and then use something along the lines of pip install git+https://github.com/scitools/iris/ --no-deps… which should pull in the master version of iris. Something like that.

I’ll keep this issue open for a while in case there is any follow-on chatter.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SciTools/iris/issues/3544?email_source=notifications&email_token=AG5EFI2U3HF2CK3FPP4BA3DQUUKCHA5CNFSM4JOS4562YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEERSXHY#issuecomment-555953055, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG5EFI7H666LI76HZPCSAM3QUUKCHANCNFSM4JOS456Q .

reverted to older versions:

(irisenv2) [valeriu@jasmin-sci1 ~]$ conda list iris
# packages in environment at /home/users/valeriu/anaconda3R/envs/irisenv2:
#
# Name                    Version                   Build  Channel
iris                      2.2.1                    py37_0    conda-forge
(irisenv2) [valeriu@jasmin-sci1 ~]$ conda list netcdf4
# packages in environment at /home/users/valeriu/anaconda3R/envs/irisenv2:
#
# Name                    Version                   Build  Channel
netcdf4                   1.4.2           py37had69b76_1001    conda-forge
(irisenv2) [valeriu@jasmin-sci1 ~]$ conda list libnetcdf
# packages in environment at /home/users/valeriu/anaconda3R/envs/irisenv2:
#
# Name                    Version                   Build  Channel
libnetcdf                 4.6.2             hbdf4f91_1001    conda-forge
(irisenv2) [valeriu@jasmin-sci1 ~]$ conda list hdf5
# packages in environment at /home/users/valeriu/anaconda3R/envs/irisenv2:
#
# Name                    Version                   Build  Channel
hdf5                      1.10.4          nompi_h3c11f04_1106    conda-forge

still no joy! It doesn’t seem to be a dependency issue 😿

will attempt installing 1.5.3, just saw it released 🍺

Thanks @bjlittle, any help you can give us on this tomorrow would be great. It’s a fairly urgent problem for us. We’ll keep looking at it and post anything we find here - but we understand that you might be see anything until tomorrow. Cheers!

@valeriupredoi Thanks. I’m offline pretty much today (only capable of servicing GitHub), but I’ll spin up on this early tomorrow morning and investigate further.

where

fv = encoding.get('_FillValue') -> float32
mv = encoding.get('missing_value') -> float64

@bjlittle extra extra 😁 Man, I tried xarray and the file loads fine in it. I also put one of these volcello up for you to download easily at (it’s weird.nc, no pun intended) https://github.com/NCAS-CMS/NCAS-Useful-Documentation/tree/master/iris 🍺

Hi Bill,

On JASMIN, I’m finding that this problem occurs will all the files that I have looked at matching:

ls /badc/cmip6/data/CMIP6/CMIP///historical/r*/O*/volcello/gr/latest/volcello*:

/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r10i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r10i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r11i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r11i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r1i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r1i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r2i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r2i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r3i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r3i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r4i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r4i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r5i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r5i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r6i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r6i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r7i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r7i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r8i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r8i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2/historical/r9i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_CESM2_historical_r9i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r10i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r10i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r11i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r11i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r12i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r12i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r13i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r13i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r14i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r14i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r15i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r15i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r16i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r16i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r17i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r17i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r18i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r18i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r19i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r19i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r1i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r1i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r20i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r20i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r21i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r21i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r22i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r22i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r23i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r23i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r24i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r24i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r25i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r25i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r26i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r26i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r27i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r27i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r28i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r28i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r29i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r29i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r2i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r2i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r30i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r30i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r3i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r3i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r4i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r4i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r5i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r5i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r6i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r6i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r7i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r7i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r8i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r8i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorCPM1/historical/r9i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorCPM1_historical_r9i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorESM2-LM/historical/r1i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorESM2-LM_historical_r1i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorESM2-LM/historical/r2i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorESM2-LM_historical_r2i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NCC/NorESM2-LM/historical/r3i1p1f1/Ofx/volcello/gr/latest/volcello_Ofx_NorESM2-LM_historical_r3i1p1f1_gr.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-CM4_historical_r1i1p1f1_gr_185001-186912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-CM4_historical_r1i1p1f1_gr_187001-188912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-CM4_historical_r1i1p1f1_gr_189001-190912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-CM4_historical_r1i1p1f1_gr_191001-192912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-CM4_historical_r1i1p1f1_gr_193001-194912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-CM4_historical_r1i1p1f1_gr_195001-196912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-CM4_historical_r1i1p1f1_gr_197001-198912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-CM4_historical_r1i1p1f1_gr_199001-200912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-CM4_historical_r1i1p1f1_gr_201001-201412.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-ESM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-ESM4_historical_r1i1p1f1_gr_185001-186912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-ESM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-ESM4_historical_r1i1p1f1_gr_187001-188912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-ESM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-ESM4_historical_r1i1p1f1_gr_189001-190912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-ESM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-ESM4_historical_r1i1p1f1_gr_191001-192912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-ESM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-ESM4_historical_r1i1p1f1_gr_193001-194912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-ESM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-ESM4_historical_r1i1p1f1_gr_195001-196912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-ESM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-ESM4_historical_r1i1p1f1_gr_197001-198912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-ESM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-ESM4_historical_r1i1p1f1_gr_199001-200912.nc
/badc/cmip6/data/CMIP6/CMIP/NOAA-GFDL/GFDL-ESM4/historical/r1i1p1f1/Omon/volcello/gr/latest/volcello_Omon_GFDL-ESM4_historical_r1i1p1f1_gr_201001-201412.nc

If you can’t access jasmin, these files are also available on ESGF. MIP era: CMIP6, experiment: historical, variable: volcello. Thanks!

@valeriupredoi Good to hear from you 😃

Looking at the ncdump that you provided there’s nothing obviously wrong that I can see. It’s certainly not related to the Conventions attribute.

Would it be possible for you to share the actual NetCDF file with me? Or explain how and where I can download it from? That’s the only way that I’m going to easily progress this for you.

Thanks!