<div dir="ltr"><div class="gmail_default" style="font-size:small">Dz,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The issue is that mrb_lat and mrb_lon need to be the same length, because they are supposed to represent a closed polygon that you want to check other points against.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">My guess is that the lat / lon arrays you read off the file are different lengths, as they each represent one dimension of your data.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm not sure, though, that gc_inout is being used correctly. I'm guessing that the lat/lon arrays on the file do not represent a closed polygon, but rather just a lat/lon grid for your data.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you are simply trying to mask your variable based on another array, then you may want to look at the "where" or "mask" functions:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml</a><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/mask.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/mask.shtml</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">You can see some examples of masking here:</div><div class="gmail_default"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/mask.shtml">http://www.ncl.ucar.edu/Applications/mask.shtml</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div><div class="gmail_default" style="font-size:small"><div><br></div></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 21, 2017 at 12:10 AM, dale zuri <span dir="ltr"><<a href="mailto:dalezuri@gmail.com" target="_blank">dalezuri@gmail.com</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"><div><div><div>Hi ,<br></div>Could someone help me to fix this?<br><br></div>Thanks<br></div>Dz<br>fatal:gc_inout: the lat/lon arrays must have the same dimension sizes<br>fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 57 in file <br><br> f1 = addfile("<a href="http://mask_cfsv2.nc" target="_blank">mask_cfsv2.nc</a>", "r")<br>printVarSummary (f1)<br> mrb_lon = f1->lon<br> mrb_lat = f1->lat<br> nmrb = dimsizes(mrb_lon)<br><br> min_mrb_lat = min(mrb_lat)<br> max_mrb_lat = max(mrb_lat)<br> min_mrb_lon = min(mrb_lon)<br> max_mrb_lon = max(mrb_lon)<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;<br>f = addfile("Concat_precSum_0Z_<wbr><a href="http://198203-201003.nc">198203-201003.nc</a>", "r") ; note the "s" of addfile<br>;T = f[:]->precSum ; read T from all files<br>T = f->var(:,{min_mrb_lat:max_mrb_<wbr>lat},{min_mrb_lon:max_mrb_lon}<wbr>) ; read T from all files<br>lon1d = f->lon_0 ; read T from all files<br>lat1d = f->lat_0 ; read T from all files<br>printVarSummary (T)<br>printVarSummary (lat1d)<br>;printVarSummary (lon1d)<br>;printVarSummary (mrb_lon)<br>;print(lat1d-mrb_lat)<br>;print(lon1d-mrb_lon)<br>;return<br> dimp= dimsizes(T)<br> ntim = dimp(0)<br> nlat = dimp(1)<br> mlon = dimp(2)<br>;;;;;;;;;;;;;;;;;;;;;<br><br>;---Create an array and initialize to _FillValue<br> pmask = new(dimsizes(T), typeof(T), T@_FillValue)<br>printVarSummary(pmask)<br> copy_VarCoords(T,pmask)<br>;;;;;;;;;;;;;;;;;;;;;;;;;;<br>;---Keep only data within the polygon<br>; Use NCL array syntax (:) to propagate to all times<br><br> do nl=0,nlat-1<br> do ml=0,mlon-1<br> if(gc_inout(lat1d(nl),lon1d(<wbr>ml),mrb_lat,mrb_lon)) then<br>return<br><br></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>