separating data set base on lat/lon

From: Setareh Rahimi <setareh.rahimi_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 30 2013 - 12:49:43 MDT

Dear all,

I am running codes to calculate standardised precipitation index (SPI). I
need to calculate it for each continent, so I should separate my data set
to different lat/lon. I am a new user of ncl and do not know how it is
possible to do so.If any one knows how can I separate the data set please
advice me to sort this issue out. Here is the codes I use.

Thank you in advance,
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

   f = addfile("hadgem2-es-rcp26-1981-2010-precip.nc","r")
   prc = f->preic
   yyyymm = f->time
   printVarSummary(prc)
   dimp = dimsizes(prc)
   ntim = dimp(0)
   nlat = dimp(1)
   mlon = dimp(2)

   len = (/3,6,12,24,36,48/)
   klen = dimsizes(len)
   spi = new((/klen,ntim,nlat,mlon/),float)

   do k=0,klen-1
      spi(k,:,:,:) = dim_spi_n(prc2, len(k), False, 0)
   end do

   print(yyyymm+sprintf("%8.2f", prc)\
               +sprintf("%8.2f", spi(0,:,:,:))+sprintf("%8.2f",
spi(1,:,:,:))\
               +sprintf("%8.2f", spi(2,:,:,:))+sprintf("%8.2f",
spi(3,:,:,:))\
               +sprintf("%8.2f", spi(4,:,:,:))+sprintf("%8.2f",
spi(5,:,:,:)))
end

-- 
S.Rahimi

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jul 30 12:49:52 2013

This archive was generated by hypermail 2.1.8 : Thu Aug 01 2013 - 15:55:03 MDT