Project

General

Profile

problem regridding using a destination grid

Added by Sagar Parajuli 12 months ago

I have a netcdf file LAI_2020_all_lambert.nc as attached with 411 lon and 361 lat grids, lat range from 32.4905 to 34.1118 degree, and lon range from -116.832 to -114.984 over California. It has the variable named Band1, which has 3d dimension (time, lat, lon). I need to regrid the variable Band1 into 162 lon and 171 lat grids for the same lat and lon range. I am basically trying to regrid at a coarser resolution to match my WRF model grids because I want to replace my WRF model variable (LAI) with this new data.

I successfully regridded the data using a target grid description as below but I am having a strange problem.

mygrid_d03.txt

gridtype = lonlat
gridsize = 27702
xsize = 162
ysize = 171
xname = west_east
xunits = "degrees latitude"
yname = south_north
yunits = "degrees longitude"
xfirst = -116.832
xlast = -114.984
xinc = 0.01
yfirst = 32.4905
ylast = 34.1118
yinc = 0.01

Then I regridded the data with the below command.

cdo remapbil,mygrid_d03.txt LAI_2020_all_lambert.nc LAI_2020_all_lambert_regrid.nc

Regridding works just fine but the result is not what I had expected. Somehow, the remapping is shifting the data southeast by some extent. I have attached the figure comparing the output of the original data (LAI_2020_all_lambert.nc) and the regridded data LAI_2020_all_lambert_regrid.nc. As you can see, a large portion of the southeast corner is cut out in the regridded file due to the strange shift. Could anyone please help me figure this out?


Replies (5)

RE: problem regridding using a destination grid - Added by Estanislao Gavilan 12 months ago

Hi Sagar,

I reply you here. Actually your grid is not shifted. If you have a closer look to your grid, you can see that the first and last row and column are missing. That is happening because you were setting
export REMAP_EXTRAPOLATE='off'

If you set it back to on, you will see that you have your data. Also, if you are setting the xlast and ylast, you do not need to specify the yinc and xinc in the grid.txt. cdo calculates the spacing grid using the other grid information.

Kind regards,

Estanislao

PS: Please, next time try to keep everything in the same post. Otherwise, it becomes messy to follow questions.

RE: problem regridding using a destination grid - Added by Sagar Parajuli 12 months ago

Thank you Estanislao for your prompt response. I tried your suggestions. Setting the REMAP_EXTRAPOLATE = 'on' didn't actually solve the problem. It only created a distorted filled area near the upper boundary (first figure). However, interestingly, when I deleted xinc and yinc parameters as you suggested, the problem magically got solved. After that I got exactly what I expected (second figure). Thank you very much for your help, greatly appreciated.

RE: problem regridding using a destination grid - Added by Sagar Parajuli 12 months ago

Dear Estanislao, when I look at the regridded data closely, there still appears to be distortion in the regridded data, there is still some southwest shift in the data by regridding (please see the comparison of original data and regridded data in the attached figure). The below destination grid is actually in 'lambert' projection. May be the problem is because I used 'lonlat' gridtype. I am now trying to specify 'curvilinear' gridtype but I get error:
cdo remapbil,mygrid_d03 LAI_2020_all_lambert.nc LAI_2020_all_regrid.nc

cdo remapbil (Abort): Target grid cell center coordinates missing!

Could you please let me know what else should be specified in the below grid info to solve this problem? I attached the model file (geo_em.d03_30s.nc) to which I want to regrid my data LAI_2020_all.nc so that I can replace the data I desired.

content of mygrid_d03:

gridtype = curvilinear
gridsize = 27702
xsize = 162
ysize = 171
xname = west_east
xunits = "degrees latitude"
yname = south_north
yunits = "degrees longitude"
xfirst = -116.831604
xlast = -114.98407
yfirst = 32.563885
ylast = 34.03593

RE: problem regridding using a destination grid - Added by Sagar Parajuli 12 months ago

Hi Estanislao, I finally solved my problem. I specified the full list of lat and long as xvals and yvals and it solved the problem.

Thank you,

RE: problem regridding using a destination grid - Added by Estanislao Gavilan 12 months ago

Hi Sagar,

happy to hear. Curvilinear grids need the destination grid coordinates and sizes because their size and position change in x and y.

Kind regards,

Estanislao

    (1-5/5)