Bug #1139

grdlandmask creates invalid grids

Added by Viktor 3 months ago. Updated about 1 month ago.

Status:ClosedStart date:2017-07-31
Priority:NormalDue date:
Assignee:Paul% Done:


Target version:-
Affected version:5.x-svn Platform:Linux


So far I have found 2 cases.

1 is easy to reproduce (ocean = 0, region entirely in ocean):
grdlandmask -Df -I1k/1k -Gnoland.grd -R178/179/-44/-43 -N0/1/1/1/1/1

2 i'm not sure why this produces the same result, it's mostly on land:
grdlandmask -Df -I1k/1k -Gonland.grd -R175.48974146199942/176.90855324281694/-38.87590617470688/-37.75431698422648 -N0/1/1/1/1/1

I'm pretty sure these do not work (can't be plotted as 1 or 0 using grdimage)
However, I tested them as follows (which is dependant on h5py and hdf libraries working):
(in python):
import h5py as h
f = h.File('noland.grd', 'r')

ends up with:
IOError: Unable to open file (File signature not found)
I have uploaded the results of the above commands with gmt 5.4.1

noland.grd - gmt output (38.1 KB) Viktor, 2017-07-31 14:41

onland.grd - gmt output (64.3 KB) Viktor, 2017-07-31 14:42


#1 Updated by Viktor 3 months ago

Upon further investigation. The issue seems to happen when the grid contains less than (or equal to?) 2^14 or 16384 points.
Actually closest test to 16384 was 16402 = PASS, 16284 = FAIL.

#2 Updated by Paul 2 months ago

  • Status changed from New to Feedback

Could you explain what you mean by "'m pretty sure these do not work (can't be plotted as 1 or 0 using grdimage)"?. Both of the grids are fine; the first has all zeros while the second has a mix of 0 and 1. Both grids plot in GMT as well as open in Panoply. Same as your grids. Perhaps the Python function cannot open NetCDF COARDS grids?

#3 Updated by Viktor 2 months ago

I'm sorry. I must have only quickly tried to plot these with GMT.
notabug, I tried again and it works within GMT.
Must be the other software I am using to access these grids.

#4 Updated by Paul about 1 month ago

  • Status changed from Feedback to Closed
  • Assignee set to Paul
  • % Done changed from 0 to 100

Closing as not a GMT bug.

Also available in: Atom PDF