Skip to content

grdcontour - issue warning if no contours are drawn and finalize plot and some other minor issues #597

Closed

Description

@anbj
  1. Giving a grdcontour [..] -L<low/high> which yields no contours should issue a warning as well as finalizing the plot (even if no contours were drawn).
~/temp 08:46:34 $ grdimage -JS0/90/10c -RNO @earth_relief_30m.grd -P -K > plot.ps
~/temp 08:46:45 $ grdcontour -J -R @earth_relief_30m.grd -O -C1000 -Bafg -L10000/100000 >> plot.ps
~/temp 08:46:48 $ psconvert -Tf -A plot.ps
psconvert [ERROR]: plot.ps: GMT PS format detected but file is not finalized. Maybe a -K in excess? plot.pdf could be messed up.
  1. Also, giving -C0 (zero contour interval) does not really makes sense, right? E.g.
$ grdcontour -JS0/90/10c -RNO @earth_relief_30m.grd -C0 -Bafg > 0_cont_int.ps

But it will plot the same as giving -C+0

$ grdcontour -JS0/90/10c -RNO @earth_relief_30m.grd -C+0 -Wthick,red -Bafg > plot_0_cont_only.ps

Maybe this is wanted, but an alternative would be to issue warning/information.

  1. Giving this command gives strange output, but seems to work fine.
$ grdcontour -JS0/90/10c -RNO @earth_relief_30m.grd -C1 -Bafg > plot.ps
grdcontour [ERROR]: Error in map_wesn_clip: odd number of crossings?grdcontour [ERROR]: Error in map_wesn_clip: odd number of crossings?grdcontour [ERROR]: Error in map_wesn_clip: odd number of crossings?grdcontour [ERROR]: Error in map_wesn_clip: odd number of crossings?

The error disappears if the contour interval (-C) is > 12.

Activity

  1. anbj commented on Apr 4, 2019

    @anbj
    ContributorAuthor

    I expected to get the new info

    No contours drawn, check your -A, -C, -L settings?
    

    giving this command

    $ grdcontour -JS0/90/10c -RNO @earth_relief_30m.grd -P -C1000 -Bafg -L10000/100000 > plot.ps
    $
    

    but it didnt.

  2. PaulWessel commented on Apr 4, 2019

    @PaulWessel
    Contributor

    You need to use -V to get any warnings, otherwise you will only see error messages, and that case is not an error (maybe user error, but that is not what error means here). Let me know if -V does it for you - that was the intention.

  3. anbj commented on Apr 4, 2019

    @anbj
    ContributorAuthor

    I see, now I get

    $ grdcontour -JS0/90/10c -RNO @earth_relief_30m.grd -P -C1000 -Bafg -L10000/100000 -V > plot.ps
    grdcontour [WARNING]: No contours within specified -L range
    

    and I see that there may be a warning for this already? https://github.com/GenericMappingTools/gmt/blob/master/src/grdcontour.c#L1221

    ..
    GMT_Report (API, GMT_MSG_VERBOSE, "No contours within specified -L range\n");
    ...
    
  4. PaulWessel commented on Apr 4, 2019

    @PaulWessel
    Contributor

    I just now placed that second check inside the correct block so it can catch other cases where for whatever reasons no contours are drawn.

  5. anbj commented on Apr 5, 2019

    @anbj
    ContributorAuthor

    Still getting

    $ grdcontour -JS0/90/10c -RNO @earth_relief_30m.grd -P -C1000 -Bafg -L10000/100000 -V > plot.ps
    grdcontour [WARNING]: No contours within specified -L range
    

    When should this message appear? Vs. when should No contours drawn, check your -A, -C, -L settings? appear?

  6. PaulWessel commented on Apr 5, 2019

    @PaulWessel
    Contributor

    Probably very rarely, such as when a contour is skipped due to -Q or when it projects to be outside the plot domain for oblique maps. The message you see catches things when the data range is outside the -L setting. But when that is not true there are still some reasons why a contour that is found somehow ends up not being drawn.

  7. PaulWessel commented on May 2, 2019

    @PaulWessel
    Contributor

    I think we are OK to close this one now?

  8. anbj commented on May 3, 2019

    @anbj
    ContributorAuthor

    Yes, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions