[Thread Prev][Thread Next][Index]

zaxreplace_avg misbehaving?



Dear Ferreters

I was concerned about the results I was getting using the ZAXREPLACE_AVG function, so
I wrote the following little script to demonstrate the problem. It compares the results using
ZAXREPLACE, ZAXREPLACE_AVG, and ZAXREPLACE_BIN.

The ZAXREPLACE and ZAXREPLACE_BIN look fine (though how did ZAXREPLACE
manage to interpolate to get that last value?? Anyway, it looks correct.).
But run the script and note the strange final value for
day_b = ZAXREPLACE_AVG(day_orid,cycle_orig,dummie)
at z = 6.

dummie[k=6] = 350, so this oddity corresponds to destination grid cell centred at 350. The value of
day_b[k=6] should be the average of day_orig over the bin containing 350, where
"the weighting is done according to the portion of the source box that lies within the destination grid cell."
 
The destination cycle here is 349.5 to 350.5, so shouldn't it just average the one value,
day_orig = 19066, corresponding to cycle_orig = 350? Apparently it's looking outside this
range, but not in a reasonable way.


Rob
       ferret
Post ^ Script:

! define some original source data:

let day = {19026, 19036, 19056, 19066, 19076}
let cycle = {346, 347, 349, 350, 351}
list /file=source.dat /format=(2(1x,e12.5)) cycle, day

! put that data on the following original source grid:

define axis/z=10:50:10 zaxis_orig
define grid/z=zaxis_orig grid_orig

file/columns=2/var=cycle_orig, day_orig/grid=grid_orig/skip=3 source.dat

! define a destination axis

define axis/z=345:353:1 zaxis_des

LET dummie = z[GZ=zaxis_des]

let day_a = ZAXREPLACE(DAY_orig, CYCLE_orig, DUMMIE)
let day_b = ZAXREPLACE_avg(DAY_orig, CYCLE_orig, DUMMIE)
let day_c = ZAXREPLACE_bin(DAY_orig, CYCLE_orig, DUMMIE)

list day_a, day_b, day_c

list day_orig, cycle_orig
list dummie


Rob Scott
Research Associate
Institute for Geophysics
University of Texas at Austin
4412 Spicewood Springs Rd.
Building 600
Austin, TX
78759

Office: +1-512-471-0375


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement