Re: making JJA without using month_to_season function

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 04 2011 - 14:27:36 MDT

Sorry ... Untested!

On 10/4/11 1:48 PM, Dennis Shea wrote:
   f = addfile(...)
   prect = f->PRECT ; (time,lat,lon)
   dimp = dimsizes(prect)
   ntim = dimp(0)
   nlat = dimp(1)
   mlon = dimp(2)

   TIME = cd_calendar(prect&time, 0)
   yrStrt = TIME(0,0)
   yrLast = TIME(ntim-1,0)
   nyrs = yrLast-yrStrt+1

   prect_jja = new ( (/nyrs,nlat,mlon/), "float", "No_FillValue")
   nStrt = 1 ; start June
   nLast = 3 ; end in August

   do nyr=0,nyrs-1
      prect_jja(nyr,:,:) = dim_avg_n(prect(nStrt:nLast,:,:),0))
      nStrt = nStrt+5
      nLast = nStrt+2
   end do

On 10/4/11 1:57 PM, Siraj ul Islam wrote:
> Hi Dennis,
>
> I think the email you sent is truncated or incomplete.
>
> Siraj
>
>
> On Tue, Oct 4, 2011 at 12:48 PM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>> wrote:
>
> yrStrt = 2000
> yrLast = 2009
> nyrs = yrLast-yrStrt+1
>
> ; Method 1
>
> prect_jja = new ( nyrs, "float", "No_FillValue")
>
> prect = f->PRECT
>
>
>
>
> On 10/4/11 1:38 PM, Siraj ul Islam wrote:
>
> Hi all,
>
> This may be a very easy question. I have a ten year monthly data
> file
> and for each year there are only 5 months (May, June, July,
> August and
> Sep.) data. In total my 10 year data has (10 x 5) 50 months. Now
> I want
> to analyze JJA season each year. As all the built in functions
> (*clmMonLLT*, month_to_season) in NCL need 12 months data file (time
>
> dimension must be a multiple of 12) and therefore I cannot use
> them for
> my data. Is there any other way to average out JJA each year or to
> calculate climatology for each month?
>
> here is the ncdump out put for my file.
>
>
> netcdf cam4_dsp_may_2000_2009 {
> dimensions:
> lat = 96 ;
> lon = 144 ;
> time = UNLIMITED ; // (50 currently)
> variables:
> double lat(lat) ;
> lat:long_name = "latitude" ;
> lat:units = "degrees_north" ;
> double lon(lon) ;
> lon:long_name = "longitude" ;
> lon:units = "degrees_east" ;
> double time(time) ;
> time:long_name = "time" ;
> time:units = "days since 2000-05-01 00:00:00" ;
> time:calendar = "noleap" ;
> time:bounds = "time_bnds" ;
> float PRECT(time, lat, lon) ;
> PRECT:units = "m/s" ;
> PRECT:long_name = "Total (convective and large-scale)
> precipitation rate (liq + ice)" ;
> PRECT:cell_methods = "time: mean" ;
> float PS(time, lat, lon) ;
> PS:units = "Pa" ;
> PS:long_name = "Surface pressure" ;
> PS:cell_methods = "time: mean" ;
> float TREFHT(time, lat, lon) ;
> TREFHT:units = "K" ;
> TREFHT:long_name = "Reference height temperature" ;
> TREFHT:cell_methods = "time: mean" ;
> float U200(time, lat, lon) ;
> U200:units = "m/s" ;
> U200:long_name = "Zonal wind at 200 mbar pressure
> surface" ;
> U200:cell_methods = "time: mean" ;
> float U850(time, lat, lon) ;
> U850:units = "m/s" ;
> U850:long_name = "Zonal wind at 850 mbar pressure
> surface" ;
> U850:cell_methods = "time: mean" ;
> float V200(time, lat, lon) ;
> V200:units = "m/s" ;
> V200:long_name = "Meridional wind at 200 mbar pressure
> surface" ;
> V200:cell_methods = "time: mean" ;
> float V850(time, lat, lon) ;
> V850:units = "m/s" ;
> V850:long_name = "Meridional wind at 850 mbar pressure
> surface" ;
> V850:cell_methods = "time: mean" ;
> float Z500(time, lat, lon) ;
> Z500:units = "m" ;
> Z500:long_name = "Geopotential Z at 500 mbar pressure
> surface" ;
> Z500:cell_methods = "time: mean" ;
>
> // global attributes:
> :Conventions = "CF-1.0" ;
> :source = "CAM" ;
> :case = "fv1.9x2.5_2000_05" ;
> :title = ;
> :logname = "siraj" ;
> :host = "b158" ;
> :Version = "$Name$" ;
> :revision_Id = "$Id$" ;
> :initial_file =
> "/home/siraj/ccsm4_working___copy/inputdata/2000/May/cam___initial_day01_00Z.nc"
> ;
> :topography_file =
> "/home/siraj/ccsm4_working___copy/inputdata/atm/cam/topo/US__GS-gtopo30_1.9x2.5_remap___c050602.nc
> <http://USGS-gtopo30_1.9x2.5_remap_c050602.nc>
> <http://USGS-gtopo30_1.9x2.5___remap_c050602.nc
> <http://USGS-gtopo30_1.9x2.5_remap_c050602.nc>>" ;
>
> :history = "Wed Sep 21 15:55:24 2011: ncrcat
> fv1.9x2.5_2000_05.cam2.h0.__2000-05.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-05.nc>
> <http://fv1.9x2.5_2000_05.__cam2.h0.2000-05.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-05.nc>>
> fv1.9x2.5_2000_05.cam2.h0.__2000-06.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-06.nc>
> <http://fv1.9x2.5_2000_05.__cam2.h0.2000-06.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-06.nc>>
> fv1.9x2.5_2000_05.cam2.h0.__2000-07.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-07.nc>
> <http://fv1.9x2.5_2000_05.__cam2.h0.2000-07.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-07.nc>>
> fv1.9x2.5_2000_05.cam2.h0.__2000-08.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-08.nc>
> <http://fv1.9x2.5_2000_05.__cam2.h0.2000-08.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-08.nc>>
> fv1.9x2.5_2000_05.cam2.h0.__2000-09.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-09.nc>
> <http://fv1.9x2.5_2000_05.__cam2.h0.2000-09.nc
> <http://fv1.9x2.5_2000_05.cam2.h0.2000-09.nc>>
> fv1.9x2.5_2001_05.cam2.h0.__2001-05.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-05.nc>
> <http://fv1.9x2.5_2001_05.__cam2.h0.2001-05.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-05.nc>>
> fv1.9x2.5_2001_05.cam2.h0.__2001-06.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-06.nc>
> <http://fv1.9x2.5_2001_05.__cam2.h0.2001-06.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-06.nc>>
> fv1.9x2.5_2001_05.cam2.h0.__2001-07.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-07.nc>
> <http://fv1.9x2.5_2001_05.__cam2.h0.2001-07.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-07.nc>>
> fv1.9x2.5_2001_05.cam2.h0.__2001-08.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-08.nc>
> <http://fv1.9x2.5_2001_05.__cam2.h0.2001-08.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-08.nc>>
> fv1.9x2.5_2001_05.cam2.h0.__2001-09.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-09.nc>
> <http://fv1.9x2.5_2001_05.__cam2.h0.2001-09.nc
> <http://fv1.9x2.5_2001_05.cam2.h0.2001-09.nc>>
> fv1.9x2.5_2002_05.cam2.h0.__2002-05.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-05.nc>
> <http://fv1.9x2.5_2002_05.__cam2.h0.2002-05.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-05.nc>>
> fv1.9x2.5_2002_05.cam2.h0.__2002-06.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-06.nc>
> <http://fv1.9x2.5_2002_05.__cam2.h0.2002-06.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-06.nc>>
> fv1.9x2.5_2002_05.cam2.h0.__2002-07.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-07.nc>
> <http://fv1.9x2.5_2002_05.__cam2.h0.2002-07.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-07.nc>>
> fv1.9x2.5_2002_05.cam2.h0.__2002-08.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-08.nc>
> <http://fv1.9x2.5_2002_05.__cam2.h0.2002-08.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-08.nc>>
> fv1.9x2.5_2002_05.cam2.h0.__2002-09.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-09.nc>
> <http://fv1.9x2.5_2002_05.__cam2.h0.2002-09.nc
> <http://fv1.9x2.5_2002_05.cam2.h0.2002-09.nc>>
> fv1.9x2.5_2003_05.cam2.h0.__2003-05.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-05.nc>
> <http://fv1.9x2.5_2003_05.__cam2.h0.2003-05.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-05.nc>>
> fv1.9x2.5_2003_05.cam2.h0.__2003-06.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-06.nc>
> <http://fv1.9x2.5_2003_05.__cam2.h0.2003-06.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-06.nc>>
> fv1.9x2.5_2003_05.cam2.h0.__2003-07.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-07.nc>
> <http://fv1.9x2.5_2003_05.__cam2.h0.2003-07.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-07.nc>>
> fv1.9x2.5_2003_05.cam2.h0.__2003-08.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-08.nc>
> <http://fv1.9x2.5_2003_05.__cam2.h0.2003-08.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-08.nc>>
> fv1.9x2.5_2003_05.cam2.h0.__2003-09.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-09.nc>
> <http://fv1.9x2.5_2003_05.__cam2.h0.2003-09.nc
> <http://fv1.9x2.5_2003_05.cam2.h0.2003-09.nc>>
> fv1.9x2.5_2004_05.cam2.h0.__2004-05.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-05.nc>
> <http://fv1.9x2.5_2004_05.__cam2.h0.2004-05.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-05.nc>>
> fv1.9x2.5_2004_05.cam2.h0.__2004-06.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-06.nc>
> <http://fv1.9x2.5_2004_05.__cam2.h0.2004-06.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-06.nc>>
> fv1.9x2.5_2004_05.cam2.h0.__2004-07.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-07.nc>
> <http://fv1.9x2.5_2004_05.__cam2.h0.2004-07.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-07.nc>>
> fv1.9x2.5_2004_05.cam2.h0.__2004-08.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-08.nc>
> <http://fv1.9x2.5_2004_05.__cam2.h0.2004-08.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-08.nc>>
> fv1.9x2.5_2004_05.cam2.h0.__2004-09.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-09.nc>
> <http://fv1.9x2.5_2004_05.__cam2.h0.2004-09.nc
> <http://fv1.9x2.5_2004_05.cam2.h0.2004-09.nc>>
> fv1.9x2.5_2005_05.cam2.h0.__2005-05.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-05.nc>
> <http://fv1.9x2.5_2005_05.__cam2.h0.2005-05.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-05.nc>>
> fv1.9x2.5_2005_05.cam2.h0.__2005-06.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-06.nc>
> <http://fv1.9x2.5_2005_05.__cam2.h0.2005-06.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-06.nc>>
> fv1.9x2.5_2005_05.cam2.h0.__2005-07.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-07.nc>
> <http://fv1.9x2.5_2005_05.__cam2.h0.2005-07.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-07.nc>>
> fv1.9x2.5_2005_05.cam2.h0.__2005-08.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-08.nc>
> <http://fv1.9x2.5_2005_05.__cam2.h0.2005-08.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-08.nc>>
> fv1.9x2.5_2005_05.cam2.h0.__2005-09.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-09.nc>
> <http://fv1.9x2.5_2005_05.__cam2.h0.2005-09.nc
> <http://fv1.9x2.5_2005_05.cam2.h0.2005-09.nc>>
> fv1.9x2.5_2006_05.cam2.h0.__2006-05.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-05.nc>
> <http://fv1.9x2.5_2006_05.__cam2.h0.2006-05.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-05.nc>>
> fv1.9x2.5_2006_05.cam2.h0.__2006-06.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-06.nc>
> <http://fv1.9x2.5_2006_05.__cam2.h0.2006-06.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-06.nc>>
> fv1.9x2.5_2006_05.cam2.h0.__2006-07.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-07.nc>
> <http://fv1.9x2.5_2006_05.__cam2.h0.2006-07.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-07.nc>>
> fv1.9x2.5_2006_05.cam2.h0.__2006-08.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-08.nc>
> <http://fv1.9x2.5_2006_05.__cam2.h0.2006-08.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-08.nc>>
> fv1.9x2.5_2006_05.cam2.h0.__2006-09.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-09.nc>
> <http://fv1.9x2.5_2006_05.__cam2.h0.2006-09.nc
> <http://fv1.9x2.5_2006_05.cam2.h0.2006-09.nc>>
> fv1.9x2.5_2007_05.cam2.h0.__2007-05.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-05.nc>
> <http://fv1.9x2.5_2007_05.__cam2.h0.2007-05.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-05.nc>>
> fv1.9x2.5_2007_05.cam2.h0.__2007-06.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-06.nc>
> <http://fv1.9x2.5_2007_05.__cam2.h0.2007-06.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-06.nc>>
> fv1.9x2.5_2007_05.cam2.h0.__2007-07.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-07.nc>
> <http://fv1.9x2.5_2007_05.__cam2.h0.2007-07.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-07.nc>>
> fv1.9x2.5_2007_05.cam2.h0.__2007-08.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-08.nc>
> <http://fv1.9x2.5_2007_05.__cam2.h0.2007-08.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-08.nc>>
> fv1.9x2.5_2007_05.cam2.h0.__2007-09.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-09.nc>
> <http://fv1.9x2.5_2007_05.__cam2.h0.2007-09.nc
> <http://fv1.9x2.5_2007_05.cam2.h0.2007-09.nc>>
> fv1.9x2.5_2008_05.cam2.h0.__2008-05.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-05.nc>
> <http://fv1.9x2.5_2008_05.__cam2.h0.2008-05.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-05.nc>>
> fv1.9x2.5_2008_05.cam2.h0.__2008-06.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-06.nc>
> <http://fv1.9x2.5_2008_05.__cam2.h0.2008-06.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-06.nc>>
> fv1.9x2.5_2008_05.cam2.h0.__2008-07.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-07.nc>
> <http://fv1.9x2.5_2008_05.__cam2.h0.2008-07.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-07.nc>>
> fv1.9x2.5_2008_05.cam2.h0.__2008-08.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-08.nc>
> <http://fv1.9x2.5_2008_05.__cam2.h0.2008-08.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-08.nc>>
> fv1.9x2.5_2008_05.cam2.h0.__2008-09.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-09.nc>
> <http://fv1.9x2.5_2008_05.__cam2.h0.2008-09.nc
> <http://fv1.9x2.5_2008_05.cam2.h0.2008-09.nc>>
> fv1.9x2.5_2009_05.cam2.h0.__2009-05.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-05.nc>
> <http://fv1.9x2.5_2009_05.__cam2.h0.2009-05.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-05.nc>>
> fv1.9x2.5_2009_05.cam2.h0.__2009-06.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-06.nc>
> <http://fv1.9x2.5_2009_05.__cam2.h0.2009-06.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-06.nc>>
> fv1.9x2.5_2009_05.cam2.h0.__2009-07.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-07.nc>
> <http://fv1.9x2.5_2009_05.__cam2.h0.2009-07.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-07.nc>>
> fv1.9x2.5_2009_05.cam2.h0.__2009-08.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-08.nc>
> <http://fv1.9x2.5_2009_05.__cam2.h0.2009-08.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-08.nc>>
> fv1.9x2.5_2009_05.cam2.h0.__2009-09.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-09.nc>
> <http://fv1.9x2.5_2009_05.__cam2.h0.2009-09.nc
> <http://fv1.9x2.5_2009_05.cam2.h0.2009-09.nc>> -v
> TREFHT,PS,PRECT,V200,U200,__V850,U850,Z500
> cam4_dsp_may_2000_2009.nc <http://cam4_dsp_may_2000_2009.nc>
> <http://cam4_dsp_may_2000___2009.nc
> <http://cam4_dsp_may_2000_2009.nc>>" ;
>
> :nco_openmp_thread_number = 1 ;
> }
>
>
> --
> Siraj Ul Islam
>
>
>
>
>
>
> _________________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/__mailman/listinfo/ncl-talk
> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
>
>
> --
> Siraj Ul Islam
>
> PhD student / Research Assistant
> Environmental Science and Engineering,
> University of Northern British Columbia,
> Prince George, BC, Canada
>
>
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Oct 4 14:27:46 2011

This archive was generated by hypermail 2.1.8 : Sun Oct 09 2011 - 13:05:26 MDT