Bug #586

output from grdinfo is inconsistent

Added by Mark almost 3 years ago. Updated almost 3 years ago.

Status:ClosedStart date:2014-07-04
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.1.1 Platform:Mac OS X

Description

I have found an example where the output from grdinfo varies as a function of whether the command has to process one grid file or several grid files. Consider a directory with the two grid files attached below. When I run: gmt grdinfo vNorth.grd, get the correct output:
vNorth.grd: Title: vNorth.grd
vNorth.grd: Command: File written by MATLAB function grdwrite.m
vNorth.grd: Remark: Created 04-Jul-2014 17:06:34
vNorth.grd: Gridline node registration used [Cartesian grid]
vNorth.grd: Grid file format: nd = GMT netCDF format (64-bit float), COARDS, CF-1.5
vNorth.grd: x_min: -860.751285413 x_max: 882.248714587 x_inc: 7 name: x nx: 250
vNorth.grd: y_min: -2113.18316762 y_max: 2107.81683238 y_inc: 7 name: y ny: 604
vNorth.grd: z_min: -82.8403707883 z_max: 19.7480668065 name: z
vNorth.grd: scale_factor: 1 add_offset: 0
vNorth.grd: format: classic

When I run to get a listing of multiple grid files, for example: gmt grdinfo *.grd, I get:
slabgcs_wgs84FromE00Data.grd: Title: slabDepthNew.grd
slabgcs_wgs84FromE00Data.grd: Command: xyz2grd slabDepth.xyz GslabDepthNew.grd -Rslabgcs_wgs84FromE00Data.grd
slabgcs_wgs84FromE00Data.grd: Remark:
slabgcs_wgs84FromE00Data.grd: Gridline node registration used [Geographic grid]
slabgcs_wgs84FromE00Data.grd: Grid file format: nf = GMT netCDF format (32-bit float), COARDS, CF-1.5
slabgcs_wgs84FromE00Data.grd: x_min: 231.27983572 x_max: 239.504956157 x_inc: 0.0449460133157 name: longitude [degrees_east] nx: 184
slabgcs_wgs84FromE00Data.grd: y_min: 38.8656916991 y_max: 51.7202515073 y_inc: 0.0449460133157 name: latitude [degrees_north] ny: 287
slabgcs_wgs84FromE00Data.grd: z_min: -111.170402527 z_max: -4.27637386322 name: z
slabgcs_wgs84FromE00Data.grd: scale_factor: 1 add_offset: 0
slabgcs_wgs84FromE00Data.grd: format: netCDF-4 chunk_size: 184,144 shuffle: on deflation_level: 3
vNorth.grd: Title: vNorth.grd
vNorth.grd: Command: File written by MATLAB function grdwrite.m
vNorth.grd: Remark: Created 04-Jul-2014 17:06:34
vNorth.grd: Gridline node registration used [Geographic grid]
vNorth.grd: Grid file format: nd = GMT netCDF format (64-bit float), COARDS, CF-1.5
vNorth.grd: x_min: -140.751285413 x_max: 162.248714587 x_inc: 7 name: x nx: 250
grdinfo: Column selected for latitude-formatting has values that exceed +/
90; set to NaN
grdinfo: Column selected for latitude-formatting has values that exceed +/- 90; set to NaN
vNorth.grd: y_min: NaN y_max: NaN y_inc: 7 name: y ny: 604
vNorth.grd: z_min: -82.8403707883 z_max: 19.7480668065 name: z
vNorth.grd: scale_factor: 1 add_offset: 0
vNorth.grd: format: classic

The first grid file is listed correctly, but the second is not. I suspect that there is a problem with variable(s) that are not correctly initialized with each loop.
I am running Version 5.1.1 (r12968) [64-bit]

slabgcs_wgs84FromE00Data.grd - grid file, geographic (86.9 KB) Mark, 2014-07-04 11:30

vNorth.grd - grid file, cartesian (1.16 MB) Mark, 2014-07-04 11:30

Associated revisions

Revision 13314
Added by Paul almost 3 years ago

Fix issue #586

History

#1 Updated by Paul almost 3 years ago

  • Status changed from New to Resolved
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release

Upon reading your geographic grid first, the next one was expected to be geo as well. For grdinfo we should instead reset that status before each file. Fixed in r13314.

#2 Updated by Paul almost 3 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100

Closing this issue as fixed.

Also available in: Atom PDF