<div dir="ltr">Hi Dave,<div><br></div><div>Thanks for the suggestion, but I'm not optimistic that that will work for my problem. I think finding the boundaries of an arbitrary WRF grid as a spherical polygon would be a non-trivial task; I don't know how I would even go about doing that.</div><div><br></div><div>Thinking about it, I can probably approximately solve this problem in a few steps with a combination of wrf_user_ll_to_ij and then gc_latlon (by calculating the distance between obs and "nearest grid points" along the edge of the WRF domain and then applying a distance threshold). I'll try that tomorrow. I think I've found a bug with wrf_user_ll_to_ij, though (it gives me non-existent (i,j) values for (lon,lat) points outside the domain), and I'll submit a separate ticket on that.</div><div><br></div><div>Jared</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 20, 2017 at 5:39 PM, Dave Allured - NOAA Affiliate <span dir="ltr"><<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Jared,<div><br></div><div>See whether the function gc_inout will work in your case.  You would need to get the boundaries of the WRF grid as a spherical polygon.  There may already be published WRF polygons as shape files; I am not familiar with that.  Then use the function gc_inout to determine inside or outside for each obs location.</div><div><br></div><div>In essence you would be applying two mask tests to each obs point, because you also say you want to select within a lat/lon box.  Use gc_inout to test against the larger WRF grid, and use simple arithmetic comparisons for the lat/lon box.</div><div><br></div><div>Caution, there is a little trap here.  Do not use gc_inout for testing simple four-sided lat/lon bounding boxes.  You would probably get something unexpected.  gc_inout uses spherical polygons on the earth's surface.  Such polygons have curved edges on the simple lat/lon plane.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>--Dave</div></font></span><span class=""><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 20, 2017 at 4:26 PM, Jared Lee <span dir="ltr"><<a href="mailto:jaredlee@ucar.edu" target="_blank">jaredlee@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi, I have a WRF domain on a polar stereographic grid (which also happens to span the dateline), and I want to interpolate model data to MADIS observation locations that are within my domain. Is there a straightforward way to evaluate which observation lat/lon points are outside the WRF grid?<div><br></div><div>Because it's a polar stereographic grid, doing a first pass to eliminate MADIS stations by comparing to the min/max latitude and longitude of the WRF grid still leaves a ton of geographic area that would be inside that lat/lon box but outside the WRF grid (and that's complicated further by the WRF domain spanning the dateline).<div><br></div><div>I tried using rcm2points to do horizontal interpolation, but that function is still interpolating to numerous grid points that are thousands of km outside my WRF domain. I also tried feeding wrf_user_ll_to_ij some lat/lon values for points well outside my domain, and it gives me nonsense (but non-missing) values for nearest grid points.</div><div><br></div><div>Anyone have any ideas? Or is there a function that already exists to do this that I'm apparently not seeing? It seems like a function to return the (i,j) values of the four surrounding grid points would be an ideal way to accomplish this and be useful in additional contexts and applications.</div><div><br></div><div>Jared</div></div></div></blockquote></div></div></div></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><div><div><div><font face="courier new, monospace">===============================<br>Jared A. Lee, Ph.D.<br></font></div><font face="courier new, monospace">Project Scientist I<br></font></div><font face="courier new, monospace">Research Applications Laboratory<br></font></div><font face="courier new, monospace">National Center for Atmospheric Research<br>Boulder, Colorado, USA</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Member, AMS Planning Commission<br><br></font></div><font face="courier new, monospace">Email: <a href="mailto:jaredlee@ucar.edu" target="_blank">jaredlee@ucar.edu</a> (w)<br></font></div><font face="courier new, monospace">Phone: 303.497.8485 (w)</font><div><font face="courier new, monospace">Web: <a href="https://staff.ucar.edu/users/jaredlee" target="_blank">https://staff.ucar.edu/users/jaredlee</a><br>===============================</font><br></div></div></div></div></div>
</div>