<div dir="ltr"><div>NCL support,</div><div><br></div><div>Would you please fix gc_inout to make it functional over all regions of the globe, including polar regions?  No hurry for me.  Thanks.</div><div><br></div><div>--Dave</div><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 2, 2016 at 2:47 AM, Rym Msadek <span dir="ltr">&lt;<a href="mailto:msadek@cerfacs.fr" target="_blank">msadek@cerfacs.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Thanks Dave for your reply. I thought about this option too. I just find it unfortunate that there isn’t a simpler option given that the function is allowed in matlab and python.<div><br></div><div>Rym</div><div><br><div><blockquote type="cite"><div>Le 1 déc. 2016 à 23:37, Dave Allured - NOAA Affiliate &lt;<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>&gt; a écrit :</div><br class="m_-9085427271879215148Apple-interchange-newline"><div><div dir="ltr">Another approach would be to break up your polygon into three separate wedge shaped polygons, each of which is carefully designed to exclude the pole and a tiny region around it.  Then create three separate grid masks with gc_inout, and merge them for your final data mask.  This would avoid the need to rotate or reproject the data.<div><br></div><div>I suggest making each wedge so that the pole is excluded not only from the polygon itself, but also from the convex hull of the polygon.  I would also suggest making the wedges overlap each other slightly along their common east/west boundaries, to eliminate the rare possibility of missing grid points that sit exactly on a boundary line.</div><div><br></div><div>If your data grid actually includes the pole itself, then manually set those mask values(s) to True to handle the special case.</div><div><br></div><div>--Dave</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 1, 2016 at 8:54 AM, Rick Brownrigg <span dir="ltr">&lt;<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Rym,<br><br></div>I don&#39;t definitively know a solution, but I wonder if you might be able to get what you need by either i) rotating/translating your data somewhere off pole to do the in/out calculation, then rotating back,  or ii) performing the calculation in a map projection, and again, deprojecting the results back ?<br><br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 1, 2016 at 7:10 AM, Rym Msadek <span dir="ltr">&lt;<a href="mailto:msadek@cerfacs.fr" target="_blank">msadek@cerfacs.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div><br></div><div>I am trying to use the gc_inout function to define a polygon over the Arctic region and use that as a mask to average an oceanic field like potential temperature.</div><div>I have an issue when the longitudes and latitudes of the polygon cover a region that crosses the North pole. gcinout gives me a contour that is not closed and I can’t figure out how to overcome this issue.<br><div><br></div><div>Here are the lon lat that define my polygon, over the Eurasian basin of the Arctic.</div><div>---------</div><div><div>latC=(/81,81.5,82,82.7,82.4,81<wbr>.6,80,78.8,77,78,79,81,82,84,8<wbr>8,88.5,89,86,85,85,84,83,82,82<wbr>,81/)</div><div>lonC=(/27,36,48,60,77,94,107,1<wbr>14,121,134,140,141,145,149,132<wbr>,149,-79,-55,-43,-22,-20,-17,-<wbr>9,5,27/)</div><div><br></div><div>in_obs=gc_inout(nav_lono,nav_l<wbr>ato,lonC,latC)</div><div><br></div><div>mask_eurasia = where(in_obs.eq.True,1,0)</div><div>plot= gsn_csm_contour_map_polar(wks,<wbr>mask_eurasia,res)</div></div></div><div>--------</div><div>I’m attaching the resulting plot that I get.</div><div>Note that I have used this same gc_inout function to define other polygons in the Arctic and it works fine when the region was not over the central Arctic.</div><div><br></div><div>Any help would be appreciated.</div><div><br></div><div>Thanks,</div><div><br></div><div>Rym</div></div></blockquote></div></div></blockquote></div></div></div></div></blockquote></div></div></div></blockquote></div></div></div>