[Thread Prev][Thread Next][Index]

Re: [ferret_users] Simple line plot



Hi Luke,
Yes, you are almost there. You have variables with the date, in units of days, and time in hours, so all you need is to define a time axis and put your variables onto that axis.  This FAQ should give you an example -

http://ferret.pmel.noaa.gov/Ferret/faq/creating-a-time-axis-from-time-variables

The example in the FAQ starts with individual variables year, month, day, etc, but the cases are very similar.  The units of the date variable as read in by the FILE/FORMAT=DELIMITED command determine the time axis units. In your case, after opening the file,
yes? let tstep = date + time/24.

! Define a time axis, ttaxis, from variable tstep
yes? DEFINE axis/T/T0=1-jan-1900/UNIT=days ttaxis=tstep

yes? let dummy = t[gt=ttaxis]
yes? let var1 = RESHAPE(param1, dummy)


On 11/14/2013 6:11 PM, Luke M wrote:
Dear Ferret users

I'm trying to make a simple line plot from an ASCII file. I think I am almost there, but I can't figure out how to proceed. My ascii file is called "data1.asc" and contains:

A1 11/1/2013 00:05:00 20 74
A2 11/1/2013 05:05:00 21 59
A3 11/1/2013 10:05:00 20 78
A4 11/4/2013 15:05:00 22 102
A5 11/9/2013 06:05:00 26 77
A6 11/12/2013 22:05:00 30 84

Each column represents:
line_#, date, time(hh:mm:ss), param1, param2


To read the file into Ferret:
yes? SET DATA/FORMAT=DELIMITED/delim=" "/var="linenum,date,time,param1,param2"/type="text,date,time,num,num"/col=5 data1.asc


And if I do a listing on the variables, all looks good:
yes? list date
             VARIABLE : DATE (days)
                        Julian days since 1-Jan-1900
             FILENAME : data1.asc
             SUBSET   : 6 points (X)
 1   / 1:  41577.
 2   / 2:  41577.
 3   / 3:  41577.
 4   / 4:  41580.
 5   / 5:  41585.
 6   / 6:  41588.
yes? list time
             VARIABLE : TIME (hours)
                        Time of day
             FILENAME : data1.asc
             SUBSET   : 6 points (X)
 1   / 1:   0.08
 2   / 2:   5.08
 3   / 3:  10.08
 4   / 4:  15.08
 5   / 5:   6.08
 6   / 6:  22.08
yes? list param1
             VARIABLE : PARAM1
             FILENAME : data1.asc
             SUBSET   : 6 points (X)
 1   / 1:  20.00
 2   / 2:  21.00
 3   / 3:  20.00
 4   / 4:  22.00
 5   / 5:  26.00
 6   / 6:  30.00


However... how can I do to make a line plot that would plot param1 (y-axis) as a function of time (both date & time) (x-axis)?

Thanks!





[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement