Bug #692

grdcut: problem with NaNs

Added by Peter over 6 years ago. Updated over 6 years ago.

Status:ClosedStart date:2015-03-26
Priority:NormalDue date:
Assignee:Paul% Done:


Target version:Candidate for next bugfix release
Affected version:5.1.1 Platform:Windows


Dear All,

I just found a strange problem with grdcut.
I have some gridded data with the grid region being larger than the area covered by the data, thus having rows and columns with NaNs at all edges of the grid.
Now I wanted to cut the grid to the data using

grdcut data.grd -Gcut.grd -Zn

It worked well for the upper, right, and lower bound, but the left (xmin) was not touched by grdcut.
A check with

grd2xyz cut.grd -s > cut.xyz
gmtinfo cut.xyz

showed, however, that the leftmost data nodes have x coordinates much higher than the untouched xmin. So I have still columns with NaNs at the left edge of my grid.


cis.nc (450 KB) Peter, 2015-03-26 23:56


#1 Updated by Paul over 6 years ago

  • Status changed from New to Feedback

Wonder if you could supply your data grid or a grid that demonstrate the problem? My initial test worked as expected:

gmt grdmath -R0/5/0/5 -I1 X Y MUL = t.nc
gmt grd2xyz t.nc | gmt xyz2grd -R-2/7/-2/7 -I1 -Gnew.nc -V
gmt grdinfo new.nc -M
gmt grdcut new.nc -Zn -Gcut.nc -V

So I will need to reproduce your problem to make progress.

#2 Updated by Peter over 6 years ago

Hello Paul,

I just tried with your test, but I got the same problem as before:

grdcut: Processing input grid
grdcut: File spec: W E S N dx dy nx ny:
grdcut: Old:grdcut: -2 7 -2 7 1 1 10 10
grdcut: New:grdcut: -2 5 0 5 1 1 8 6

So the problem seems to be my system, not GMT.
However, I append one of my grids (in fact, I have 33 of them).


#3 Updated by Paul over 6 years ago

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

Sorry, let this one slip. The bug is in 5.1.1 but not present after that. We expect to release 5.1.2 very soon (days).

#4 Updated by Paul over 6 years ago

  • Status changed from Resolved to Closed

Closing now that 5.1.2 is out.

Also available in: Atom PDF