Remapping from regular grid to gaussian_reduced (cubic-octahedral)
Added by Joakim Kjellsson over 4 years ago
Hi all
I'd like to add some random perturbations to the skin temperature input field in OpenIFS.
The field is in the file ICMGGECE3INIT which is on a reduced gaussian grid (see description of octahedral reduced Gaussian grids here: https://confluence.ecmwf.int/display/OIFS/4.1+OpenIFS%3A+Gaussian+grids)
My approach so far as been to first generate some random numbers on a regular N96 grid.
cdo -f grb -remapbil,N96 -divc,10 -subc,0.5 -random,r480x240,1 random.grb
Now I want to remap this field to the reduced octahedral gaussian grid, so I first generate a grid description from the ICMGGECE3INIT file:
cdo griddes ICMGGECE3INIT > griddes.txt
Then I do:
cdo -setgrid,ICMGGECE3INIT -remapdis,griddes.txt random.grb random_O96.grb
But I get the error:
cdo(1) remapdis: Process started cdo(1) remapdis (Abort): gaussian_reduced: grid coordinates missing! terminate called without an active exception
I don't know what I'm missing here. The griddes.txt file contains everything you would need to construct the reduced gaussian grid (number of points, latitudes and longitude points per latitude).
Or do I need to generate a different kind of grid description file?
Does anyone have an example of how to remap data from one grid to another? Or does CDO only support remapping to regular or full Gaussian target grids?
Many thanks for any help
Joakim
PS. I'm attaching the necessary files
Details:
I'm on DKRZ Mistral and my CDO is
$ cdo -V Climate Data Operators version 1.9.8 (https://mpimet.mpg.de/cdo) System: x86_64-pc-linux-gnu CXX Compiler: g++ -fopenmp -O2 -g -march=native -mavx2 CXX version : g++ (GCC) 6.4.0 C Compiler: gcc -fopenmp -pthread -O2 -g -march=native -mavx2 C version : gcc (GCC) 6.4.0 F77 Compiler: gfortran -O2 -g -march=native -mavx2 F77 version : GNU Fortran (GCC) 6.4.0 Features: 251GB 48threads C++14 Fortran DATA PTHREADS OpenMP HDF5 NC4/HDF5/threadsafe OPeNDAP SZ UDUNITS2 PROJ MAGICS CURL FFTW3 CMOR AVX2 Libraries: HDF5/1.8.14 proj/6.1.1 CMOR/3.5.0 curl/7.19.7 Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5 CDI library version : 1.9.8 cgribex library version : 1.9.4 ecCodes library version : 2.6.0 NetCDF library version : 4.6.1 of Jul 18 2018 14:28:10 $ hdf5 library version : 1.8.14 threadsafe exse library version : 1.4.1 FILE library version : 1.8.3
griddes.txt (244 KB) griddes.txt | grid description | ||
ICMGGECE3INIT (3.87 MB) ICMGGECE3INIT | initial conditions with skin-temp |
Replies (5)
RE: Remapping from regular grid to gaussian_reduced (cubic-octahedral) - Added by Uwe Schulzweida over 4 years ago
Hi Joakim,
this Bug is already fixed for the next CDO release. A prerelease for testing is available on mistral:/home/mpim/m214003/local/bin/cdo.
It is not necessary to create grid description file, you can use the data file directly:
cdo -f grb -remapbil,N96 -divc,10 -subc,0.5 -random,r480x240,1 random.grb cdo remapdis,ICMGGECE3INIT random.grb random_O96.grbAnd if you don't really need the remapping:
cdo -f grb -divc,10 -subc,0.5 -random,ICMGGECE3INIT,1 random_O96.grb
Cheers,
Uwe
RE: Remapping from regular grid to gaussian_reduced (cubic-octahedral) - Added by Joakim Kjellsson over 4 years ago
Hi Uwe
Many thanks for the quick and helpful reply!
That is definitely a much simpler way to do it.
If anyone else is interested and does not have version 1.9.9, I also figured out that
cdo -f grb -divc,10 -subc,0.5 -setgrid,ICMGGECE3INIT -random,r40320x1,1 random_O96.grb
works.
I can generate a 40320x1 array of random numbers which has the same dimensions as the O96 reduced octahedral grid.
Cheers!
/Joakim
RE: Remapping from regular grid to gaussian_reduced (cubic-octahedral) - Added by Guillaume S over 4 years ago
Hello,
I use this topic as it is perhaps related:
I am trying to convert a netcdf file on a global regular Gaussian grid (F320) to a grib file on global reduced Gaussian grid (N320) with CDO 1.9.8 using the following commands:
cdo -f grb remapbil,N320 mask_F320.nc mask_N320.grib
but CDO treats the destination grid as a full Gaussian grid:
cdo remapbil: Bilinear weights from gaussian (1280x640) to gaussian (1280x640) grid cdo remapbil: Processed 1 variable over 1 timestep [0.32s 209MB].
and consequently, both input and output files stays on the same grid:
Grid coordinates : 1 : gaussian : points=819200 (1280x640) F320 lon : 0 to 359.7188 by 0.28125 degrees_east circular lat : 89.78488 to -89.78488 degrees_north
is this behaviour related to the issue discussed in this topic ?
or is there any error in my command line ? thanks !
Guillaume
RE: Remapping from regular grid to gaussian_reduced (cubic-octahedral) - Added by Joakim Kjellsson over 4 years ago
Hi Guillaume
It's a bit confusing, but in my experience "N" grids are not "reduced" grids in CDO, but instead "full" grids.
So you are actually just interpolating to a full 320 grid, and not a reduced.
If you have CDO 1.9.9 and a file with the target grid, then you can do this:
cdo remapbil,<file_with_target_grid> <infile> <outfile>
Cheers
Joakim
RE: Remapping from regular grid to gaussian_reduced (cubic-octahedral) - Added by Guillaume S over 4 years ago
Thanks for your answer Joakim, I think CDO can make the distinction between "N" and "F" grids, at least with "sinfo" operator, but perhaps not as target grid for interpolation...
I don't have CDO 1.9.9 to test your solution (I get the same error message as you with CDO 1.9.8), I will wait for the official release to update it with conda !
Guillaume