# Re: [ferret_users] Regression in t for each month

Since X is your unused dimension, I'd define calendar months on X instead of Z:

define axis/x=1:12:1 xmonth

With this you don't need to transpose the contour plot (xmonth will be your x-axis). In other cases when such an operation becomes necessary, try contour/transpose

Cheers,
D.

On Tue, Feb 10, 2009 at 6:24 PM, Paul Young wrote:
Thanks for the reply David - I didn't know to look at the reshape function.

...However, I have one more (simple?) question: Is it possible to reshape the latitude/z contour plot (where z=month number) back to a time/latitude contour plot (i.e. month name on the x-axis, latitude on the z axis)? Tried using reshape again, but I'm not getting very far!

Just to clarify about my data/script:

yes? show grid my_dat                                            !my raw data
GRID (G002)
name       axis              # p bsp;            end
normal    X
LAT       LATITUDE            15 r   70S                  70N
LEV       Z (hPa)              3 i-  1.5                  15
TAX       TIME               325 r   15-DEC-1978 00:00    15-DEC-2005 00:00

yes? define axis/t=1979:2005:1 tyear                             !Omit Dec 1978
yes? define axis/z=1:12:1 zmonth
yes? let my_dat15 = my_dat[k=3,l=2:325]                          !Get 2D (lat/time) variable< id = z[gz=zmonth] + t[gt=tyear] + y[gy=my_dat15]
yes? let my_reshape = reshape(my_dat15,out_grid)
yes? show grid my_reshape
GRID (G003)
name       axis              # pts   start                end
normal    X
LAT       LATITUDE            15 r   70S                  70N
ZMONTH    Z         &nbsp bsp; 12 r   1                    12
TYEAR     T                   27 r   1979                 2005

yes? let p = t[gt=my_reshape]                                    !Do the regression
yes? let q = my_shape
yes? set grid q
yes? go regresst

Cheers,

Paul

On Feb 10, 2009, at 3:35 PM, David Wang wrote:

Hi Paul,

There is an easy way in Ferret. That is to "reshape" your monthly data into a yearly field with an additional dimension of calendar months. Please refer to Ch3 Sec2.3.23 in the manual for an illustrative example.

http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/XPRESSIONS#_VPID_114

HTH,
D.

On Tue, Feb 10, 2009 at 4:42 PM, Pau lt;Paul.J.Young@xxxxxxxx> wrote:
Hi all,

Can't find this in the documentation or email group....

I have a time series of monthly mean data (Dec 1978-Dec 2005) on pressure (z) and latitude (y) axes. I would like to be able to do a 2D plot of lat vs time that shows the linear trend for each month. I see that using the regresst tool produces a trend for the whole time series, so is there a way to do it for each month individually? The only way I thought was to load in a time series of each month individually, do the regression, output to a file, combine 12 files using NCO, then re-read back into ferret to do the plotting - there's got to be a simpler way I guess!?

Thanks for any help,

Paul

-----
Paul Young

Chemistry and Clim >
Chemical Sciences Division
NOAA Earth System Research Laboratory
Boulder CO 80305-3328
USA

Tel:   +1 303-497-4711
Fax:   +1 303-497-5686

--
life grows, death doesn't.

-----
Paul Young

Chemistry and Climate Processes
Chemical Sciences Division
NOAA Earth System Research Laboratory
Boulder CO 80305-3328
USA

Tel:   +1 303-497-4711
Fax:   +1 303-497-5686

--
life grows, death doesn't.