[ncl-talk] problem in SPI code

HAVENER, KEVIN F GS-12 USAF ACC 14 WS/WXED kevin.havener at us.af.mil
Tue Jul 21 11:10:07 MDT 2015


Was that a cut and paste error, or are you actually missing a parenthesis on the "spi = new((" line?

Kevin Havener

-----Original Message-----
From: ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu] On Behalf Of Raja Sivaranjan
Sent: Tuesday, July 21, 2015 11:58 AM
To: ncl-talk at ucar.edu
Subject: [ncl-talk] problem in SPI code

Dear all,


i'm trying to calculate spi for aphrodite from 1951 to 2007 using dim_spi_n function. I'm not successfull, below is the code and error:

f      = addfile("/home/ponraj/Desktop/aphrodite_mon.nc","r")
prc    = f->precip                    
printVarSummary(prc)

dimp   = dimsizes(prc)              ; # monthly precipitation values
ntim   = dimp(0)
nlat   = dimp(1)
mlon   = dimp(2)

len    = (/3, 6, 12/)
klen   =  dimsizes(len)
spi    =  new((/klen,ntim,nlat,mlon/) ,float,prc at _FillValue
opt    = False

do k=0,klen-1
   spi(k,:,:,:) = dim_spi_n(prc, len(k), opt, 0) end do


error:

fatal:Undefined identifier: (spi) is undefined, can't continue
fatal:["Execute.c":8126]:Execute: Error occurred at or near line 33


And also i want to save this spi array in netcdf file. i'm not familiar with netcdf file writing in ncl. i kindly request you to sort out the above problem.


Thanks in advance

Rajasivaranjan




More information about the ncl-talk mailing list