grdcut: problem with NaNs
|Target version:||Candidate for next bugfix release|
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
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.
#1 Updated by Paul about 2 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 about 2 years ago
- File cis.nc added
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).