# Re: Something really weird...

```Gary,

The 1D isn't really any better than the 2D, it just seems that way
because you are looking at two different variables. The problem is in your
definition of the annual average. What you really want is

yes? let atemp = temp[gt=annave@AVE]

Without the @AVE, you are getting @LIN, or linear interpolation (i.e., the
closest points on the time axis for temp that corresponds with the point on the
time axis for atemp are linearly interpolated to give a value at the new time
point). If you do not have a great deal of variation over the year, the value
for @LIN can be close to the value for @AVE. If there is a lot of variation
over the year, then the values will likely be very different.

If you do this definition change, you will see that both plots improve greatly.

In addition there can be problems with the axis definitions you are using. If I
understand what you are really trying to do, you have 412 years of data on an
irregular time axis (with 15059 points in the time axis you end up with an
average of about 36.6 points per year). Then you are trying to calculate an
annual avarage and are comparing that against the original data with a 36 point
running average.

My suggestion is that you should be using a different time unit than
years. This is, of course, a time unit with an ambiguous length (model year,
leap year, etc...). Instead, you should try to use hours or days as the
underlying time stamp. To easily get a time axis that is similar to what you
have now with hours as the underlying time unit, you could use:

yes? define axis/t="06-JAN-1030:17:11:42":"30-DEC-1441:03:37:58"/np=15059 taxis

For days, simply append the /units=days qualifier. (If you need to keep the
existing time axis as is, switch from years to days/hours.)

You can regrid your variables on the fly if you use the new "taxis" from above
by:

yes? let voltr = volt[gt=newg@ASN]
yes? let tempr = temp[gt=newg@ASN]

The @ASN is blind association, i.e., point 1 on the old time axis becomes point
1 on the new time axis, point 2 old becomes point 2 new, etc., with no
interpolation or averaging.

Next, to define the annual average, you can do a similar thing:

yes? define axis/t="01-JUL-1030":"01-JUL-1441"/np=412 annual

Which is probably more what you are expecting. Notice that I have moved the
start and end points to the middle of the year. You then obviously need to
change the succeeding definitions:

yes? let avolt = voltr[gt=annave@AVE]
yes? let rvolt = voltr[l=@sbx:36]
yes? let atemp = tempr[gt=annave@AVE]
yes? let rtemp = tempr[l=@sbx:36]

I don't know how this will change your analysis, but the definitions are much
more consisten this way. I suggest reading Chapter 4 in the ferret manual on
Grids and Regions, they can be very tricky things as you have learned.

Regards, Mark Verschell

On Mar 11,  3:05pm, Gary Strand wrote:
> Subject: Something really weird...
>
> Here's something really really weird.
>
> The data is at ftp://ftp.ucar.edu/cgd/strandwg/GB.nc
>
> and here's the ferret script I'm trying to get to work:
> -------------------------------------------------------------------------------
> use GB.nc
> set mem/size=32
> !
> define axis/t="01-JAN-1030":"31-DEC-1441":1/unit=year annual
> define grid/t=annual annave
> !
> let avolt = volt[gt=annave]
> let rvolt = volt[l=@sbx:36]
> !
> let atemp = temp[gt=annave]
> let rtemp = temp[l=@sbx:36]
> !
> plot/set avolt,rvolt
> ppl txlsze 0.05
> ppl plot
> frame/file=volt.gif
> !
> plot/set temp[k=1],atemp[k=1],rtemp[k=1]
> ppl txlsze 0.05
> ppl plot
> frame/file=temp.gif
> !
> quit
> -------------------------------------------------------------------------------
>
> I'd like to know why the 1-D variable annually averaged looks OK, but the 2-D
> variable annually averaged is all wrong.
>
> Here's the gifs created by the above:
>
> ftp://ftp.ucar.edu/cgd/strandwg/volt.gif
> ftp://ftp.ucar.edu/cgd/strandwg/temp.gif
>
> Thanks - this has been driving me nuts all day.
>
> --
> Gary Strand
> strandwg@ucar.edu
http://www.cgd.ucar.edu/ccr/strandwg
>-- End of excerpt from Gary Strand

--
Mark Verschell                     NASA/Goddard Space Flight Center
verschell@neptune.gsfc.nasa.gov    Code 970/Lab. for Hydrospheric Proc.
301-614-5669  Fax: 301-614-5666    Greenbelt, MD 20771

Better Living Through Denial
** USQC Certified: 100% Microsoft Free **

```