Bug #1139

grdlandmask creates invalid grids

Added by Viktor 18 days ago. Updated 8 days ago.

Status:FeedbackStart date:2017-07-31
Priority:NormalDue date:
Assignee:-% 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 9 days 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 8 days 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 8 days 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.

Also available in: Atom PDF