Re: subscript time coordinate of OLR data

From: Carl Schreck <carl_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 25 2012 - 06:29:04 MDT

Hi Jouky,

If you run ncl_filedump on olr.day.mean.nc, it should show you the correct
timeUnits:

---
      double time ( time )
*         units : hours since 1-1-1 00:00:0.0*
         long_name : Time
         actual_range : ( 17298624, 17631720 )
         delta_t : 0000-00-01 00:00:00
         standard_name : time
         axis : T
---
So in this case you will have to modify the other snippet of code to
account for the times being in hours instead of days:
  nt = 1 + round( *24 ** ( maxDate - minDate ), 3 )
Hope this helps!
    Carl
On Mon, Jun 25, 2012 at 3:21 AM, juki juki <juky_emc2@yahoo.com> wrote:
> Dear All ncl users,
>
> I need your help for subscripting the time coordinate of OLR data. For
> example, I want to subscript the following time:
>
>   timeUnits = "days since 1800-01-01 00:00:00"
>   inStart   = ut_inv_calendar( 1980, 01, 01, 00, 0, 0, timeUnits, 0 )
>   inEnd     = ut_inv_calendar( 2000, 12, 31, 00, 0, 0, timeUnits, 0 )
>
>   varName  = "olr"
>
>   pathIn   = "olr.day.mean.nc"
>
>   ;; Open the input files
>   fin  = addfile( pathIn, "r" )
>   time = fin->time({inStart:inEnd})
>   lat  = fin->lat
>   lon  = fin->lon
>
>   data = short2flt(fin->$varName$({inStart:inEnd},:,:))
>
>  -----------------
> With this subscripting technique, I got error "subcript out of range. The
> error is due to value of inStart and inEnd being not the same as one of
> value of time. I try to use another timeunits for example, timeUnits =
> "hours since 1-1-1 00:00:0.0", I can read the data but when making another
> process for example:
>
>   maxDate =inEnd
>   minDate =inStart
>
>   nx = 144
>   nt = 1 + round( maxDate - minDate, 3 )
>   nVar = 1; suppose only 1
>
>   datax   = new( (/ nVar, nt, nx /), float )
>   datax!0 = "var"
>   datax!1 = "time"
>   datax!2 = "lon"
>
>   datax(0,:,:) = dim_avg_n(data, 1 )
>
> I got error again because number of row of datax and data is not the same
> in which value of maxDate - minDate with timeUnits = "hours since 1-1-1
> 00:00:0.0" is much bigger than total number of row of OLR data. THUS, how
> to subscript the time coordinate of OLR data ? What time unit must be used ?
>
> Thanks for help,
>
> Regards,
> Jouky
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-- 
Carl J. Schreck III, PhD
Postdoctoral Research Associate
Cooperative Institute for Climate and Satellites (CICS-NC)
North Carolina State University and NOAA's National Climatic Data Center
151 Patton Avenue
Asheville, NC 28801
Tel: 828-257-3140
carl@cicsnc.org
http://monitor.cicsnc.org/mjo/
http://www.atmos.albany.edu/student/carl/

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 25 06:29:40 2012

This archive was generated by hypermail 2.1.8 : Mon Jun 25 2012 - 09:57:23 MDT