grdsample does'nt respect -fg
|Target version:||Candidate for next minor release|
I try to get subregion of ETOPO1 grid (https://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/bedrock/grid_registered/netcdf/ETOPO1_Bed_g_gmt4.grd.gz)
grdsample "ETOPO1_Bed_g_gmt4.grd" -G"bat.grd" -I0.1/0.1 -R179/196/49/61 -fg
but get error
grdsample: Error: Selected region exceeds the X-boundaries of the grid file by more than one x-increment!
grdinfo on this grid
ETOPO1_Bed_g_gmt4.grd: Title: ETOPO1_Bed_g_gmt4.grd ETOPO1_Bed_g_gmt4.grd: Command: ETOPO1_Bed_g_gmt4.grd: Remark: ETOPO1_Bed_g_gmt4.grd: Gridline node registration used [Geographic grid] ETOPO1_Bed_g_gmt4.grd: Grid file format: ni = GMT netCDF format (32-bit integer), COARDS, CF-1.5 ETOPO1_Bed_g_gmt4.grd: x_min: -180 x_max: 180 x_inc: 0.0166666666667 name: Longitude [degrees_east] n_columns: 21601 ETOPO1_Bed_g_gmt4.grd: y_min: -90 y_max: 90 y_inc: 0.0166666666667 name: Latitude [degrees_north] n_rows: 10801 ETOPO1_Bed_g_gmt4.grd: z_min: -10898 z_max: 8271 name: z ETOPO1_Bed_g_gmt4.grd: scale_factor: 1 add_offset: 0 ETOPO1_Bed_g_gmt4.grd: format: classic
grdsample from GMT4 works perfect with this grid.
I get same result with GEBCO grids.
#2 Updated by Michael almost 2 years ago
That the program cuts the a chunk from the west side, adds it to east, resample and saves a grid with -R179/196/49/61? And you say that GMT4 does that?
Exactly. This is a geographic grid with periodic boundary conditions. GMT4 takes this into account, GMT5 is not.
#3 Updated by Paul almost 2 years ago
- Status changed from New to In Progress
I can confirm that the initial subset fails (grdcut has no problems). I will look into why. A workaround is to cut the subset with grdcut then do grdsample on that. I am sure you are aware that downsampling to 6m from a 1m grid will lead to aliasing. The way to do avoid that is to use grdfilter to obtain 6 m averages instead.