[ncl-talk] How to separated regions on a large map?
Alan Brammer
abrammer at albany.edu
Thu Jul 16 10:38:59 MDT 2015
As Dennis says I don't think there is a simple way to do this. Possibly in
Python but I'm not sure there.
I think what you're looking for is some type of flood fill algorithm with
the fill values as your boundary. You could write a flood fill in fortran
and wrap it in. Depends on your desire and ability for that kind of thing.
The other option I can think of would be all ncl based using predefined
functions.
1. Draw a faux plot of your data (maybe setting the fill value to a new
plottable value depending on the next step).
In the above define your plot so the contour is the distinction
between regions you want and regions you don't want.
2. Use get_isolines() to retrieve the coordinates outlining your good
regions.
3. Use gc_inout() to determine which region your point is enclosed by.
You could pretty easily make the above a function where you pass the grid
and the location and return the perimeter defined by get_isolines().
Good luck with it.
Alan.
On Thu, 16 Jul 2015 at 10:20 Dennis Shea <shea at ucar.edu> wrote:
> "Is there anything coded like this in NCL (or R or Python) already?"
>
> To my knowledge, NCL does not have a function that does what you want.
> I doubt R does either.
>
> Good Luck
>
> On Fri, Jul 10, 2015 at 6:01 AM, Erik J. Schaffernicht <
> eschaffe at uni-koeln.de> wrote:
>
>> I have a 2d map where certain gridpoints have a values, all the rest are
>> set to FillValue or Missing. The spatial structure of the points with
>> values are not a-priori known.
>> Now, I look for a function/procedure in NCL (or maybe in R or Python, if
>> those are better suited) that can tell me all the points that are part of a
>> region given that at the beginning of the algorithm I provide one gridpoint
>> that should be member as well.
>>
>> The closure or border of my region is defined by all the gridpoints that
>> are FillValue or Missing and direct neighbours of the points valid values.
>> On the total map there might be several such separated regions, so it is
>> important to know if that I only get the indices of the region that belongs
>> to my initial given grid point.
>>
>> Is there anything coded like this in NCL (or R or Python) already?
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
> _______________________________________________
> 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/20150716/eb13bebb/attachment.html
More information about the ncl-talk
mailing list