Project

General

Profile

Error when interpolate MPAS grid (unstructured) to LatLon grid

Added by Jia Wang about 1 month ago

I want to interpolate model forecasts from MPAS grid to LatLon grid, using the following command:

cdo -P 1 -f nc5 -remapbil,r360x181 -setgrid,mpas:x1.10242.grid.nc -selgrid,1 history.2019-09-03_18.00.00.nc a.nc

x1.10242.grid.nc contains MPAS grid information
history.2019-09-03_18.00.00.nc: MPAS forecast that I want to interpolate

I got the error
cdo(1) setgrid: Process started
cdo(2) selgrid: Process started
cdi warning (cdf_check_variables): Unsupported data type (char/string), skipped variable initial_time!
cdi warning (cdf_check_variables): Unsupported data type (char/string), skipped variable xtime!
cdi warning (cdf_check_variables): Unsupported data type (char/string), skipped variable mminlu!
cdi warning (cdf_check_variables): Unsupported data type (char/string), skipped variable densityFunctionCode!
cdo(1) setgrid (Warning): No horizontal grid with 10242 cells found!

cdo remapbil (Abort): Unsupported generic coordinates (Variable: qv)!

x1.10242.grid.nc (13.4 MB) x1.10242.grid.nc MPAS grid file
history.2019-09-03_18.00.00.nc (85.9 MB) history.2019-09-03_18.00.00.nc MPAS forecast that I want to interpolate

Replies (9)

RE: Error when interpolate MPAS grid (unstructured) to LatLon grid - Added by Karin Meier-Fleischer about 1 month ago

You can not use remapbil for unstructured grids. Further you select the wrong grid, if you want to use the mpas gridfile x1.10242.grid.nc you have to use -selgrid,2.

cdo -f nc5 -remapcon,r360x181 -setgrid,mpas:x1.10242.grid.nc -selgrid,2 history.2019-09-03_18.00.00.nc a.nc

RE: Error when interpolate MPAS grid (unstructured) to LatLon grid - Added by Jia Wang about 1 month ago

Thanks. It works.

In future, if I want to use a grid other than grid #1 in "x1.10242.grid.nc". How do I rewrite the command?

RE: Error when interpolate MPAS grid (unstructured) to LatLon grid - Added by Karin Meier-Fleischer about 1 month ago

If the grid file contains multiple grid definitions and you want to use the second grid definition for instance, use

-setgrid,x1.10242.grid.nc:2

Have a look at https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsubsection.0.2.6.6:

If the dataset contains more than one grid, the first one is used. Appending :N to the name of the dataset selects the N-th grid

RE: Error when interpolate MPAS grid (unstructured) to LatLon grid - Added by Jia Wang about 1 month ago

Thanks Karin.

I encountered a new issue. The files that I have uploaded are on MPAS uniform mesh. The interpolation is fine now.

But when I tried to interpolate MPAS on a variable mesh (the resolutions change across the globe, 60 to 15 km) to a regular lat lon grid, suddenly I have the error:

cdo -f nc5 -remapcon,r360x181 -setgrid,mpas:x4.535554.grid.nc a.nc b.nc
cdo remapcon (Abort): Source grid cell corner coordinates missing!

I checked both grid information files, the one on the uniform mesh and the one on the variable mesh. The information is basically the same. I do not know why the source grid cell corner coordinates can not be found on the variable mesh.

Because the grid file (x4.535554.grid.nc) is large, I have uploaded it to Google Drive https://drive.google.com/file/d/1n70yNHDz7Bre5jo-dV9DXFYdMJeEee7g/view?usp=sharing .
The data file (a.nc) is attached.

a.nc (2.05 MB) a.nc MPAS data file on the variable mesh

RE: Error when interpolate MPAS grid (unstructured) to LatLon grid - Added by Karin Meier-Fleischer about 1 month ago

The remapcon operator needs the cell boundaries. You could use remapnn instead

cdo -f nc5 -remapnn,r360x181 -setgrid,mpas:x4.535554.grid.nc a.nc b.nc

RE: Error when interpolate MPAS grid (unstructured) to LatLon grid - Added by Jia Wang about 1 month ago

Hi Karin,

For the precipitation variable, I prefer to use the conservative mapping.

In the "x4.535554.grid.nc", it has information about the cell, vertices, and edges, verticesOnCell, and edgesOnCell. (MPAS's grid is mostly hexagon)

I suppose the edges are boundaries for each cell. Maybe it is because of the naming of variables, CDO does not recognize the needed information is already there?

RE: Error when interpolate MPAS grid (unstructured) to LatLon grid - Added by Uwe Schulzweida about 1 month ago

Hi Jia,

There are some pentagons on the grid that are not processed correctly in CDO. This issue will be resolved in the next version of CDO!

Cheers,
Uwe

RE: Error when interpolate MPAS grid (unstructured) to LatLon grid - Added by Jia Wang about 1 month ago

Hi Uwe,

I checked the two MPAS meshes that I used: a uniform mesh (x1.10242.grid.nc) and a variable mesh (x4.535554.grid.nc).

The uniform mesh has cells with 5 to 6 edges:
cdo infon x1.10242.grid.nc | grep nEdgesOnCell
cdi warning (cdf_check_variables): Unsupported data type (char/string), skipped variable densityFunctionCode!
19 : 0000-00-00 00:00:00 0 10242 0 : 5.0000 5.9988 6.0000 : nEdgesOnCell

The variable mesh has cells with 5 to 7 edges:
cdo infon x4.535554.grid.nc | grep nEdgesOnCell
cdi warning (cdf_check_variables): Unsupported data type (char/string), skipped variable densityFunctionCode!
19 : 0000-00-00 00:00:00 0 535554 0 : 5.0000 6.0000 7.0000 : nEdgesOnCell

It is puzzling to me that conservatively regrid (remapcon) MPAS from a uniform mesh is working, but conservatively regrid MPAS from a variable mesh is not working.

Is there a timeline for the next version of CDO?

RE: Error when interpolate MPAS grid (unstructured) to LatLon grid - Added by Uwe Schulzweida about 1 month ago

Yes, it looks as though this has only been implemented for the uniform mesh with 5 to 6 edges.
A new CDO release will take a while. I’ve attached version 2.6.4 with the new patch for the MPAS mesh.

    (1-9/9)