[ncl-talk] maximum point in a shapefile

Rick Brownrigg brownrig at ucar.edu
Wed Feb 5 15:20:28 MST 2020


Hi,

This is untested:  what about something like:

   max_ii = ind(data_mask_1d.eq.1 .and. data_1d.eq.data_max(i))

(If the data are floats, it always dicey to compare floating-point values
to exact values, but presumably the function max() will return a value that
exactly matches *at least one* value in the data)

Hope that helps..
Rick


On Wed, Feb 5, 2020 at 2:59 PM Ehsan Taghizadeh via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Dears,
> I hope you're doing great.
>
> I found "shapefiles_13.ncl" and it seems a very useful script. It helps if
> I want to distinguish each county with the average. But what about if I
> just want to plot the maximum point in each county. I mean how I could plot
> just one point in each county which is the maximum point of that county.
> Obviously, I need the following change in "shapefiles_13.ncl"
>
> data_avg(i)  = avg(where(data_mask_1d.eq.1,data_1d,data_1d at _FillValue))
>
> to
>
> data_max(i)  = max(where(data_mask_1d.eq.1,data_1d,data_1d at _FillValue))
>
> I think with finding the index of the maximum point I could locate that in
> the plot with the following line (from minmax_4.ncl):
>
> gsn_add_polymarker(wks,plot,sst&lon(max_ii at xi),sst&lat(max_ii at yi),mkres)
>
>
> So, how could I find the index of "dax_max(i)". It seems the following
> line could not be helpful for a script like "shapefiles_13.ncl":
>
> max_ii = ind(data_max(i))
>
>
> The summary of my question is that I need some help to find the maximum
> point in each geometry of a shapefile and I'll be thankful if I hear from
> you. Should I give up "shapefiles_13.ncl" and try with "
> shapefile_mask_data"?
>
>
> *Sincerely*
> *Ehsan Taghizadeh*
> *Institute of Geophysics, University of Tehran, Iran*
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200205/9963d84b/attachment.html>


More information about the ncl-talk mailing list