Project

General

Profile

Issues with Griddes on a global netCDF file using regridding tools (e.g. remapnn/remapycon).

Added by Chris Bull almost 6 years ago

The global files referred to in this this post can all be downloaded here:
https://1drv.ms/f/s!AtJoRKS33T-Cky3A06Wz_NB0TZLW
The smaller 'toy' files can be created as described below.

--

Task to re-grid from one global curvilinear grid to another (preferably using a conservative scheme).

Problem running this command:

cdo remapnn,new_grid.txt mi-an854i.1m.1995-01_small_newgriddefn.nc mi-an854i.1m.1995-01_small_newgriddefn_remapnn.nc

Results in:

cdo remapnn (Abort): Couldn't read value for a (grid description file: new_grid.txt)!

Stepping back a bit to see how we got here.. If I create a subset of these files and re-do the tweaking I did, i.e.

cdo selindexbox,90,1110,290,910 mi-an854o_1m_19960101_20050130_01_grid_T_sossheigh-only.nc mi-an854o_1m_19960101_20050130_01_grid_T_toy.nc
cdo  selindexbox,100,1100,300,900  mi-an854i.1m.1995-01_small.nc mi-an854i.1m.1995-01_small_toy.nc

#hack up a griddes file so the source file looks more like the target.. 
cdo griddes mi-an854o_1m_19960101_20050130_01_grid_T_toy.nc > new_grid.txt
cdo griddes mi-an854i.1m.1995-01_small_toy.nc > old_grid.txt

#xname/yname as nav_lon/nav_lat (the latter seems to be important to match the target x/y names)
sed -i -e 's/TLON/nav_lon/g' old_grid.txt
sed -i -e 's/TLAT/nav_lat/g' old_grid.txt 

#re-write with hacked grid defn
cdo setgrid,old_grid.txt mi-an854i.1m.1995-01_small_toy.nc mi-an854i.1m.1995-01_small_toy_newgriddefn.nc

#Then do the remapnn command as before but with the smaller toy
cdo  remapnn,new_grid.txt mi-an854i.1m.1995-01_small_toy_newgriddefn.nc mi-an854i.1m.1995-01_small_toy_newgriddefn_remapnn.nc

This version, on the smaller toy file works..

cdo remapnn: Nearest neighbor weights from curvilinear (1001x601) to curvilinear (1021x621) grid, with source mask (511922)
cdo remapnn: Processed 601601 values from 1 variable over 1 timestep ( 3.33s )

So I'm guessing there's something wrong with my global new_grid.txt file (included in the above link). I noticed on the forum that non-ascii characters can be a problem but I don't think my new_grid.txt has any.

Qn: 1. Any idea what is wrong with my new_grid.txt file from my global file?

Additional Questions:
2. Am I using these cdo commands (remapnn) correctly?
3. Is it possible to use a conservative method (e.g. remapycon) and keep the landmask intact?

CDO version info..

13:35:29 [chris:~] $ cdo --version
Climate Data Operators version 1.7.0 (http://mpimet.mpg.de/cdo)
Compiler: gcc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fPIC -fopenmp 
 version: gcc (Ubuntu 5.3.1-9ubuntu2) 5.3.1 20160220
Features: DATA PTHREADS OpenMP4 HDF5 NC4/HDF5/threadsafe OPeNDAP SZ Z UDUNITS2 PROJ.4 MAGICS CURL FFTW3 SSE2
Libraries: HDF5/1.8.16 proj/4.92 curl/7.47.0
Filetypes: srv ext ieg grb grb2 nc nc2 nc4 nc4c 
     CDI library version : 1.7.0
GRIB_API library version : 1.14.4
  netCDF library version : 4.4.0 of Mar 29 2016 11:41:40 $
    HDF5 library version : 1.8.16
 SERVICE library version : 1.4.0
   EXTRA library version : 1.4.0
     IEG library version : 1.4.0
    FILE library version : 1.8.2

I've read through the forums and this (http://www.climate-cryosphere.org/wiki/index.php?title=Regridding_with_CDO) but couldn't find anything relevant.


Replies (4)

RE: Issues with Griddes on a global netCDF file using regridding tools (e.g. remapnn/remapycon). - Added by Chris Bull almost 6 years ago

Any ideas anyone?

A pointer in the right direction as to what could be happening in the global case (when the subset works) would be super helpful :)

Chris.

RE: Issues with Griddes on a global netCDF file using regridding tools (e.g. remapnn/remapycon). - Added by Uwe Schulzweida almost 6 years ago

Your grid description file new_grid.txt contains the variable name area. This variable is not supported anymore. You have to remove the area section from the file, then it works.
The conservative remapping with remapycon doesn't not work with these grids. Conservative remapping has the following restrictions:
  • each grid cell needs to be unique
  • the vertices of each cell have to be arranged in counter clockwise order

Your grids have areas in the south pole region with the value of zero for a lot of cells. That means all of these cells have the same coordinates. This confuses the search algorithm and give a wrong result.
The data for the south pole region has missing values but this is not take to account in the search algorithm.
I will try to improve the search method for this kind of grids.

RE: Issues with Griddes on a global netCDF file using regridding tools (e.g. remapnn/remapycon). - Added by Chris Bull almost 6 years ago

Ah brilliant, thanks Uwe that fixes things nicely.

Uwe Schulzweida wrote:

The conservative remapping with remapycon doesn't not work with these grids.

Is there an intension to add this functionality in the future?

Uwe Schulzweida wrote:

I will try to improve the search method for this kind of grids.

Okay, cool. Is there a mailing list for CDO or some other way of getting version/bug updates? I've clicked around and noticed on 'my account' page that I can get updates to projects I'm a part of but it's clear how to track CDO specifically...?

    (1-4/4)