[Thread Prev][Thread Next][Index]
Re: How to fit data with a straight line
Hi, Steve,
Thank you very much.
As you said, I define axis like this
yes? def axis/t=1-jan-1945:31-dec-1993:365.25/units=days/edges tax1
yes? tmean=temp[gt=tax1@ave]
instead of
yes? def axis/t=1-jan-1945:31-dec-1993:365.25/units=days/edges/modulo tax1
yes? tmean=temp[gt=tax1@mod]
Then I use regresst
yes? let q = tmean
yes? let p = t[gt=tax1]
yes? go regresst
and plot line
yes? plot/x=180/y=20 tmean
yes? plot/x=180/y=20/over qhat
they work very well and I get what I want.
But here I have two problems more,
1) you must notice here I do not use
yes? set grid q
If I use this line, then I would be pushed out of ferret,
yes? set grid q
yes? go regresst
yes? plot/x=180/y=20 qhat
Segmentation fault (core dumped)
2) My data is 3 Dimensional, when I do
yes? contour qhat[l=20]
**ERROR: all data have same value: data are all flagged as bad
I get error. But when I list data 'qhat'
yes? list qhat
qhat has value on every point and every time step
If I list qhat like this,
yes? list/l=20 qhat
SLOPE*P + INTERCEP
TIME: 02-JUL-1964 09:00
... listing every 3th point
179E175W169W163W157W151W145W139W133W127W121W115W109W103W97W 91W 85W 79W
41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92
61N / 52:.........................................................................
59N / 51:.........................................................................
...
Now no values at all. I do not understand.
So I draw contour like,
yes? contour qhat[l=20:21@ave]
I can get very good contours, just what I want. I am curious to get these problems.
Thanks a lot.
Haijun Yang
> From hankin@pmel.noaa.gov Thu Mar 23 15:24:52 2000
> Date: Thu, 23 Mar 2000 13:38:25 -0800
> From: Steve Hankin <hankin@pmel.noaa.gov>
> Subject: Re: How to fit data with a straight line
> To: Yang Haijun <navyang@tuna.meteor.wisc.edu>
> Cc: ferret_users@ferret.wrc.noaa.gov, verschell@neptune.gsfc.nasa.gov
> Organization: NOAA/Pacific Marine Environmental Laboratory
> Mime-Version: 1.0
> X-Mailer: Mozilla 4.5 [en] (WinNT; I)
> Content-Type: multipart/mixed; boundary="Boundary_(ID_pz8DKlw3VXY9Jm0qKRjiRQ)"
> X-Accept-Language: en
> References: <200003230002.AA15416@tuna.meteor.wisc.edu>
> Content-Length: 25221
>
> Hi Yang,
>
> First I see a couple of more fundamental problems.
>
> 1. The axis TAX is an year-by-year (non-modulo) axis. You have included a "modulo"
> qualifier, but I think it does not belong there.
> 2. You have also asked for TEMP[gt=tax1@mod], modulo regridding. I believe what you
> want is simple TEMP[gt=tax1@AVE] -- to average the (monthly) source points into
> the (annual) destination cells.
>
> Here is a complete session illustrating the type of calculation that you are
> attempting. I use a SIN function for synthetic data. The resulting GIF file is
> attached.
>
> yes? define axis/t=1-jan-1945:31-dec-1993:30/units=days tsrc
> yes? let my_var = SIN(T[gt=tsrc]/500)
> yes? plot my_var
> yes? def axis/t=1-jan-1945:31-dec-1993:365.25/units=days/edges tax1
> yes? let my_var_ann = my_var[gt=tax1@ave]
> yes? plot/over/symbols my_var_ann
> yes? go regresst
>
> ... Linear Regression Along the T Axis
> ... Instructions:
> Use the LET command to define new variables
> Define the variable P as your independent (X) variable
> Define the variable Q as your dependent (Y) variable
> Results will be variables "SLOPE", "INTERCEP" and "RSQUARE"
> QHAT will be the regression estimate
> Note: If "T" is your independent variable then
> ... "SET GRID Q" after defining Q.
> ...
>
> yes? let p = t[gt=tax1]
> yes? let q = my_var_ann
> yes? plot/over qhat
> yes? frame/file=qhat.gif
>
> Happy Ferreting - steve
>
> ================================================
>
> Yang Haijun wrote:
>
> > Hi,
> >
> > Thank you very much. Bu now I have another problem,
> >
> > Suppose I have data temperature with 49 year x 12 months = 588 time steps
> >
> > currently SET data sets:
> > 1> temp.nc (default)
> > name title I J K L
> > TEMP COADS SST 1:97 1:57 ... 1:588
> > PERIOD Averaging period ... ... ... 1:588
> >
> > 1) First of all I get annual mean temp
> >
> > yes? def axis/t=1-jan-1945:31-dec-1993:365.25/units=days/edges/modulo tax1
> > yes? let TMEAN = TEMP[gt=tax1@mod]
> >
> > 2) Then I want to do regress for TMEAN
> >
> > yes? let q = TMEAN
> > yes? let p = t
> > yes? set grid TMEAN
> > yes? go regresst
> >
> > Then I got error messages:
> >
> > **ERROR: unknown defining grid: GT=TAX1@MOD --> g=user-or-pseudo-var not allowed
> > set grid TMEAN
> > Command file, command group, or REPEAT execution aborted
> >
> > Obviously the problem is due to 't', how to give 't' to p here?
> > And let ferret know this 't' is corresponding to TMEAN?
> >
> > Thanks a lot.
> >
> >
> > Haijun Yang
> >
> >
> >
> >
> > > From ferret_users-owner@ferret.wrc.noaa.gov Wed Mar 22 15:00:35 2000
> > > From: "Mark Verschell" <verschell@neptune.gsfc.nasa.gov>
> > > Date: Wed, 22 Mar 2000 15:45:57 -0500
> > > In-Reply-To: Yang Haijun <navyang@tuna.meteor.wisc.edu>
> > "How to fit data with a straight line" (Mar 22, 1:48pm)
> > > References: <200003221948.AA14779@tuna.meteor.wisc.edu>
> > > X-Mailer: Z-Mail (5.0.0 30July97)
> > > To: Yang Haijun <navyang@tuna.meteor.wisc.edu>,
> > ferret_users@ferret.wrc.noaa.gov
> > > Subject: Re: How to fit data with a straight line
> > > Mime-Version: 1.0
> > > Content-Type: text/plain; charset=us-ascii
> > > Sender: owner-ferret_users@ferret.wrc.noaa.gov
> > > Precedence: bulk
> > > Content-Length: 872
> > >
> > > Look at the .jnl files regress?.jnl that would be in $FER_DIR/go, since you are
> > > trying to do this versus time, you would use regresst.jnl. A simple example for
> > > your case:
> > >
> > > yes? let p=temperature
> > > yes? let q=t
> > > yes? set grid q
> > > yes? go regresst
> > >
> > > Then:
> > >
> > > yes? list slope, intercep, rsquare ! slope is b and intercep is a
> > >
> > > You can also plot this with
> > >
> > > yes? plot qhat
> > >
> > > Mark
> > >
> > > On Mar 22, 1:48pm, Yang Haijun wrote:
> > > > Subject: How to fit data with a straight line
> > > > Dear ferret users,
> > > >
> > > > I have a time-series data, say Temperature with 40 years, now I want to fit
> > > this data with a
> > > > straight line, that is, I want to get this line:
> > > >
> > > > Y = a + b*t
> > > >
> > > > based on Temperature observations. Here Y is temperature, t is time step.
> > > How do I get 'a' and
> > > > 'b'? Is there a function to do this in ferret?
> > > >
> > > > Thank you very much,
> > > >
> > > > Haijun Yang
> > > >-- End of excerpt from Yang Haijun
> > >
> > >
> > >
>
> --
>
> | NOAA/PMEL | ph. (206) 526-6080
> Steve Hankin | 7600 Sand Point Way NE | FAX (206) 526-6744
> | Seattle, WA 98115-0070 | hankin@pmel.noaa.gov
>
>
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement