Bug #917

grdblend passing incorrect WESN to grdsample

Added by Nick 9 months ago. Updated 9 months ago.

Status:ClosedStart date:2016-06-15
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.x-svn Platform:

Description

Grdblend appears to pass the region bounds through to grdsample incorrectly if it needs to resample (appears to be using W twice). Output excerpts below:

grdblend(core) 5.3.0_r16448 [64-bit]
...
grdblend: File file.grd grid region needed longitude adjustment to fit final grid region
grdblend: File file.grd inner grid region needed longitude adjustment to fit final grid region
grdblend: File file.grd has different increments (0.5/0.5) than the output grid (0.166667/0.166667) - must resample
grdblend: File file.grd is sampled using region -R-180/-180/-77.5/77.5
grdblend: Resample file.grd via grdsample file.grd -I0.166667/0.166667 -R-180/-180/-77.5/77.5 -G/tmp/grdblend_resampled_30319_0.nc -V -fg
grdblend (gmtlib_free_tmp_arrays): tried to free unallocated memory
grdsample: History: Process -R-180/-180/-77.5/77.5.
grdsample: Syntax error -R option. Correct syntax:
-R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>]
Append r if giving lower left and upper right coordinates
-Rg or -Rd for global domain
-R<grdfile> to take the domain from a grid file
grdblend: Error: Unable to resample file file.grd - exiting

