Bug #1215

gmt select -G option ignores -fg flag

Added by Mark 7 months ago. Updated 6 months ago.

Status:ClosedStart date:2018-03-11
Priority:NormalDue date:
Assignee:Paul% Done:

100%

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

Description

GMT 6.0.0_r19728 on Ubuntu 16.04

Using gmt select to select data that falls where the grid has a value greater than 0. Returns different numbers of points depending on whether the input grid is either -Rd or -Rg despite setting the -fg flag:

wc -l hf.dat

gmt grdsample -Rg -fg -V seds.grd -Gseds1.grd
gmt grdsample -Rd -fg -V seds.grd -Gseds2.grd

cat hf.dat | gmt select -V -fg -Gseds1.grd | wc -l
cat hf.dat | gmt select -V -fg -Gseds2.grd | wc -l

Returns:

23395 hf.dat
grdsample [WARNING]: Output grid extrema [-3.41061e-13/1] exceeds extrema of input grid [0/1]; to clip output use -n...+c
grdsample [WARNING]: Output grid extrema [-2.84217e-13/1] exceeds extrema of input grid [0/1]; to clip output use -n...+c
10663
23382

seds.grd - Starting grid (333 KB) Mark, 2018-03-11 21:21

hf.dat - Points (464 KB) Mark, 2018-03-11 21:21

Associated revisions

Revision 19942
Added by Paul 7 months ago

Fix issue #1215

History

#1 Updated by Joaquim 7 months ago

  • Status changed from New to In Progress

I don't think this is a bug. -fg tells it that data is geographic but both -Rg and -Rd are geographic. On the other hand this should work (but it doesn't)

gmt gmtconvert hf.dat --FORMAT_GEO_OUT=+D | gmt select -V -fg -Gseds1.grd | wc -l

for me the bug is here (FORMAT_GEO_OUT being ignored)

gmt gmtconvert hf.dat  --FORMAT_GEO_OUT=+D | gmt gmtinfo
<Standard Input>: N = 23395 ←179.967/180> ←77.83/89.615> <1/489000>

#2 Updated by Paul 7 months ago

The FORMAT_GEO_OUT seems to work find for me, but not with

gmt gmtconvert hf.dat  --FORMAT_GEO_OUT=+D

since gmtconvert does not know the data are geographic. We are not checking if some default to implicitly mean it is geographic. Here you need -fg. With that the output is 0-360 if +D, -350/0 if -D and -180/180 if plain D [Default] The issue lies in gmt select where longitudes in the -360-0 range are seen as being outside the grid's 0-360 range, despite being a geographic grid. It is Friday, TGIF and beer is coming up; will see what can be done.

#3 Updated by Paul 7 months ago

  • Status changed from In Progress to Resolved
  • Assignee set to Paul
  • % Done changed from 0 to 100

Fixed in r19942 (trunk and 5.4 branch). The guards watching that a longitude outside the range needs to be reconsider after adding/subtracting 360 were sleeping.

#4 Updated by Paul 6 months ago

  • Status changed from Resolved to Closed

Time to close this.

Also available in: Atom PDF