Project

General

Profile

CDO CMOR Operator for CDO version lower equal 1.8.1

Installation

Download source

git clone https://github.com/PCMDI/cmip6-cmor-tables.git
git clone https://github.com/PCMDI/cmor.git
git clone git@git.mpimet.mpg.de:cdo.git
cd cdo
git submodule init
git submodule update
git checkout develop

Configure (Mistral)

module load gcc
cd cmor
./configure --prefix=$HOME/local --with-uuid --with-udunits2=/sw/rhel6-x64/util/udunits-2.2.17-gcc48 --with-netcdf=/sw/rhel6-x64/netcdf/netcdf_c-4.4.0-gcc48 LIBS=-lossp-uuid
make install
cd ..
mkdir build-cdo
cd build-cdo
../cdo/configure --with-cmor=$HOME/local --with-hdf5=/sw/rhel6-x64/hdf5/hdf5-1.8.14-threadsafe-gcc48 --with-netcdf=/sw/rhel6-x64/netcdf/netcdf_c-4.4.0-gcc48 --with-udunits2=/sw/rhel6-x64/util/udunits-2.2.17-gcc48 CPPFLAGS="-I$HOME/local/include/cdTime -I$HOME/local/include/json-c" LIBS=-lossp-uuid
make -j8
ln -s ../cmip6-cmor-tables/Tables .

Configure (Ubuntu)

apt-get install libossp-uuid-dev libnetcdf-dev
# maybe more prerequisites needed
cd ../cmor
./configure --prefix=$HOME/local --with-uuid --with-udunits2 --with-netcdf CFLAGS="-I/usr/include/ossp" LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5/serial LIBS=-lossp-uuid
make install
cd ../build-cdo
../cdo/configure --with-cmor=$HOME/local --with-hdf5 --with-netcdf --with-udunits2 CPPFLAGS="-I/usr/include/hdf5/serial -I$HOME/local/include/cdTime -I$HOME/src/cmor/include/json-c" LIBS=-lossp-uuid LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5/serial
make -j8
ln -s ../cmip6-cmor-tables/Tables .

Running

Preprocess

Select two variables from GRIB file and prepare for cmor. Variable selection could also be done with the cmor operator but doing it early is obviously more efficient.

partab.txt:

&parameter
  param = 130.128
  out_name = ta
  cell_methods = "time: mean" 
  units = "K" 
/
&parameter
  param = 131.128
  out_name = ua
  units = "m s-1" 
/

src/cdo --cmor -r -f nc selcode,130,131 -setpartabp,partab.txt -invertlat -setreftime,1850-01-01,00:00:00,days -settbounds,month /work/mh0469/m221078/prj/cmip6/piControl_r1i1p1-MR_echam6_ATM_mm_1850-1899.grb tmp.nc

Cmorize

Some requested pressure levels are missing in GRIB data. CMIP6_Amon.json table was changed to compensate for that.
You have to edit the levels for the dimension belonging to your variable. For plev17 this would be:

--- a/Tables/CMIP6_Amon.json
+++ b/Tables/CMIP6_Amon.json
@@ -228,8 +228,6 @@
                 "7000.", 
                 "5000.", 
                 "3000.", 
-                "2000.", 
-                "1000." 
             ], 
             "stored_direction": "decreasing", 
             "z_factors": "", 

cmor.rc contains settings for cmor_dataset_json() and special entries used by the cmor operator. Entries with two leading underscores are used for cdo/cmor internal purposes. All other key-value pairs are dumped to a JSON file and fed to cmor_dataset_json(). CMOR itself uses entries with one leading underscore internally. The remaining k-v pairs are used to create the nc files. Unknown (to CMOR) keys are simply copied as global attributes.

Now run cdo with cmor3 operator

src/cdo cmor,Tables/CMIP6_Amon.json,__info=cmor.rc tmp.nc

Produces output files

CMIP6/ua_Amon_piControl_MPI-ESM_r1i1p1f1_gn_185001-189912.nc
CMIP6/ta_Amon_piControl_MPI-ESM_r1i1p1f1_gn_185001-189912.nc

These can be compared to "official" files in /work/ik0555/cmip5/archive/CMIP5/output/MPI-M/MPI-ESM-MR/piControl/mon/atmos/<var>/r1i1p1/...

Grid mappings

Basic support for grid mappings has been added. This was only tested with a rotated lon/lat grid. In order to handle grids, CMOR must load a grid table in addition to the normal table. The __grid_table keyword is used to tell cdo cmor which table to load as grid table.

src/cdo cmor,Tables/CMIP6_day.json,__info=cmor.rc /work/mh0287/users/uwe/grid_mapping/CNRM-CERFACS_rllc.nc