Regridding using CDO
Added by Angelo Teixeira Lemos 4 months ago
Dear colleagues,
I am using the following cdo command to obtain the information of a grid file (from AQUA/Modis):
cdo griddes file_AQUA.nc
- gridID 1
#
gridtype = lonlat
gridsize = 37324800
xsize = 8640
ysize = 4320
xname = lon
xlongname = "Longitude"
xunits = "degrees_east"
yname = lat
ylongname = "Latitude"
yunits = "degrees_north"
xfirst = -179.9792
xinc = 0.04166667
yfirst = 89.97916
yinc = -0.04166667 # - gridID 2
#
gridtype = generic
gridsize = 768
xsize = 256
ysize = 3
cdo griddes: Processed 3 variables [0.00s 11MB]
My next step was to generate a text file with the grid information of the AQUA/Modis file through the command:
cdo griddes file_AQUA.nc > grid_file_AQUA.txt
I would like to use this text grid file information to regridding a NetCDF file (from ORAS5).
I am using this command:
cdo -O remapbil,grid_file_AQUA.txt file_ORAS.nc new_file_ORAS.nc
The file was created, but the temperature variable is incorrect when I tryied to extract it.
(Expected COUNT to be positive)
Anyone can help?
Replies (2)
RE: Regridding using CDO - Added by Estanislao Gavilan 4 months ago
Hi Angelo,
I think the the problem is your yinc is negative and it should be positive. It could be a consequence of your yfirst. Try to change the signs to see if it works. Also, I can observe that you have 2 grids..(gridID 1 and 2). That is going to give you trouble. Your grid file should only have information about the destination grid, so you must delete the repeated information.
Kind regards,
Estanislao
RE: Regridding using CDO - Added by jeannette miller about 2 hours ago
You used cdo griddes to generate a text file (grid_file_AQUA.txt) containing the grid information of your AQUA/Modis file (file_AQUA.nc).
You attempted to regrid a NetCDF file (file_ORAS.nc from ORAS5) using the bilinear interpolation method (remapbil) and the grid information stored in grid_file_AQUA.txt.
The error message "Expected COUNT to be positive" suggests that there might be an issue with how CDO is interpreting or handling the variable data during regridding. This could be due to several reasons.
Ensure that the temperature variable in file_ORAS.nc is in the expected range and format for regridding
Verify that the grid information (grid_file_AQUA.txt) matches the dimensions and resolution required for file_ORAS.nc.
Bilinear interpolation (remapbil) is generally suitable for regridding, but depending on your data and requirements, you might need to consider other methods like conservative remapping (remapcon) or nearest neighbor (remapnn) if the data characteristics demand it.
Try to Review the metadata of both input (file_ORAS.nc) and output (new_file_ORAS.nc) NetCDF files to ensure that the temperature variable is correctly represented and interpolated.
Experiment with different interpolation methods (remapbil, remapcon, remapnn) to see if the issue persists with one method over another.