Hi Carl,
Nice reply. I found the following solution working well:
timeUnits = "hours since 1-1-1 00:00:0.0"
filtStart = ut_inv_calendar( 1980, 01, 01, 00, 0, 0, timeUnits, 0 )
filtEnd = ut_inv_calendar( 2000, 12, 31, 00, 0, 0, timeUnits, 0 )
inStart = filtStart + 192 * 24
inEnd = filtEnd - 192 * 24
time = fin->time({inStart:inEnd}) lat = fin->lat
lon = fin->lon
data = short2flt(fin->$varName$({inStart:inEnd},:,:))
for new data, I calculated nt as:
maxDate =inEnd
minDate =inStart
nt = 1 + round(maxDate - minDate, 3 )/24
This works well, hopefully it will be correct.
Best regards,
JuKy
________________________________
From: Carl Schreck <carl_at_cicsnc.org>
To: juki juki <juky_emc2_at_yahoo.com>
Cc: NCL Talk <ncl-talk_at_ucar.edu>
Sent: Monday, June 25, 2012 9:29 PM
Subject: Re: subscript time coordinate of OLR data
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_at_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_at_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 19:09:26 2012
This archive was generated by hypermail 2.1.8 : Fri Jun 29 2012 - 15:46:14 MDT