[ncl-talk] Lat/lon labels

Rick Brownrigg brownrig at ucar.edu
Sun Apr 9 08:53:33 MDT 2023


Hi Zilore,

The specific error with ispan is that the function takes integers, not
floats:

   lats = ispan(-31,-28,1)

There is an fspan  function if that's what you really want; it behaves a
bit differently:

    https://www.ncl.ucar.edu/Document/Functions/Built-in/fspan.shtml

More to your question, I'm not expert with labelling axes, so I always have
to experiment. If fixing the ispan() error doesn't get you the labels you
want, you might look at the examples on tickmarks for how to custom label
axes:

     https://www.ncl.ucar.edu/Applications/tickmarks.shtml

Hope that helps...
Rick

On Sun, Apr 9, 2023 at 1:59 AM Zilore Mumba via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> My script,figure attached, outputs one longitude and one latitude labels
> only. In the code snippet below, I have turned on gridlines and they draw
> ok.
> From this script
> https://www.ncl.ucar.edu/Applications/Scripts/mapgrid_6.ncl I was
> guessing that I could put latitude and longitudes labels using the code
> reproduced below. This gives me the error (lats = ispan(-31.,-28.,1.)
> "fatal:ispan: arguments must be of an integral type, can't continue"
> How does one get customized lat/lon labels?
>
>        res at mpGridAndLimbOn        = True               ; turn on grid
> lines
>        res at mpGridSpacingF         = 0.5
>
>      ;---Create lat/lon arrays for location of latitude labels.
>        ;lats = ispan(-31.,-28.,1.)
>        ;nlat = dimsizes(lats)
>        ;lons = new(nlat,integer)
>        ;lons = 0
>
>        ;---Resources for text strings
>        ;txres               = True
>        ;txres at txFontHeightF = 0.015
>        ;dum = gsn_add_text(wks,plot,""+lats,lons,lats,txres)
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20230409/722c3ce4/attachment.htm>


More information about the ncl-talk mailing list