<div dir="ltr"><div><div><div><div><div>THX for sending the files. I have added Example 2 for <br><br> <a href="http://www.ncl.ucar.edu/Document/Functions/Crop/refevt_hargreaves_fao56.shtml">http://www.ncl.ucar.edu/Document/Functions/Crop/refevt_hargreaves_fao56.shtml</a><br><br>----<br></div>Note: Given the size of the files (each > 4GB), this calculation takes some time (about 5 minutes)<br><br>radext = radext_fao56(jday, lat2d, radunit) ; <=== 186 seconds<br><br>refevt = refevt_hargreaves_fao56( tmin, tmax, radext, (/0,0,0/) ) ; <=== 113 seconds<br><br>=============<br></div>A tip when testing scripts on large files, it may be best to implement a 'TEST' option:<br><br> TEST = True <br> ...<br> if (TEST) then<br> tStrt= 0<br> tLast= 100<br> time = fmin->time(tStrt:tLast) ; small subset<br> else<br> time = fmin->time ; entire file<br></div> end if<br><br>...<br><br>;---Read daily min & max<br> if (TEST) then<br> tmin = fmin->tasmin(tStrt:tLast,:,:) <br> tmax = fmax->tasmax(tStrt:tLast,:,:)<br> else<br> tmin = fmin->tasmin<br> tmax = fmax->tasmax <br> end if<br><br>====<br><br></div>This would provide musch faster turn around for debugging.<br><br></div>Good Luck<br><div><div><br><div><br><div><div><br></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 23, 2017 at 10:30 AM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@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"><div><div><div><div>Guido's response is correct.<br><br></div>Still, a 'trick' when encountering a malloc error is to use a small subset of the data<br><br></div>Rather than:<span class=""><br><br><p class="MsoNormal"> tasmax = a->tasmax</p>
<p class="MsoNormal"> tasmin = b->tasmin</p>
<p class="MsoNormal"> Pr_annual_total = c->pr</p>
<p class="MsoNormal"> lon = a->longitude</p>
<p class="MsoNormal"> lat = a->latitude</p>
time = a->time<br><br></span></div>Use<br></div> NT = 100 <wbr> ; arbitrary<br><div><p class="MsoNormal"> tasmax = a->tasmax(0:NT,:,:)</p>
<p class="MsoNormal"> tasmin = b->tasmin(0:NT,:,:)</p>
<p class="MsoNormal"> Pr_annual_total = c->pr(0:NT,:,:)</p><span class="">
<p class="MsoNormal"> lon = a->longitude</p>
<p class="MsoNormal"> lat = a->latitude</p><p class="MsoNormal"><br></p></span><p class="MsoNormal">Note: rather than reading the 'time' variable directly<br></p>
time = a->time(0:NT)<br></div><div>I suggest using the 'time' coordinate associated with the variable</div><div> time = tasmax&time <br><br><br>====<br><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 23, 2017 at 5:15 AM, Guido Cioni <span dir="ltr"><<a href="mailto:guidocioni@gmail.com" target="_blank">guidocioni@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="auto">You have to increase the maximum memory (ws maximum size) used by ncl to plot. See here (<a href="https://www.ncl.ucar.edu/Document/Graphics/hlures.shtml" target="_blank">https://www.ncl.ucar.edu/Docu<wbr>ment/Graphics/hlures.shtml</a>). <div dir="auto"><br></div><div dir="auto">Additionally, depending on the machine, you may need to increase the maximum memory available for ncl at execution time (like ulimit in Linux). </div><div dir="auto">Cheers </div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_345803851173878323h5">Il 23 ago 2017 1:09 PM, "Beáta Szabó-Takács" <<a href="mailto:szabo.b@czechglobe.cz" target="_blank">szabo.b@czechglobe.cz</a>> ha scritto:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_345803851173878323h5">
<div link="#0563C1" vlink="#954F72" lang="HU">
<div class="m_345803851173878323m_-3340939603139353026m_4138251214724357598WordSection1">
<p class="MsoNormal">Dear NCL Users,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I would like to calculate Aridity index base on Hargreaves ETo equation. I use daily maximum and minimum temperature data from 1971 to 2000 and yearly sum precipitation (30 years). The dimension of latitude is (201x464) and the day of year
is (10957) vector for radext_fao56 function. When I run the scipt I get the following error message:<u></u><u></u></p>
<p class="MsoNormal">fatal:NclMalloc Failed:[errno=12]<u></u><u></u></p>
<p class="MsoNormal">fatal:New: could not create new array:[errno=12]<u></u><u></u></p>
<p class="MsoNormal">fatal:["Execute.c":8640]:Execu<wbr>te: Error occurred at or near line 897 in file $NCARG_ROOT/lib/ncarg/nclscrip<wbr>ts/csm/crop.ncl<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">fatal:["Execute.c":8640]:Execu<wbr>te: Error occurred at or near line 162 in file lambert_PET.ncl<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">; Main code.<u></u><u></u></p>
<p class="MsoNormal">;-----------------------------<wbr>------------------------------<wbr>-----------<u></u><u></u></p>
<p class="MsoNormal">begin<u></u><u></u></p>
<p class="MsoNormal">;*****************************<wbr>*******************<u></u><u></u></p>
<p class="MsoNormal">; read in netCDF file<u></u><u></u></p>
<p class="MsoNormal">;*****************************<wbr>*******************<u></u><u></u></p>
<p class="MsoNormal"> a = addfile("E-OBS_tasmax.nc","r")<u></u><u></u></p>
<p class="MsoNormal"> b = addfile("E-OBS_tasmin.nc","r")<u></u><u></u></p>
<p class="MsoNormal"> c = addfile("E-OBS_1971-2000_ys.nc<wbr>","r")<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> tasmax = a->tasmax<u></u><u></u></p>
<p class="MsoNormal"> tasmin = b->tasmin<u></u><u></u></p>
<p class="MsoNormal"> Pr_annual_total = c->pr<u></u><u></u></p>
<p class="MsoNormal"> lon = a->longitude<u></u><u></u></p>
<p class="MsoNormal"> lat = a->latitude<u></u><u></u></p>
<p class="MsoNormal"> time = a->time<u></u><u></u></p>
<p class="MsoNormal"> minlat = 30 ; min lat to mask<u></u><u></u></p>
<p class="MsoNormal"> maxlat = 75 ; max lat to mask<u></u><u></u></p>
<p class="MsoNormal"> minlon = -20 ; min lon to mask<u></u><u></u></p>
<p class="MsoNormal"> maxlon = 40 ; max lon to mask<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> nlat = dimsizes(lat)<u></u><u></u></p>
<p class="MsoNormal"> mlon = dimsizes(lon)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> lat_new=conform_dims( (/nlat,mlon/), lat, 0)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> time2 = calendar_decode2(time,-5)<u></u><u></u></p>
<p class="MsoNormal"> doy = day_of_year(time2(:,0),time2(:<wbr>,1),time2(:,2))<u></u><u></u></p>
<p class="MsoNormal"> print(doy)<u></u><u></u></p>
<p class="MsoNormal"> radext = radext_fao56(doy, lat_new, 0)<u></u><u></u></p>
<p class="MsoNormal"> radext = where(ismissing(radext), 0, radext)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> evtH_0 = refevt_hargreaves_fao56( tmin, tmax, radext, (/0,0,0/) )<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> print(evtH_0)<u></u><u></u></p>
<p class="MsoNormal"> opt = True<u></u><u></u></p>
<p class="MsoNormal"> opt@nval_crit = 12<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> PET_m = calculate_monthly_values (evtH_0, "sum", 0,opt)<u></u><u></u></p>
<p class="MsoNormal"> print(PET_m)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> PET_annual_total = month_to_annual(PET_m, 0)<u></u><u></u></p>
<p class="MsoNormal">; Pr_annual_total = month_to_annual(Pr_m, 0)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> AI = Pr_annual_total/PET_annual_tot<wbr>al<u></u><u></u></p>
<p class="MsoNormal"> AI2 = dim_avg_n(AI,0)<u></u><u></u></p>
<p class="MsoNormal"> IM = new(dimsizes(AI2),typeof(AI2))<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> IM = where(AI2 .lt. 0.03,1.0,IM)<u></u><u></u></p>
<p class="MsoNormal"> IM = where(AI2 .ge. 0.03 .and. AI2 .lt. 0.2,2.0,IM)<u></u><u></u></p>
<p class="MsoNormal"> IM = where(AI2 .ge. 0.2 .and. AI2 .lt. 0.5,3.0,IM)<u></u><u></u></p>
<p class="MsoNormal"> IM = where(AI2 .ge. 0.5 .and. AI2 .lt. 0.65,4.0,IM)<u></u><u></u></p>
<p class="MsoNormal"> IM = where(AI2 .ge. 0.65,5.0,IM)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The error refer to the radext_fao56 in my script which is attached as well. Could someone suggest a solution?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thank you for your help in advance!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Best regards,<u></u><u></u></p>
<p class="MsoNormal">Beata<u></u><u></u></p>
</div>
</div>
<br></div></div>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div></div>
<br>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>