Re: Problem when doing area average....

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri Feb 26 2010 - 15:44:32 MST

Hi Sebi,
You should always look at your data before starting to analyze it. If you
look at your printVarSummary, you can see that the longitudes go from
-180:180. On your first area-average attempt, you referred to an area from
200:270E, outside your range of longitude values. (Hence the error
message.) The Nino3 region is entirely within your range of longitudes
when you specify it from -160:-90.

In order to calculate the Nino4 region, you need to flip the longitudes of
your data. The easiest way to do this is to use the function lonFlip:
http://www.ncl.ucar.edu/Document/Functions/Contributed/lonFlip.shtml

Finally, it is good practice to use cosine or gaussian weighting when
doing an area average. See example 1 of the wgt_areaave page here:
http://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml
Good luck,
Adam

> 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
>

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

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