[ncl-talk] fatal:["Execute.c":8640]:Execute: Error occurred at or near line 897 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/crop.ncl

Dennis Shea shea at ucar.edu
Tue Aug 29 14:57:53 MDT 2017


I fixed an error and added writing a netCDF file.

http://www.ncl.ucar.edu/Document/Functions/Crop/refevt_hargreaves_fao56.shtml
Example 2

On Tue, Aug 29, 2017 at 8:37 AM, Dennis Shea <shea at ucar.edu> wrote:

> THX for sending the files. I have added Example 2 for
>
>    http://www.ncl.ucar.edu/Document/Functions/Crop/
> refevt_hargreaves_fao56.shtml
>
> ----
> Note: Given the size of the files (each > 4GB), this calculation takes
> some time (about 5 minutes)
>
> radext = radext_fao56(jday, lat2d, radunit)
> ; <=== 186 seconds
>
> refevt = refevt_hargreaves_fao56( tmin, tmax, radext, (/0,0,0/) )   ; <===
> 113 seconds
>
> =============
> A tip when testing scripts on large files, it may be best to implement a
> 'TEST' option:
>
>  TEST   = True
>  ...
>   if (TEST) then
>       tStrt= 0
>       tLast= 100
>       time = fmin->time(tStrt:tLast) ; small subset
>   else
>       time = fmin->time                   ; entire file
>   end if
>
> ...
>
> ;---Read daily min & max
>   if (TEST) then
>       tmin = fmin->tasmin(tStrt:tLast,:,:)
>       tmax = fmax->tasmax(tStrt:tLast,:,:)
>   else
>       tmin = fmin->tasmin
>       tmax = fmax->tasmax
>   end if
>
> ====
>
> This would provide musch faster turn around for debugging.
>
> Good Luck
>
>
>
>
> On Wed, Aug 23, 2017 at 10:30 AM, Dennis Shea <shea at ucar.edu> wrote:
>
>> Guido's response is correct.
>>
>> Still, a 'trick' when encountering a malloc error is to use a small
>> subset of the data
>>
>> Rather than:
>>
>>   tasmax = a->tasmax
>>
>>   tasmin = b->tasmin
>>
>>   Pr_annual_total  = c->pr
>>
>>   lon = a->longitude
>>
>>   lat = a->latitude
>>   time = a->time
>>
>> Use
>>   NT = 100                                    ; arbitrary
>>
>>   tasmax = a->tasmax(0:NT,:,:)
>>
>>   tasmin  = b->tasmin(0:NT,:,:)
>>
>>   Pr_annual_total  = c->pr(0:NT,:,:)
>>
>>   lon = a->longitude
>>
>>   lat = a->latitude
>>
>>
>> Note: rather than reading the 'time' variable directly
>>   time = a->time(0:NT)
>> I suggest using the 'time' coordinate associated with the variable
>>    time = tasmax&time
>>
>>
>> ====
>>
>>
>> On Wed, Aug 23, 2017 at 5:15 AM, Guido Cioni <guidocioni at gmail.com>
>> wrote:
>>
>>> You have to increase the maximum memory (ws maximum size) used by ncl to
>>> plot. See here (https://www.ncl.ucar.edu/Document/Graphics/hlures.shtml
>>> ).
>>>
>>> Additionally, depending on the machine, you may need to increase the
>>> maximum memory available for ncl at execution time (like ulimit in Linux).
>>> Cheers
>>>
>>> Il 23 ago 2017 1:09 PM, "Beáta Szabó-Takács" <szabo.b at czechglobe.cz> ha
>>> scritto:
>>>
>>>> Dear NCL Users,
>>>>
>>>>
>>>>
>>>> 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:
>>>>
>>>> fatal:NclMalloc Failed:[errno=12]
>>>>
>>>> fatal:New: could not create new array:[errno=12]
>>>>
>>>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 897
>>>> in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/crop.ncl
>>>>
>>>>
>>>>
>>>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 162
>>>> in file lambert_PET.ncl
>>>>
>>>>
>>>>
>>>> ; Main code.
>>>>
>>>> ;----------------------------------------------------------------------
>>>>
>>>> begin
>>>>
>>>> ;************************************************
>>>>
>>>> ; read in netCDF file
>>>>
>>>> ;************************************************
>>>>
>>>>   a = addfile("E-OBS_tasmax.nc","r")
>>>>
>>>>   b = addfile("E-OBS_tasmin.nc","r")
>>>>
>>>>   c = addfile("E-OBS_1971-2000_ys.nc","r")
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   tasmax = a->tasmax
>>>>
>>>>   tasmin = b->tasmin
>>>>
>>>>   Pr_annual_total  = c->pr
>>>>
>>>>   lon = a->longitude
>>>>
>>>>   lat = a->latitude
>>>>
>>>>   time = a->time
>>>>
>>>>   minlat             =  30                ; min lat to mask
>>>>
>>>>   maxlat             =  75                ; max lat to mask
>>>>
>>>>   minlon             = -20                ; min lon to mask
>>>>
>>>>   maxlon             =  40                ; max lon to mask
>>>>
>>>>
>>>>
>>>>   nlat = dimsizes(lat)
>>>>
>>>>   mlon = dimsizes(lon)
>>>>
>>>>
>>>>
>>>>   lat_new=conform_dims( (/nlat,mlon/), lat, 0)
>>>>
>>>>
>>>>
>>>>   time2 = calendar_decode2(time,-5)
>>>>
>>>>   doy = day_of_year(time2(:,0),time2(:,1),time2(:,2))
>>>>
>>>>    print(doy)
>>>>
>>>>     radext = radext_fao56(doy, lat_new, 0)
>>>>
>>>>     radext = where(ismissing(radext), 0, radext)
>>>>
>>>>
>>>>
>>>>     evtH_0 = refevt_hargreaves_fao56( tmin, tmax, radext, (/0,0,0/) )
>>>>
>>>>
>>>>
>>>>    print(evtH_0)
>>>>
>>>>    opt = True
>>>>
>>>>    opt at nval_crit = 12
>>>>
>>>>
>>>>
>>>>    PET_m = calculate_monthly_values (evtH_0, "sum", 0,opt)
>>>>
>>>>    print(PET_m)
>>>>
>>>>
>>>>
>>>>     PET_annual_total = month_to_annual(PET_m, 0)
>>>>
>>>> ;    Pr_annual_total = month_to_annual(Pr_m, 0)
>>>>
>>>>
>>>>
>>>>       AI = Pr_annual_total/PET_annual_total
>>>>
>>>>      AI2 = dim_avg_n(AI,0)
>>>>
>>>>   IM =  new(dimsizes(AI2),typeof(AI2))
>>>>
>>>>
>>>>
>>>>    IM = where(AI2 .lt. 0.03,1.0,IM)
>>>>
>>>>    IM = where(AI2 .ge. 0.03 .and. AI2 .lt. 0.2,2.0,IM)
>>>>
>>>>    IM = where(AI2 .ge. 0.2 .and. AI2 .lt. 0.5,3.0,IM)
>>>>
>>>>    IM = where(AI2 .ge. 0.5 .and. AI2 .lt. 0.65,4.0,IM)
>>>>
>>>>    IM = where(AI2 .ge. 0.65,5.0,IM)
>>>>
>>>>
>>>>
>>>> The error refer to the radext_fao56 in my script which is attached as
>>>> well. Could someone suggest a solution?
>>>>
>>>>
>>>>
>>>> Thank you for your help in advance!
>>>>
>>>>
>>>>
>>>> Best regards,
>>>>
>>>> Beata
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170829/d0d92219/attachment.html>


More information about the ncl-talk mailing list