<div dir="ltr"><div>I see, since the variable "
<span style="background-color:rgb(0,255,0)"><b> tc1_land_MASK</b></span>
" is not being reassigned or deleted at the end of each loop iteration, I would expect that error since your lat and lon are likely to be different in each iteration, so simplest solution would be to use the reassignment operator ":=" for the variable
<span style="background-color:rgb(0,255,0)"><b>tc1_land_MASK</b></span> and also for variable "lsmtc" .</div><div>Second option would be to delete the variables that are not necessary after a loop iteration. e.g. just before end do line you could add: <br></div><div>delete([/tc1_land_MASK, lsmtc/]), you can possible add more variable to this separated by commas. I generally prefer this second option since deleting would release some memory next iteration.<br></div><div></div><div><br></div><div>General comment: when using loops it is important to keep in mind what happens at successive iterations, especially when the variable dimension sizes are expected to change in subsequent iterations. <br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>
</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 10, 2019 at 12:44 AM Md. Jalal Uddin <<a href="mailto:dmjalal90@gmail.com">dmjalal90@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">do nr=0,nRadius-1<br> do nc=0,nCenter-2<br> poly_lat := clat(nc,nr,:) <br> poly_lon := clon(nc,nr,:) <br> <br> min_lat = min(poly_lat) <br> max_lat = max(poly_lat) <br> min_lon = min(poly_lon) <br> max_lon = max(poly_lon)<br><br>;---Extract the desired rectangle of data <br><br> PRC := tcavg98({min_lat:max_lat},{min_lon:max_lon})<br><br>;---Set points that are outside of the circle of data to missing<br><br> lat2d := conform(PRC, PRC&latitude, 0) <br> lon2d := conform(PRC, PRC&longitude, 1) <br> <br> latlon_circle := gc_inout(lat2d,lon2d, poly_lat,poly_lon)<br> PRC = where(latlon_circle, PRC, PRC@_FillValue) <br> ;printVarSummary(PRC)<br> <br> if (nc.eq.0) then<br> <br> f_lsm = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/<a href="http://landsea.nc" target="_blank">landsea.nc</a>","r") <br><br> lsmtc = tobyte(landsea_mask(f_lsm->LSMASK,PRC&latitude,PRC&longitude)) <br> lsmtc@long_name = "Land-Sea Mask: TRMM 3B42"<br> copy_VarCoords(PRC, lsmtc)<br> <br> tc_land_MASK = where(lsmtc.eq.1 .or. lsmtc.eq.2, PRC, PRC@_FillValue) ; Land only<br> copy_VarMeta(PRC, lsmtc)<br> print("tc_landgrid = "+tc_land_MASK)<br> <br> else <br> <br> f_lsm = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/<a href="http://landsea.nc" target="_blank">landsea.nc</a>","r") <br><br> lsmtc1 = tobyte(landsea_mask(f_lsm->LSMASK,PRC&latitude,PRC&longitude)) <br> lsmtc1@long_name = "Land-Sea Mask: TRMM 3B42"<br> copy_VarCoords(PRC, lsmtc1)<br> <br> <span style="background-color:rgb(0,255,0)"><b> tc1_land_MASK = where(lsmtc1.eq.1 .or. lsmtc1.eq.2, PRC, PRC@_FillValue) ; Land only</b></span><br> copy_VarMeta(PRC, lsmtc1)<br> print("tc1_landgrid = "+tc1_land_MASK)<br> end if<br><br> end do ; nc<br>end do ; nr <br><div><br></div><div>From the above green line error has occurred. The full code in the attachment.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 10 Aug 2019 at 14:27, Rashed Mahmood <<a href="mailto:rashidcomsis@gmail.com" target="_blank">rashidcomsis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Which line the error message occurs? Generally the printVarSummary() can be very useful for understanding the dimsize issues.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 9, 2019 at 7:18 PM Md. Jalal Uddin <<a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thank you, sir, for your kind suggestion, but it did not work.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 9 Aug 2019 at 18:25, Rashed Mahmood <<a href="mailto:rashidcomsis@gmail.com" target="_blank">rashidcomsis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Jalal,</div><div>I think the error message is likely related to the lines:</div><br><div>
poly_lat = clat(nc,nr,:) <br> poly_lon = clon(nc,nr,:) <br></div><div><br></div><div>Changed those to:</div><div>
poly_lat <span style="color:rgb(255,0,0)"><b> :=</b></span> clat(nc,nr,:) <br> poly_lon<span style="color:rgb(255,0,0)"><b> :=</b></span> clon(nc,nr,:)
</div><div><br></div><div>hope that helps.</div><div><br></div><div>Rashed<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 8, 2019 at 6:39 PM Md. Jalal Uddin via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"> do nr=0,nRadius-1<div> do nc=0,nCenter-1<br> poly_lat = clat(nc,nr,:) <br> poly_lon = clon(nc,nr,:) <br><br> min_lat = min(poly_lat) <br> max_lat = max(poly_lat) <br> min_lon = min(poly_lon) <br> max_lon = max(poly_lon)<br><br>;---Extract the desired rectangle of data <br><br> PRC := jancont({min_lat:max_lat},{min_lon:max_lon})<br><br>;---Set points that are outside of the circle of data to missing<br><br> lat2d := conform(PRC, PRC&latitude, 0)<br> lon2d := conform(PRC, PRC&longitude, 1)<br><br> latlon_circle := gc_inout(lat2d,lon2d, poly_lat,poly_lon)<br> PRC = where(latlon_circle, PRC, PRC@_FillValue)<br clear="all"><div>end do </div><div>end do </div><div><br></div><div><br></div><div>Here, when center lat changed (nc), the dimension size of PRC also changed that means PRC has different size. Similar to <a href="http://www.ncl.ucar.edu/Applications/Scripts/polyg_29.ncl" target="_blank">http://www.ncl.ucar.edu/Applications/Scripts/polyg_29.ncl</a></div><div><br></div><div>I tried to mask overland for PRC data but failed because of different dimension sizes. </div><div><br></div><div>How can I make PRC as the same size? Any suggestions would be appreciated.</div><div><br></div><div>Jalal</div>-- <br><div dir="ltr" class="gmail-m_-7957397031943282092gmail-m_6902610224737462275gmail-m_-3538238148053924985gmail-m_-97588144294251955gmail-m_-3009104040020094419gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2" color="#000000"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">MSc in Applied Meteorology<br>Nanjing University of Information, Science and Technology, China</div><div dir="ltr"><span style="letter-spacing:0.2px">B.Sc. in Disaster Management (Hons.) </span><br></div><div dir="ltr"><span style="letter-spacing:0.2px">Patuakhali Science and Technology University, Bangladesh.</span></div><div dir="ltr">Cell: +8613260859092, <span style="letter-spacing:0.2px">+8801792052662</span></div><div dir="ltr"><font size="2">Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> <br>Facebook: jalal.hossen.39 <br>LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" target="_blank">https://bd.linkedin.com/in/md-jalal-uddin-80a026b0</a> </font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-7957397031943282092gmail-m_6902610224737462275gmail-m_-3538238148053924985gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2" color="#000000"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">MSc in Applied Meteorology<br>Nanjing University of Information, Science and Technology, China</div><div dir="ltr"><span style="letter-spacing:0.2px">B.Sc. in Disaster Management (Hons.) </span><br></div><div dir="ltr"><span style="letter-spacing:0.2px">Patuakhali Science and Technology University, Bangladesh.</span></div><div dir="ltr">Cell: +8613260859092, <span style="letter-spacing:0.2px">+8801792052662</span></div><div dir="ltr"><font size="2">Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> <br>Facebook: jalal.hossen.39 <br>LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" target="_blank">https://bd.linkedin.com/in/md-jalal-uddin-80a026b0</a> </font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-7957397031943282092gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2" color="#000000"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">MSc in Applied Meteorology<br>Nanjing University of Information, Science and Technology, China</div><div dir="ltr"><span style="letter-spacing:0.2px">B.Sc. in Disaster Management (Hons.) </span><br></div><div dir="ltr"><span style="letter-spacing:0.2px">Patuakhali Science and Technology University, Bangladesh.</span></div><div dir="ltr">Cell: +8613260859092, <span style="letter-spacing:0.2px">+8801792052662</span></div><div dir="ltr"><font size="2">Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> <br>Facebook: jalal.hossen.39 <br>LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" target="_blank">https://bd.linkedin.com/in/md-jalal-uddin-80a026b0</a> </font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>