Your approach looks fine.
What you may think about doing is combining a few steps to reduce memory:
sst= short2flt( in2->sst )
average = (SSTA_1983_JJAS+SSTA_1990_JJAS+SSTA_1999_JJAS+SSTA_2004_JJAS)/4
average_at_long_name = "JJAS: 1983,1990,1999,2004" ; optional
average_at_units = sst_at_units ; optional
copy_VarCoords( sst(0,:,:), average ) ; for netCDF or plotting
printVarSummary( average )
printMinMax(average, True)
In addition, using "dim_avg_Wrap" will help to preserve meta data, which
is useful for netCDF output or plotting. If you have version 5.1.1, you
should try using dim_avg_n_Wrap, which allows you to average without
dimension reordering.
Jess
Sabeerali(sebi) wrote:
> Hello,
>
> I have taken monthly sst from 1983-2005 and calculated
> monthly sst anomaly...From the total sst anomaly(i.e from 1983-2005) I
> selected 4 years(1983,1990,1999,2004) and found the average of JJAS...So
> I got 4 variables of dimension (lat=89,lon=180) (SSTA_1983_JJAS,
> SSTA_1990_JJAS, SSTA_1999_JJAS, SSTA_2004_JJAS)..I want to find the
> composite of these 4 variables..
> The given method is valid or not...
> sum= SSTA_1983_JJAS+SSTA_1990_JJAS+
> SSTA_1999_JJAS+SSTA_2004_JJAS
> average=sum/4
>
> .Any help would be appreciable...Here 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("mn_sst_1983-05.nc <http://mn_sst_1983-05.nc/>","r")
> sst=in2->sst
> sstflt=short2flt(sst)
> ;printVarSummary(sst)
> mn_clim_sst=clmMonTLL(sstflt)
> ;printVarSummary(mn_clim_sst)
> ;printVarSummary(mn_clim_sst)
> Mon_sst_anom=calcMonAnomTLL(sstflt,mn_clim_sst)
> ;*****************************************************
> SSTA_1983=Mon_sst_anom(0:11,:,:)
> SSTA_1983_JJAS=dim_avg(SSTA_1983(lat|:,lon|:,time|5:8))
> ;**************************************************
> SSTA_1990=Mon_sst_anom(84:95,:,:)
> SSTA_1990_JJAS=dim_avg(SSTA_1990(lat|:,lon|:,time|5:8))
> ;**************************************************
> SSTA_1999=Mon_sst_anom(192:203,:,:)
> SSTA_1999_JJAS=dim_avg(SSTA_1999(lat|:,lon|:,time|5:8))
> ;********************************************************
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- ********************************************************* Jessica N. Mackaro Climate Analysis Section Climate and Global Dynamics Division National Center for Atmospheric Research P.O. Box 3000 Boulder, CO 80307 tel: 303-497-1305 fax: 303-497-1333 email: jnpaxton_at_ucar.edu ********************************************************* _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Wed Aug 26 2009 - 11:18:55 MDT
This archive was generated by hypermail 2.2.0 : Wed Sep 02 2009 - 12:24:39 MDT