wget ftp://topex.ucsd.edu/pub/srtm30_plus/topo30/topo30.grd wget ftp://topex.ucsd.edu/pub/srtm30_plus/topo30/COPYRIGHT.txt cat COPYRIGHT.txt ls -l !grdinfo topo30.grd import gdal src = gdal.Open('topo30.grd') topo30 = src.GetRasterBand(1).ReadAsArray() less0 = (topo30 < 0).sum(); print less0, 'cells' topo30.size print '%0.2f%% of the grid is below 0' % (100. * float(less0) / topo30.size) '%.1f %% of the grid below 0 is below 20 fathoms' % (100. * float((topo30 < -36.576).sum()) / less0) '%.1f %% of the grid below 0 is below 100 fathoms' % (100. * float((topo30 < -182.88).sum()) / less0) data = numpy.hstack(topo30) data.shape pylab.hist(data, bins=100, histtype='stepfilled') # Now give the cumulative distribution function (CDF) n, bins, patches = pylab.hist(data, 200, histtype='step', cumulative=True)