NclMalloc Failed:[errno=12] in Anomaly Calculation

From: Abhik Santra <abhiksantra_at_nyahnyahspammersnyahnyah>
Date: Thu Dec 20 2012 - 02:52:34 MST

Hello,

I am trying to calculate the daily anomalous rainfall using 12 years of TRMM-3B42 data.
The horizontal dimension of the data is lon: 1440 x lat: 160.
The code shows the "fatal:NclMalloc Failed:[errno=12]" and "Segmentation fault" during reading the data (time: 4383; lon: 1440; lat:160).
>From earlier ncl-talk discussions, it appears that this is a memory issue and experts have suggested to create the variable outside the loop.
But for my case, I am not using any loop or iteration to compute the smoothed climatology and then the anomaly.
Can anyone suggest me the way to handle the NCL memory problems?
The code is as follows:

;************************************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin
;-------------------------------------------------------------
; User specifications
;-------------------------------------------------------------
   ymdStrt = 19980101 ; start yyyymmdd
   ymdLast = 20091231 ; last
   yrStrt = ymdStrt/10000
   yrLast = ymdLast/10000
   
   nhar = 3 ; number of fourier comp
   
   var = "rf" ; name of file

   diri = "../"
   fili = "TRMM3B42-RF-1998-2009.nc" ; input file

;***********************************************************
; Read user specified time and create required yyyyddd
;***********************************************************
   f = addfile (diri+fili , "r")
   time = f->time ; all times on file
   ymd = ut_calendar(time, -2) ; yyyymmdd
   iStrt = ind(ymd.eq.ymdStrt) ; index start
   iLast = ind(ymd.eq.ymdLast) ; index last
   delete(time)
   delete(ymd)

;***********************************************************
; Read user specified time and create required yyyyddd
;***********************************************************
   time = f->time(iStrt:iLast) ; time:units = "hours since"
   TIME = ut_calendar(time, 0) ; type float
   year = floattointeger( TIME(:,0) )
   month = floattointeger( TIME(:,1) )
   day = floattointeger( TIME(:,2) )
   ddd = day_of_year(year, month, day)
   yyyyddd = year*1000 + ddd ; needed for input

:***********************************************************
; Read data: short2flt
;***********************************************************
   x = short2flt( f->$var$(iStrt:iLast,{-15:15},:) ) ; convert to float
   printVarSummary( x )
   lat = f->lat({-15:15})
   lon = f->lon

;***********************************************************
; Compute daily climatology: raw and then 'smoothed'
;***********************************************************
   xClmDay = clmDayTLL(x, yyyyddd) ; daily climatology at each grid point
   printVarSummary(xClmDay)

;***********************************************************
; Compute smoothed daily climatology using 'nhar' harmonics
;***********************************************************
   xClmDay_sm = smthClmDayTLL(xClmDay, nhar)
   printVarSummary(xClmDay_sm)

;***********************************************************
; Compute daily anomalies using raw and smoothed climatologies
;***********************************************************
    xAnom = calcDayAnomTLL (x, yyyyddd, xClmDay_sm)
    printVarSummary(xAnom)
    printMinMax(xAnom, True)

    delete( x ) ; no longer needed
 end
;*************************************************************************
 
Thanking you,

Regards,
Abhik

-- 
Abhik Santra
CSIR Research Fellow,
Indian Institute of Tropical Meteorology,
Pune - 411008.
India
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 20 03:04:56 2012

This archive was generated by hypermail 2.1.8 : Fri Dec 21 2012 - 10:43:23 MST