gmt
gmt copied to clipboard
grdcontour having trouble with tiny mignitudes
See the original PyGMT issue for background.
I have isolated a small 5x4 grid cut from the offending grid above that fails to let us contour the zero-contour. This hangs:
gmt grdcontour t.grd -V -C10 -JX15c > t.ps
The values are very small on either side of zero. Here is a graphical view of the values:
If I scale t.grd by 1000 and try to contour that it works. Since grdcontour works by never allowing any node to be exactly zero (we add a tiny amount), the issue of tiny in relation to these small values is the troubles, so I know where to look. Posting t.grd here for reference.
GMT's grdcontour is a memory and CPU hungry algo (it makes a grid copy and swaps the zero for each contour). One day it may change to use the marching squares. Not pretending that I understand it from the wiki figures but that's what is used by GDAL, so ... one day.
Sure, we wrote grdcontour back in the day (1988?) so not much info to go by - we invented our own algo. Of course it should be rewritten by anyone who has the time to do so!
Didn't mean to reinvent. Maybe see if we can reuse lib code that's available.
I remember I posted somewhere a comparison between contouring (cumping contours) with gdal_contour versus grdcontour. I think the time difference in completing was several 10x's.