Problem when doing area average....

From: Sabeerali(sebi) <sabeerl_at_nyahnyahspammersnyahnyah>
Date: Fri Feb 26 2010 - 00:24:11 MST

Hello ncl users,
I want to do the area average for NINO3(5S-5N, 160W-90W) and
NINO4(5S-5N,160E,150W) region.
My data is in time,lat,lon order..
when I use the following line for NINO3 area average
  NINO3=wgt_areaave(sstflt(:,{-5:5},{200:270}),1.0,1.0,0)
 I am getting the following error.

fatal:NclOneDValGetRangeIndex: start coordinate index out of range, can't
continue
fatal:Could not obtain coordinate indexes, unable to perform subscript
fatal:Execute: Error occurred at or near line 16 in file test.ncl

So I changed my script like as follows...
NINO3=wgt_areaave(sstflt(:,{-5:5},{-160:-90}),1.0,1.0,0)
Then I am getting NINO3 correctly.
But when I calculate for NINO4 as above i.e
.NINO4=wgt_areaave(sstflt(:,{-5:5},{160:-150}),1.0,1.0,0) it is not
averaging the desired region.It is averaging the other side(Not NINO4
region).
How I can found area average for NINO4 region..?
.
 The print VarSummary of 'lon' is given below....
Variable: lon
Type: float
Total Size: 1440 bytes
            360 values
Number of Dimensions: 1
Dimensions and sizes: [lon | 360]
Coordinates:
            lon: [-179.5..179.5]
Number Of Attributes: 4
  long_name : Longitude
  standard_name : longitude
  units : degrees_east
  actual_range : ( -179.5, 179.5 )

Also I am attaching the script ...

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
;**************************************************************
in2=addfile("/home/sebi/data/Had_sst/HadISST_sst.nc","r")
sstflt=in2->sst(1308:1667,:,:)
lon=in2->lon
printVarSummary(lon)
;**************************************************************
NINO3=wgt_areaave(sstflt(:,{-5:5},{-160:-90}),1.0,1.0,0)
; NINO3=wgt_areaave(sstflt(:,{-5:5},{200:270}),1.0,1.0,0)
NINO4=wgt_areaave(sstflt(:,{-5:5},{160:-150}),1.0,1.0,0)
;********************************************************
NINO3!0="time"
NINO4!0="time"
;*******************************************************
diro = "./"
filo = "aaveged_JJAS_Hadsst_anom_1979_08.nc"
system("/bin/rm -f "+diro+filo)
f_select = addfile(diro+filo, "c")
f_select->NINO3 = NINO3
f_select->NINO4 = NINO4
end

Thanks in advance...

-- 
**********************************
Sebi
Climate and Global Modeling Division
Indian Institute of Tropical Meteorology
Pashan, Pune, 411 008
****************************************

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 26 00:24:16 2010

This archive was generated by hypermail 2.1.8 : Mon Mar 01 2010 - 08:49:37 MST