remapping an unstructured grid
Added by Rolf Zentek about 10 years ago
I have a problem with unstructured grids and remapping.
After trying the example from the CDO User´s Guide (June 14; D.2. Example description for an unstructured grid), which didn´t work for me, I tried to find the problem.
(by the way, I think there the Example from the User´s guide has an error - the file has 30 cells and the picture has around 42)
This is what I have done so far.
FILES:
------
world.nc is the variable "fraction land" from ERA-Interim
plot_unstructured.R is an R-script to plot unstructured-grid data
GRID_rotlatlon_world_10degree.txt is a grid from -170 to 170 lon and -80 to 80 lat
GRID_rotlatlon_small_world_10degree.txt is a grid from -150 to 150 lon and -60 to 60 lat
GRID_unstructured_world_10degree_ONEvertex.txt is a grid from -170 to 170 lon and -80 to 80 lat
GRID_unstructured_world_10degree_FOURvertex.txt is a grid from -170 to 170 lon and -80 to 80 lat
CDO-USAGE:
----------
step A: remapped world.nc to a coarse 10degree grid:
(1) cdo -remapbil,GRID_rotlatlon_world_10degree.txt world.nc world_10degree.nc
step B: remap world_10degree.nc to an unstructured grid using nearest neighbor
(2) cdo -remapnn,GRID_unstructured_world_10degree_ONEvertex.txt world_10degree.nc world_10degree_nn.nc
step C: remap world_10degree_nn.nc back to the (rotated) latlon grid
(3) cdo -remapnn,GRID_rotlatlon_world_10degree.txt world_10degree_nn.nc world_10degree_nn_nn.nc
RESULTS:
--------
For command (1) and earlier (not documented) steps, I only used CDO 1.5.3
For the other steps I used different versions:
command (2):
CDO 1.6.4 prints error [cdo remapnn (Abort): unstructured grid without latitude coordinates!]
CDO 1.5.3 , 1.6.1 and 1.6.7 all seem to produce a correct netcdf-file (based on viewing the data with the R-script plot_unstructured.R)
command (3):
CDO 1.5.3 and 1.6.1 produce wierd data (see pictures)
CDO 1.6.7 produces a field that is constant=1
an overall picture is given by the uploaded file "remapping.png"
ANALYSIS:
---------
'cdo griddes' & 'cdo sinfo' give me the following informations on the world_10degree_nn.nc file
CDO 1.5.3 and CDO 1.6.1 show "nvertex = 0"
CDO 1.6.4 and CDO 1.6.7 show no information about nvertex
The results seem to be indepented of the usage of the unstructured grid file (1 vertex or 4 vertex)
The problems seem to be indepented of the usage of remapnn and remapdis
Remapping in the last step to a smaller domain (GRID_rotlatlon_small_world_10degree.txt) shows very differnt results for CDO 1.5.3 and 1.6.1
that don´t look like subsection
Should the unstructured grids work? or did I made error, when creating them?
I would be grateful if someone can send me an unstructured grid (or data on an unstructured grid) that work with cdo remap...
remapping.png (134 KB) remapping.png | picture of my problem | ||
world.nc (516 KB) world.nc | dataset | ||
plot_unstructured.R (330 Bytes) plot_unstructured.R | script to plot unstructured data | ||
GRID_rotlatlon_world_10degree.txt (302 Bytes) GRID_rotlatlon_world_10degree.txt | grid description | ||
GRID_rotlatlon_small_world_10degree.txt (302 Bytes) GRID_rotlatlon_small_world_10degree.txt | grid description | ||
GRID_unstructured_world_10degree_ONEvertex.txt (7.87 KB) GRID_unstructured_world_10degree_ONEvertex.txt | grid description | ||
GRID_unstructured_world_10degree_FOURvertex.txt (24.5 KB) GRID_unstructured_world_10degree_FOURvertex.txt | grid description |
Replies (4)
RE: remapping an unstructured grid - Added by Rolf Zentek about 10 years ago
Update1:
I tried also the following with CDO 1.6.7:
cdo setgridtype,unstructured world.nc unstructured.nc
cdo remapnn,world.nc unstructured.nc unstructured_remap.nc
this also results in a constant field (all values equal one).
RE: remapping an unstructured grid - Added by Rolf Zentek about 10 years ago
Update2:
I think I nailed down the problem...
I did the following with CDO 1.6.7:
- THIS WORKS -
cdo -remapnn,world.nc -setrtoc,0,0.5,-1 -remapnn,GRID_unstructured_world_10degree_ONEvertex.txt world.nc output.nc
- THIS DOESN`T WORK -
cdo -setrtoc,0,0.5,-1 -remapnn,GRID_unstructured_world_10degree_ONEvertex.txt world.nc temp.nc
cdo -remapnn,world.nc temp.nc output.nc
----------------------
Splitting the commands causes the output.nc file to be constant (like described in my earlier posts).
When piping/chaining the commands a correct output.nc file is produced...
so I suppose there is an error when either reading oder writing an unstructured grid?
RE: remapping an unstructured grid - Added by Rolf Zentek about 10 years ago
Update3:
I don´t know if this is relevant:
remapnn from unstructured to gaussian causes a constant field with cdo 1.6.7 (as described above).
It seems to take the values from the pixel in the lower left corner ( lon=-170 , lat=-80 ) for the whole field.
RE: remapping an unstructured grid - Added by Rolf Zentek about 10 years ago
Case Closed:
The reason for the error seems to be that the enviroment variable was set:
IGNORE_ATT_COORDINATES=1
unsetting it or setting it to zero with the command
export IGNORE_ATT_COORDINATES=0
solved the problem...