[Thread Prev][Thread Next][Index]

Re: [ferret_users] Creating and using an irregular mask, as in the recent question regarding filling data over China



Hi all,
While we're on the topic, I have one more thing to throw out there. Some time back when this question came up we did a little investigation and wrote an external function based on the code by W. Randolph Franklin, found in his web pages at
http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html

It does the same kind of computation as what Mick is doing in his Ferret script, InsidePolygon.jnl. We have not had a chance to really test it. Mick's method of getting the polygon outline with his polydef_close.jnl script is a big step towards being able to do useful things with either this function or the InsidePolygon.jnl script. The only advantage of using the Ferret external function is that it should be faster.

I've put a tar file with an external function at this location
ftp://ftp.pmel.noaa.gov/ferret/special_request/ansley/pt_in_poly.tar.gz

It contains this new function.

yes? show func pt_in_poly
PT_IN_POLY(A,XVERT,YVERT)
   Return -1 outside, 0 if on edge, 1 if inside polygon
   A: Variable on the XY grid and region to be tested
   XVERT: X-coordinates of vertices of polygon
   YVERT: Y-coordinates of vertices of polygon

To use the pre-compiled external function, put the appropriate pt_in_poly.so file in the directory that is pointed to by the environment variable FER_EXTERNAL_FUNCTIONS.






[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement