<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Dan,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Sorry for the long delay. Most of the NCL team was out last week for a workshop.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I decided to create an example based on your question, since it's an interesting one that we don't have an example of yet. Hopefully I understood your question correctly!</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">See example mask_18.ncl at:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/mask.shtml#ex18">http://www.ncl.ucar.edu/Applications/mask.shtml#ex18</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">I started off on the same path you did, by creating a lambert conformal plot. I then used this plot to retrieve the viewport coordinates of the plot axes. The viewport coordinates give me the four corners of the plot in NDC space, which I then used "ndctodata" on to calculate the lat/lon locations.</div><div class="gmail_default"><br></div><div class="gmail_default">It's not enough to just provide the four corners of the plot, however, because the lambert conformal boundary is curved. So, for each of the four axes, I created an array of equally spaced viewport coordinates between the start and end of each axis, so this would give me more values to interpolate the lat/lon boundary. See the "<span style="color:rgb(0,0,0);white-space:pre-wrap">get_latlon_bounding_polygon" function.</span></div><div class="gmail_default"><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div class="gmail_default"><font color="#000000"><span style="white-space:pre-wrap">Once I had the lat/lon boundary, I used "gc_inout" to create a mask array.</span></font></div><div class="gmail_default"><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div class="gmail_default"><font color="#000000"><span style="white-space:pre-wrap">This example uses a data array that is on a rectilinear grid, and which has lat/lon coordinate arrays called "lat" and "lon". If your data is not rectilinear or you don't have coordinate arrays, then you'll need to modify the create_mask_array function to handle the type of lat/lon grid your data is on.</span></font></div><div class="gmail_default"><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div class="gmail_default"><font color="#000000"><span style="white-space:pre-wrap">Let me know if you have any questions.</span></font></div><div class="gmail_default"><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div class="gmail_default"><font color="#000000"><span style="white-space:pre-wrap">--Mary</span></font></div><div class="gmail_default"><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 6, 2018 at 12:49 PM, Daniel Adriaansen - NCAR <span dir="ltr"><<a href="mailto:dadriaan@ucar.edu" target="_blank">dadriaan@ucar.edu</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">Hello,<div><br></div><div>I am plotting a Lambert Conformal map using res@mpLimitMode set to "Corners". The map limits are configured to zoom in on a subset of the full domain of the gridded dataset in the x-y dimensions (lat-lon). I am then calling gsn_csm_contour_map to plot the data.</div><div><br></div><div>What I would like to do, is use the "Corners" resources, to create a polygon so that I can perform statistics on the data only within the view shown in the map that is drawn by gsn_csm_contour_map. The problem is, I have not figured out how gsn_csm_contour_map determines what the bounds are for the domain drawn when using the "Corners" resources.</div><div><br></div><div>My first attempt was to create a polygon from the "Corners" resources (res@mpLeftCornerLonF, res@mpLeftCornerLatF, res@mpRightCornerLonF, and res@mpRightCornerLatF) and then use gc_inout to identify which points from the gridded dataset are within the map limits. When I plot the resultant boolean mask however, the points "inside" the polygon do not directly match the view shown in the bounding box from gsn_csm_contour_map (see attached figure, Mask1.png).</div><div><br></div><div>The end goal is to make sure the statistics being computed are created from exactly those grid cells shown within the bounding region created by gsn_csm_contour_map.</div><div><br></div><div>Any suggestions or ideas are appreciated. Thanks!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Dan</div><div><br></div><div><br></div></font></span></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>