$ grdinfo file.grd
file.grd: Title: file.grd
file.grd: Command: xyz2grd -R-180./180.0/-77.5/77.50 -I30m -fg /dev/shm/tmp.HnQpdAKL4u -Gfile.grd -H -N0
file.grd: Remark:
file.grd: Gridline node registration used
file.grd: Grid file format: nf (# 18) GMT netCDF format (float) (COARDS-compliant) [DEFAULT]
file.grd: x_min: -180 x_max: 180 x_inc: 0.5 name: longitude [degrees_east] nx: 721
file.grd: y_min: -77.5 y_max: 77.5 y_inc: 0.5 name: latitude [degrees_north] ny: 311
file.grd: z_min: 0 z_max: 14.0699996948 name: z
file.grd: scale_factor: 1 add_offset: 0

Associated revisions

Revision 16559
Added by Paul 9 months ago

Addres issue #917

History

#1 Updated by Paul 9 months ago

  • Status changed from New to In Progress
  • Assignee set to Paul

Could you please share your grdblend command line and, if passing a blend file with a list of grids, also supply that file. Also, please attach grdinfo output of all input grids.

#2 Updated by Nick 9 months ago

[root@tidore blendtest]# grdinfo file30m.grd
file30m.grd: Title: file30m.grd
file30m.grd: Command: xyz2grd -R-180./180.0/-77.5/77.50 -I30m -fg /dev/shm/tmp.HaXukx5gyz -Gfile30m.grd -H -N0
file30m.grd: Remark: 
file30m.grd: Gridline node registration used
file30m.grd: Grid file format: nf (# 18) GMT netCDF format (float)  (COARDS-compliant) [DEFAULT] 
file30m.grd: x_min: -180 x_max: 180 x_inc: 0.5 name: longitude [degrees_east] nx: 721
file30m.grd: y_min: -77.5 y_max: 77.5 y_inc: 0.5 name: latitude [degrees_north] ny: 311
file30m.grd: z_min: 0 z_max: 12.0200004578 name: z
file30m.grd: scale_factor: 1 add_offset: 0
[root@tidore blendtest]# grdinfo 10mfile.grd
10mfile.grd: Title: 10mfile.grd
10mfile.grd: Command: xyz2grd -R-15.0/45.00/30.00/66.00 -I10m -fg /dev/shm/tmp.uTR98ya7YM -G10mfile.grd -H -N0
10mfile.grd: Remark: 
10mfile.grd: Gridline node registration used
10mfile.grd: Grid file format: nf (# 18) GMT netCDF format (float)  (COARDS-compliant) [DEFAULT] 
10mfile.grd: x_min: -15 x_max: 45 x_inc: 0.166666666667 name: longitude [degrees_east] nx: 361
10mfile.grd: y_min: 30 y_max: 66 y_inc: 0.166666666667 name: latitude [degrees_north] ny: 217
10mfile.grd: z_min: 0 z_max: 3.18000006676 name: z
10mfile.grd: scale_factor: 1 add_offset: 0
[root@tidore blendtest]# /usr/local/gmt5/bin/grdblend file30m.grd 10mfile.grd -Gout.grd -Rfile30m.grd -I10m -Co -V4 -N0 -fg
grdblend: Object ID 0 : Registered Text Table File file30m.grd as an Input resource with geometry Surface [n_objects = 1]
grdblend: api_begin_io: Input resource access is now enabled [container]
grdblend: api_import_grid: Passed ID = 0 and mode = 1
grdblend: Geographic grid, longitudes span exactly 360
grdblend: GMT_End_IO: Input resource access is now disabled
grdblend: GMT_Destroy_Data: freed memory for a Text Table for object 0
grdblend: gmtapi_unregister_io: Unregistering object no 0 [n_objects = 0]
grdblend: gmtapi_unregister_io: Object no 0 has non-NULL data pointer
grdblend: Geographic grid, longitudes span exactly 360
grdblend: Chosen boundary condition for left and right edges: geographic
grdblend: Chosen boundary condition for bottom and top edges: natural
grdblend: Geographic grid, longitudes span exactly 360
grdblend: Object ID 1 : Registered Text Table Memory Reference 1442b20 as an Input resource with geometry Surface [n_objects = 1]
grdblend: Successfully created a new Text Table container
grdblend: Processing input grids
grdblend: Object ID 2 : Registered Text Table File file30m.grd as an Input resource with geometry Surface [n_objects = 2]
grdblend: api_begin_io: Input resource access is now enabled [container]
grdblend: api_import_grid: Passed ID = 2 and mode = 33
grdblend: Geographic grid, longitudes span exactly 360
grdblend: GMT_End_IO: Input resource access is now disabled
grdblend: File file30m.grd grid region needed longitude adjustment to fit final grid region
grdblend: File file30m.grd inner grid region needed longitude adjustment to fit final grid region
grdblend: File file30m.grd has different increments (0.5/0.5) than the output grid (0.166667/0.166667) - must resample
grdblend: File file30m.grd is sampled using region -R-180/-180/-77.5/77.5
grdblend: Resample file30m.grd via grdsample file30m.grd  -I0.166667/0.166667 -R-180/-180/-77.5/77.5 -G/tmp/grdblend_resampled_36018_0.nc -V -fg
grdblend (gmtlib_free_tmp_arrays): tried to free unallocated memory
grdsample: History: Process -R-180/-180/-77.5/77.5.
grdsample: Syntax error -R option.  Correct syntax:
    -R<xmin>/<xmax>/<ymin>/<ymax>[/<zmin>/<zmax>]
      Append r if giving lower left and upper right coordinates
    -Rg or -Rd for global domain
    -R<grdfile> to take the domain from a grid file
grdblend: Error: Unable to resample file file30m.grd - exiting

I also get the same result if I specify -R explicitly as -180/180/-77.5/77.5 instead of giving it the filename

#3 Updated by Paul 9 months ago

  • Status changed from In Progress to Resolved
  • Target version set to Candidate for next bugfix release
  • % Done changed from 0 to 100

In my eagerness to make sure that two grids that overlap in longitude despite having a 360 degree offset I skipped the simplest test which is for global grids: Not possible to not have an overlap in longitude if a grid is global. Fixed in r16559, give it a try and report back.

#4 Updated by Nick 9 months ago

yeah, that works fine now.

Cheers Paul

#5 Updated by Paul 9 months ago

  • Status changed from Resolved to Closed

Closed as fixed.

Also available in: Atom PDF