[Thread Prev][Thread Next][Index]

Re: [ferret_users] Time Series Plot with Dates on x-axis



Hi,
So, if I understand the formatting of your file,  the tabs in your file appear after .hdf, and before and after GISS, but not between the date and time. Is that correct?  If you also had a tab between the date and time, then Ferret could detect the date and time fields automatically, and you would read  5 variables:

yes? set data/form=delim/skip=1 "SampleAscii.csv"

yes? show data 
     currently SET data sets:
    1> ./delim.dat  (default)
 name     title                             I         J         K         L
 V1       V1                               1:20480   ...       ...       ...
 V2       V2                               1:20480   ...       ...       ...
       (Julian days since 1-Jan-1900)
 V3       V3                               1:20480   ...       ...       ...
       (Time of day)
 V4       V4                               1:20480   ...       ...       ...
 V5       V5                               1:20480   ...       ...       ...
 
yes? list v2,v3
             DATA SET: ./delim.dat
             X: 0.5 to 29.5
 Column  1: V2 is V2 (days)(Julian days since 1-Jan-1900)
 Column  2: V3 is V3 (hours)(Time of day)
               V2    V3
1    /  1:  39081.  15.00
2    /  2:  39081.  16.58
3    /  3:  39082.  15.67
4    /  4:  39083.  16.42
5    /  5:  39084.  15.50
6    /  6:  39085.  16.25
7    /  7:  39086.  15.33
8    /  8:  39087.  16.00
9    /  9:  39088.  15.08
10   / 10:  39088.  16.75
11   / 11:  39089.  15.83


Then, you could use the ideas in this FAQ, Creating a  time axis from time variableshttp://ferret.pmel.noaa.gov/FERRET_17sep07/FAQ/axes_and_data/time_axis_from_variables.html  to make a time axis from variables v2 and v3, and then put the variable in the last column onto that axis.

Otherwise if you leave the contents of V2 as "yyyy-mm-dd hh:mm:ss"  I guess you could use use string functions  (SUBSTRING and STRFLOAT) to break up V2 into separate variables containing the year, month, day, hour, etc. and  then use those to create a time axis. v2 is a string variable, so you can break it up with SUBSTRING. But you want numeric variables to create the axis from, so use STRFLOAT to convert the strings to floating-point data This would go like this:

yes? let var_yr = STRFLOAT( SUBSTRING(v2, 1, 4) )
yes? let var_mo =
STRFLOAT( SUBSTRING(v2, 6, 2) )
yes? let var_da = ...
yes? let var_hr = ...
 
etc. And you can still use the ideas in that FAQ to make the time axis.


ag wrote:
Dear Ferretters:

I am reading the following tab-delimited ASCII file using the simple ferret command:
SET DATA/FORM=DELIM/SKIP=1 /VAR="v1,v2,v3,v4" "SampleAscii.csv"
----------------------------------------------------------------------------------------------------------------
MOD04_L2.A2007001.1500.005.2007003093108.hdf  2007-01-01 15:00:00 GISS
MOD04_L2.A2007001.1635.005.2007003093604.hdf  2007-01-01 16:35:00 GISS
MOD04_L2.A2007002.1540.005.2007004182338.hdf  2007-01-02 15:40:00 GISS 0.081
MOD04_L2.A2007003.1625.005.2007005151340.hdf  2007-01-03 16:25:00 GISS 0.027
MOD04_L2.A2007004.1530.005.2007007055054.hdf  2007-01-04 15:30:00 GISS
 MOD04_L2.A2007005.1615.005.2007008173325.hdf  2007-01-05 16:15:00 GISS
MOD04_L2.A2007006.1520.005.2007010020024.hdf  2007-01-06 15:20:00 GISS
MOD04_L2.A2007007.1600.005.2007012202039.hdf  2007-01-07 16:00:00 GISS 0.167
MOD04_L2.A2007008.1505.005.2007012223915.hdf  2007-01-08 15:05:00 GISS
MOD04_L2.A2007008.1645.005.2007012225717.hdf  2007-01-08 16:45:00 GISS
MOD04_L2.A2007009.1550.005.2007013005323.hdf  2007-01-09 15:50:00 GISS
MOD04_L2.A2007010.1630.005.2007013053221.hdf  2007-01-10 16:30:00 GISS 0.039
MOD04_L2.A2007011.1535.005.2007014063943.hdf  2007-01-11 15:35:00 GISS 0.113
MOD04_L2.A2007012.1620.005.2007014045513.hdf  2007-01-12 16:20:00 GISS
MOD04_L2.A2007013.1525.005.2007015044928.hdf  2007-01-13 15:25:00 GISS
MOD04_L2.A2007014.1605.005.2007017161152.hdf  2007-01-14 16:05:00 GISS
MOD04_L2.A2007015.1510.005.2007017183912.hdf  2007-01-15 15:10:00 GISS
 MOD04_L2.A2007016.1555.005.2007018180305.hdf 2007-01-16 15:55:00 GISS
MOD04_L2.A2007017.1500.005.2007019123555.hdf  2007-01-17 15:00:00 GISS 0.000
MOD04_L2.A2007017.1635.005.2007019125327.hdf  2007-01-17 16:35:00 GISS 0.028
MOD04_L2.A2007018.1540.005.2007020111006.hdf  2007-01-18 15:40:00 GISS 0.126
MOD04_L2.A2007018.1545.005.2007020105940.hdf  2007-01-18 15:45:00 GISS
MOD04_L2.A2007019.1625.005.2007023060629.hdf  2007-01-19 16:25:00 GISS
 MOD04_L2.A2007020.1530.005.2007023002013.hdf 2007-01-20 15:30:00 GISS
MOD04_L2.A2007021.1615.005.2007023181352.hdf  2007-01-21 16:15:00 GISS
MOD04_L2.A2007022.1520.005.2007024120208.hdf  2007-01-22 15:20:00 GISS
MOD04_L2.A2007023.1600.005.2007024194356.hdf  2007-01-23 16:00:00 GISS 0.136
MOD04_L2.A2007024.1505.005.2007027011552.hdf  2007-01-24 15:05:00 GISS 0.095
MOD04_L2.A2007024.1645.005.2007027010315.hdf  2007-01-24 16:45:00 GISS 0.086
-----------------------------
I would like to make a Time series plot with Time on the x-axis based on values from Column 2 above (which is being read as a character string) and the dependent variable from Column 4 above. I am able to make a simple plot with index(record) number on x-axis but am at a loss to figure out how to convert the Column 2 character string so that Ferret will interpret is as a time stamp.

Any pointers are greatly appreciated.

Thanks in advance
agdc2005

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement