ERRORs when interpolate from a lat-lon grid to a WRF grid
Added by Jia Wang about 1 month ago
I want to interpolate precipitation from a regular lat-lon grid to a WRF grid, using the command
cdo -remapcon,WRF.nc PCP.nc out.nc
And I got the following error message:
cdi warning (cdf_set_var): Inconsistent variable definition for XLAT!
cdi warning (cdf_set_var): Inconsistent variable definition for XLONG!
cdi warning (cdf_check_variables): Unsupported data type (char/string), skipped variable Times!
cdi warning (cdfInqContents): Coordinates variable XTIME can't be assigned!
cdo remapcon (Abort): Target grid cell corner coordinates missing!
How to solve this?
Replies (3)
RE: ERRORs when interpolate from a lat-lon grid to a WRF grid - Added by Karin Meier-Fleischer about 1 month ago
What about
cdo -remapbil,WRF.nc PCP.nc out.nc
RE: ERRORs when interpolate from a lat-lon grid to a WRF grid - Added by Jia Wang about 1 month ago
This bilinear interpolation can work. But since the interpolated variable is precipitation, I want to use the conservative method.
I found the corner information for WRF in its met file (attached). But I do not know how to add this information into the griddes.
RE: ERRORs when interpolate from a lat-lon grid to a WRF grid - Added by Estanislao Gavilan about 1 month ago
Hi Jia Wang,
it is not straight forward to create the WRF grid file for remapping. I think you need to do it manually.
https://forum.mmm.ucar.edu/threads/finding-corners-of-grid-cells.9514/
Now, the first thing that you need to know: is your WRF grid regular (lat/lon) or curvilinear?. If your WRF grid is regular you need two corners, but if it is curvilinear you need the four corners (see 1.5.2.4. CDO grids in documentation). Here you can find an example.
https://emiprep.readthedocs.io/en/develop/architecture/regrid.html
This example uses a text file as grid descriptor. But, you could also create a netcdf file with the lat, lon and their corners. If you decide to create your grid file in nc, there is another thing that you will need to correct
cdi warning (cdf_set_var): Inconsistent variable definition for XLAT!
cdi warning (cdf_set_var): Inconsistent variable definition for XLONG!
cdo does not support coordinates that change with time. Therefore, you need to remove the time axis in your coordinates.
Best regards,
Estanislao