Re: Relating variables to time

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu, 15 Jun 2006 10:02:02 -0600

Hi Kyle,

If you haven't gone to this page already, take a look:

http://www.ncl.ucar.edu/Applications/method_2.shtml

Looking at your .nc output, I believe that winddirection and degree are
1D timeseries dimensioned the same size as time, correct? If so, then
the following should do what you want:

dimNames = "time"
dimSizes = -1
dimUnlim = True
filedimdef(out,dimNames,dimSizes,dimUnlim)

filevardef(out, "time" ,typeof(time),"time")
filevardef(out, "winddirection" ,typeof(winddirection),"time")

filevardef(out, "degree" ,typeof(degree),"time")

filevarattdef(out,"winddirection",winddirection)
filevarattdef(out,"time",time) ; define time attributes
filevarattdef(out,"degree",degree)

out->time=(/time/)
out->winddirection=(/winddirection/)
out->degree=(/degree/)

If I am totally wrong about what you want here let me know. Good luck.
Adam

Kyle Wilcox wrote:
> First post
>
> I have an ascii file that I need to parse into a netCDF. This is an
> example of how I define my variables:
>
> File = asciiread(filename, -1,"string")
> Data = stringtochar(File)
> time = stringtodouble(charactertostring(Data(:,8:17)))
> winddirection = stringtofloat(charactertostring(Data(:,26:31)))
> degree = stringtofloat(charactertostring(Data(:,40:45)))
>
> Now I write the variables like this (after all the attributes are
> written with filevatattdef):
>
> out->time=(/time/)
> out->winddirection=(/winddirection/)
> out->degree=(/degree/)
>
> My questions is, how can I get the variables to recognize that they are
> based on the time variable? Do I have to define the dimensions
> differently? As of now all variables come up with the same size
> dimension. I only ask because I see examples online
> (http://ccmp.chesapeake.org/twiki/bin/view/CcmpWiki/CbosWavefile) where
> a time series variable is defined as "float (time,variable)" in the
> netCDF .cdl representation. For example:
> double time(time) ;
> time:calendar = "standard" ;
> time:standard_name = "time" ;
> time:long_name = "time" ;
> time:units = "seconds since 19070-1-1 0:0:0" ;
> float degree(ncl2) ;
> degk:units = "Degrees Kelvin" ;
> degk:long_name = "Degrees Kelvin" ;
> float winddirection(ncl3) ;
> wdir:units = "degrees" ;
> wdir:standard_name = "wind_to_direction" ;
> wdir:long_name = "wind direction" ;
>
>
> I guess im basically asking how to get (time,degree) and
> (time,winddirection) in place of ncl2 and ncl3.
>
> Thanks in advance for any help.
>
> Kyle
> kyle.wilcox_at_noaa.gov
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 15 2006 - 10:02:02 MDT

This archive was generated by hypermail 2.2.0 : Fri Jun 16 2006 - 13:51:09 MDT