Concatenation CESM2-WACCM historical and ssp245 files

34 views
Skip to first unread message

Margarida Samsó Cabré

unread,
Feb 23, 2022, 11:50:57 AM2/23/22
to SciTools (iris, cartopy, cf_units, etc.) - https://github.com/scitools
Hello,

I would like to concatenate CESM2-WACCM historical and ssp245 files for psl_Amon and the concatenation with iris fails. The files are the next ones:

psl_Amon_CESM2-WACCM_historical_r1i1p1f1_gn_185001-201412.nc
psl_Amon_CESM2-WACCM_historical_r2i1p1f1_gn_185001-201412.nc
psl_Amon_CESM2-WACCM_historical_r3i1p1f1_gn_185001-201412.nc

psl_Amon_CESM2-WACCM_ssp245_r1i1p1f1_gn_201501-206412.nc 
psl_Amon_CESM2-WACCM_ssp245_r1i1p1f1_gn_206501-210012.nc



The code to concatenate is the next one:

import iris

from iris.experimental.equalise_cubes import equalise_attributes

ds = iris.load(["/esarchive/exp/CMIP6/historical/CESM2-WACCM/CMIP/NCAR/CESM2-WACCM/historical/r*i1p1f1/Amon/pr/gn/*/*nc", "/esarchive/exp/CMIP6/ssp245/CESM2-WACCM/ScenarioMIP/NCAR/CESM2-WACCM/ssp245/r1i1p1f1/Amon/pr/gn/*/*nc"])

equalise_attributes(ds)
print(ds.concatenate_cube())


And the error is the next one:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/gpfs/projects/bsc32/software/suselinux/11/software/Iris/2.4.0-foss-2019b-Python-3.7.4/lib/python3.7/site-packages/scitools_iris-2.4.0-py3.7.egg/iris/cube.py", line 519, in concatenate_cube
    check_aux_coords=check_aux_coords)
  File "/gpfs/projects/bsc32/software/suselinux/11/software/Iris/2.4.0-foss-2019b-Python-3.7.4/lib/python3.7/site-packages/scitools_iris-2.4.0-py3.7.egg/iris/_concatenate.py", line 272, in concatenate
    check_aux_coords)
  File "/gpfs/projects/bsc32/software/suselinux/11/software/Iris/2.4.0-foss-2019b-Python-3.7.4/lib/python3.7/site-packages/scitools_iris-2.4.0-py3.7.egg/iris/_concatenate.py", line 718, in register
    match = self._cube_signature.match(cube_signature, error_on_mismatch)
  File "/gpfs/projects/bsc32/software/suselinux/11/software/Iris/2.4.0-foss-2019b-Python-3.7.4/lib/python3.7/site-packages/scitools_iris-2.4.0-py3.7.egg/iris/_concatenate.py", line 476, in match
    raise iris.exceptions.ConcatenateError(msgs)
iris.exceptions.ConcatenateError: failed to concatenate into a single cube.
  Dimension coordinates metadata differ: time != time

I already added long_name to longitude/latitude and converted then from float to double so they can be compatible, and I've run out of ideas. Does anyone knows what could this be happening?

Thank you very much in advance.

Best regards,
Marga

Tony Phillips - BAS

unread,
Feb 23, 2022, 12:45:04 PM2/23/22
to Margarida Samsó Cabré, SciTools (iris, cartopy, cf_units, etc.) - https://github.com/scitools

Hi

 

I think the problem here is that you are trying to concatenate cubes from different ensemble members, where I suspect you want to be using r1i1p1f1 (or r2... or r3...) throughout in both historical and SSP245 experiments. If I do this (on JASMIN, using Iris2.4):

 

import iris

 

from iris.experimental.equalise_cubes import equalise_attributes

 

cubes = iris.load(['/badc/cmip6/data/CMIP6/CMIP/NCAR/CESM2-WACCM/historical/r1i1p1f1/Amon/pr/gn/v20190415/*.nc',

                               '/badc/cmip6/data/CMIP6/ScenarioMIP/NCAR/CESM2-WACCM/ssp245/r1i1p1f1/Amon/pr/gn/v20190815/*.nc'])

 

equalise_attributes(cubes)

 

# make the latitude and longitude bounds the same in the first cube (historical run) as in the first ssp245 run

# other metadata tweaks may be necessary depending on the versions of the data being read

for axis in ['x', 'y']:

    cubes[0].coord(axis=axis).bounds = cubes[1].coord(axis=axis).bounds

 

cube = cubes.concatenate_cube()

 

This works fine. You can’t concatenate the cubes across multiple ensemble members as they all cover the same time range and share the same spatial coordinates, so there is no dimension over which they can be concatenated.

 

I hope this is useful.

 

Best regards

Tony Phillips

--
You received this message because you are subscribed to the Google Groups "SciTools (iris, cartopy, cf_units, etc.) - https://github.com/scitools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scitools-iri...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scitools-iris/5b7a84b9-ffdd-47f4-a691-d6e336999e56n%40googlegroups.com.



This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses.

Margarida Samsó Cabré

unread,
Feb 24, 2022, 4:57:46 AM2/24/22
to SciTools (iris, cartopy, cf_units, etc.) - https://github.com/scitools
Hi Tony,

Thank you very much for your prompt reply.  You really saved my day! Making the latitude and longitude bounds the same solves the issue. Thanks a lot!

Best regards,
Margarida
Reply all
Reply to author
Forward
0 new messages