Re: concatenation and data attributes

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 10 2012 - 15:12:24 MST

Hi Starry,

Well there is no way to have more than a single units attribute for an array. Even if you created an array units attribute I don't think any tools would understand it, because it is not compliant with any standard convention. NCL does not automatically handle the situation where each file in a series has its own time units string. I think the solution in this case requires you to modify the time data in order to make it all relative to a single time units value.

maybe something like (untested):

do i = 0, number_of_days
   start_ix = i * timesteps_per_day
   end_ix = start_ix + timesteps_per_day -1
   btime(start_ix:end_ix) = btime(start_ix:end_ix) + i * 86400
end do
; set coordinate info
btime&time = btime

 -dave

On Jan 10, 2012, at 9:04 AM, Manoharan, Vani Starry wrote:

> Hi,
>
> I am trying to plot times series of temperature data from multiple files (where each file is for one day - in my case 16th June 2011 to 30 June 2011) in a single time series plot. Each file has a time, temperature and various other parameters. So I concatenated all the files and read temperature as one data and time as the other as shown below.
>
> dir = "/fusion/home/vsmano/GVAX/CEILOMETER/DATA/"
> all_files = systemfunc ("ls " + dir + "pghvceil25kM1.b1.201106*.cdf")
> fili = addfiles (all_files, "r")
> ListSetType (fili, "cat")
> temp = fili[:]->Temperature
> btime = fili[:]->time
> btimeUnits = fili[:]->time@units
>
> The problem is the time data. For each day (each file) the time starts from approx at 00:00:00 (UTC) but is given in the format:
>
>
> Variable: btime
> Type: double
> Total Size: 528120 bytes
> 66015 values
> Number of Dimensions: 1
> Dimensions and sizes: [time | 66015]
> Coordinates:
> time: [68239..86398]
> Number Of Attributes: 2
> long_name : Time offset from midnight
> units : seconds since 2011-06-16 00:00:00 0:00
>
>
>
> So every day time starts around 0 seconds and goes till 86400 for that particular day. And the next day starts at around 0 again. please see below
>
> 0 <-- June 16, 2011
> 8
> 16
> .
> .
> .
> 86400
> 0 <--June 17, 2011
> 8
> 16
> 24
> .
> .
> .
>
>
> The concatenated time data always considers unit attributes of the first file only (in this case 16th june 2011 - seconds since 2011-06-16 00:00:00 0:00). I do not know how to include the attributes for each day (eg. seconds since 2011-06-17 00:00:00 0:00). Your help will be greatly appreciated.
>
> Thanks.
>
> Starry
>
> _______________________________________________
> 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 Tue Jan 10 15:12:35 2012

This archive was generated by hypermail 2.1.8 : Wed Jan 18 2012 - 09:21:55 MST