[Thread Prev][Thread Next][Index]

Re: Fwd: [ferret_users] Time Series Plot with variability



Hi Ag,
There are some peculiarities involving time axes.  Run this script, reading the comments that are displayed as you go along.  Notice that the last example in the script compares what happens when the axis happens to be defined in units of days versus when it's defined in hours. 
yes? go shaded_error_bar_zone
The script is using a different means of plotting a region of uncertainty, but I think this is what's happening with your scirpt. For your example, before calling the erorr_bars script, define yet another time axis, this time in terms of hours, and regrid your data to that new axis.
DEFINE axis/T/T0=1-jan-2001/UNIT=hours thours = 24*tstep[L=1:`ntime`]

LET var_hours = new_var[gt=thours]

PLOT /SYMBOL=17/SIZE=0.07/Line=2/NOLABELS var_hours
GO error_bars polygon/color=blue/thickness=1/nolab var_hours new_err


Some more discussion of this feature of Ferret graphics is also discussed in this FAQ,

http://ferret.pmel.noaa.gov/FERRET_17sep07/FAQ/custom_plots/time_series_overlay.html


ag wrote:
Dear Ferret Usergroup

Many thanks for the ferret support I have received in the past on this Usergroup.

I am stuck on problem with Ferret that I (after spending some time on it and trying various options) appear unable to solve, so your suggestions are greatly appreciated.

I am trying to add variability to a dependent variable (plotted on Y-axis) with X-axis being a Time axis. I am using the go script error_bars.jnl but am having some problems.  A sample of the data file appears at the end of this email. Using FERRET v6.1  on Linux(g77) 2.6.9-22. - 03/26/08

Ascii File is read in using
SET DATA/FORM=DELIM/SKIP=1 .....

Initially I have to grid the "mean" along the properly setup time-axis which I am able to do using
LET days_2001 = DAYS1900(2001,1,1)
LET day_frac  = (var_hour + var_minute/60 ) / 24
LET tstep     = DAYS1900(var_year,var_month,var_day) - days_2001 + day_frac
LET ntime = `begindatetime,return=isize`
LET dummy   = t[GT=ttaxis]
LET new_var = RESHAPE(mean,dummy)

Then I also grid the "sdev" variable along the same time axis using
LET new_err = RESHAPE(sdev,dummy)

Then when I issue the following commands..I get a Time Series plot that has all the values bunched up one end (basically the time axis is expanded for some reason). This does not happen if I omit the GO script call below. Any ideas?  Am I doing something wrong?

PLOT /SYMBOL=17/SIZE=0.07/Line=2/NOLABELS new_var
GO error_bars polygon/color=blue/thickness=1/nolab new_var new_err

Here is a file sample of the ASCCII

filename        begindatetime   location        SolarZenith     npix    mean    sdev
MOD04_L2.A2007001.1500.005.2007003093108.hdf    2007-01-01 15:00:00     GISS    69.450  0              
MOD04_L2.A2007001.1635.005.2007003093604.hdf    2007-01-01 16:35:00     GISS    63.960  0              
MOD04_L2.A2007002.1540.005.2007004182338.hdf    2007-01-02 15:40:00     GISS    66.020  9       0.081   0.058
MOD04_L2.A2007003.1625.005.2007005151340.hdf    2007-01-03 16:25:00     GISS    64.020  15      0.027   0.013
MOD04_L2.A2007004.1530.005.2007007055054.hdf    2007-01-04 15:30:00     GISS    66.790  0              
MOD04_L2.A2007005.1615.005.2007008173325.hdf    2007-01-05 16:15:00     GISS    64.230  0              
MOD04_L2.A2007006.1520.005.2007010020024.hdf    2007-01-06 15:20:00     GISS    67.540  0              
MOD04_L2.A2007007.1600.005.2007012202039.hdf    2007-01-07 16:00:00     GISS    64.630  7       0.167   0.079
MOD04_L2.A2007008.1505.005.2007012223915.hdf    2007-01-08 15:05:00     GISS    68.360  0              
MOD04_L2.A2007008.1645.005.2007012225717.hdf    2007-01-08 16:45:00     GISS    63.230  0              
MOD04_L2.A2007009.1550.005.2007013005323.hdf    2007-01-09 15:50:00     GISS    65.080  0              
MOD04_L2.A2007010.1630.005.2007013053221.hdf    2007-01-10 16:30:00     GISS    63.060  5       0.039   0.017
MOD04_L2.A2007011.1535.005.2007014063943.hdf    2007-01-11 15:35:00     GISS    65.630  12      0.113   0.068
MOD04_L2.A2007012.1620.005.2007014045513.hdf    2007-01-12 16:20:00     GISS    63.130  0              
MOD04_L2.A2007013.1525.005.2007015044928.hdf    2007-01-13 15:25:00     GISS    66.360  0              
MOD04_L2.A2007014.1605.005.2007017161152.hdf    2007-01-14 16:05:00     GISS    63.360  0              
MOD04_L2.A2007015.1510.005.2007017183912.hdf    2007-01-15 15:10:00     GISS    67.080  0              
MOD04_L2.A2007016.1555.005.2007018180305.hdf    2007-01-16 15:55:00     GISS    63.700  0              
MOD04_L2.A2007017.1500.005.2007019123555.hdf    2007-01-17 15:00:00     GISS    67.970  5       0.000   0.004
MOD04_L2.A2007017.1635.005.2007019125327.hdf    2007-01-17 16:35:00     GISS    61.780  15      0.028   0.012
MOD04_L2.A2007018.1540.005.2007020111006.hdf    2007-01-18 15:40:00     GISS    64.170  8       0.126   0.044

On Fri, Apr 3, 2009 at 12:45 PM, Ansley Manke <Ansley.B.Manke@xxxxxxxx> wrote:
Hi -
Yes, you can get the number of records. Once you've opened the dataset you can get that with
LET ntime = `v1,return=isize`
then
DEFINE axis/T/T0=1-jan-2001/UNIT=days ttaxis=tstep[L=1:`ntime`]
The grave-accent syntax, also called immediate-mode expressions if you want to find it in the documentation, causes Ferret to evaluate the variable at the time of command-parsing so it can be used immediately in the DEFINE command.

To get axis labels correct, assign units and title to variables as you define them.
LET/units="meters"/title="Station Location" new_var = reshape(v6,dummy)
Or whatever.

Ansley







[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement