[Thread Prev][Thread Next][Index]

Re: [ferret_users] zaxreplace and integrals



Hi Jimmy,
Applying an integral to the result of a ZAXREPLACE function should not pose any problems. You don't say what problems you're running into, but I did a few tests, and I wonder if you're might be running into the fact that any indefinite integral computation stops when it encounters missing data. Here is a simple example, I'll do a ZAXREPLACE example below.

yes? def axis/z=1:5:1 zax
yes? let a = reshape({1,2,3,,5},z[gz=zax])
yes? list a,a[z=@iin]
Z: 0.5 to 5.5
Column 1: A is RESHAPE({1,2,3,,5},Z[GZ=ZAX])
Column 2: A[Z=@IIN] is RESHAPE({1,2,3,,5},Z[GZ=ZAX]) (indef. integ. on Z)
A A
1 / 1: 1.000 1.000
2 / 2: 2.000 3.000
3 / 3: 3.000 6.000
4 / 4: .... ....
5 / 5: 5.000 ....
yes? let b = reshape({,2,3,4,5},z[gz=zax])
yes? list b, b[z=@iin]
Z: 0.5 to 5.5
Column 1: B is RESHAPE({,2,3,4,5},Z[GZ=ZAX])
Column 2: B[Z=@IIN] is RESHAPE({,2,3,4,5},Z[GZ=ZAX]) (indef. integ. on Z)
B B
1 / 1: .... ....
2 / 2: 2.000 ....
3 / 3: 3.000 ....
4 / 4: 4.000 ....
5 / 5: 5.000 ....


When integrating the variable in z, if the start of the column of data is missing, then the entire result is missing. (This is true integrating in any direction, not just z).

Taking the example from the ZAXREPLACE section of the Users Guide,

yes? use levitus_climatology

yes? let sigma = rho_un(salt, temp, 0)-1000
yes? def axis/z=21:28:0.05 axden
yes? let saltonsigma = zaxreplace(salt, sigma, z[gz=a
yes? set view left; fill/y=0/x=120e:75w/vlim=28:21:-1 saltonsigmaxden])

! notice that saltonsigma always starts with a
! missing value at z=21, so the integral is all missing:

yes? set view right; fill/y=0/x=120e:75w/vlim=28:21:-1 saltonsigma[z=@iin]

! try @iin over a range of z where there is data at the start of
! the range of integration. Now there are results where there
! is valid data at z=23, and no result where saltonsigma is
! missing at z=23


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement