Feature #1136

grdcontour -Q: specify length instead of number of points

Added by Andreas 23 days ago.

Status:NewStart date:2017-07-26
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


It looks like grdcontour does a contour length calculation and compares it to a minimum value under the hood (from grdcontour.c);

#define GRDCONTOUR_MIN_LENGTH 0.01        /* Contours shorter than this are skipped */

Contours shorter than a minimum length are not plotted. Would it be reasonable to also let the user specify a minimum length, in addition to the current -Q 'number-of-points' cut off?

I find that if you have the same grid, but different resolution, the -Q 'number of points' may have a big impact.

Pragmatic constructed example:

Plotting and extraction of the -2000 contour from a grid with three different resolutions (see contour_length.pdf)

  • gebco_8m.nc - x/y increment 0.13333
    number of points: N = 121
    Length: 820 km
  • gebco_8m_sampled.nc 1 - x/y increment 0.5
    Number of points: N = 30
    Length: 738 km
  • gebco_8m_sampled.nc 2 - x/y increment 0.05
    Number of points: N = 324
    Length: 822 km

The number of points may be very different, but the length will roughly be the same (at least comparable). Wouldn't length be a nice additional way of specifying contour cut?

contour_length.sh Magnifier (2.8 KB) Andreas, 2017-07-26 23:26

contour_length.pdf (58.2 KB) Andreas, 2017-07-26 23:26

gebco_8m.nc (94.6 KB) Andreas, 2017-07-26 23:26

Also available in: Atom PDF