[Thread Prev][Thread Next][Index]

Re: [EXTERNAL] [ferret_users] minimum range for @DIN ?



Hi  Xiaoyu,

On Fri, Jul 23, 2021 at 7:35 AM Xiaoyu Bai <xbai1@xxxxxxxx> wrote:
I see! By the way, do you know how to fix the @DIN cannot be applied correctly after you subtract your data from @AVE?

let comp1=test-mean
let comp2=test-21.16
let bad_din=comp1[I=@DIN,J=@DIN]
let good_din=comp2[I=@DIN,J=@DIN]

 
 
It seems to me that what you see is normal (to be expected).  Let "ave" be an area average and "din" be the corresponding area integral.  Then

ave(q) = din(q) / A,

where A is the area of the integration and average.  Therefore

din(q - ave(q)) = din(q) - A ave(q) = din(q) - din(q) = 0.

So, you expect zero for the answer.  good_din is very large only because mean  ≠ 21.16 !  If you replaced the definition of comp2 with

let comp2 = test - `mean`

then, "bad_din" and "good_din" are much closer.

So, why aren't they zero?  Probably because you calculate the average and integral on I and J instead of x and y as in "x=0:360@DIN, y=90S:90N@DIN" but I'm not sure.

Regards,

Ryo




Hi Xiayu,

On Wed, Jul 21, 2021 at 6:42 AM Xiaoyu Bai <xbai1@xxxxxxxx> wrote:
I usually use at least two grids. My understanding is that @DDN [@DIN] needs to apply a weight, most of the time is the cosine effect. If there is only one grid, pyferret will possibly only consider the one grid's value only.

Yes, but the point is that the weight is continuous.  Suppose that our SST is defined at lat = 1°, 3°, 5°, . . . at an interval of 2° .  Then,

SST[y=0:yhi@DIN]

is a continuous function of yhi.  Below is a figure showing this function (when SST is uniformly 1). The horizontal axis of the plot is yhi.  If you increase yhi slightly, the integral increases slightly because Ferret adjusts the weight.

The problem is that Ferret seems to stop adjusting the weight when yhi < 2° as the figure shows.  In particular, one would expect that SST[y=0:0@DIN] is zero.

This can be a source of error when you use Ferret programmatically to calculate integrals.  For example, I can imagine a calculation like this

repeat/range=1:`iend`/name=ii (
   let yhi = curvey[i=`ii`]
   let xx = xvals[i=`ii`]
   list/append/nohead/file=integral.txt/format=(G0,1X,G0) xx, SST[i=`ii`, y=0:`yhi`@DIN]
)

to calculate the integral of SST from the e


--
Xiaoyu


--
Xiaoyu

[Thread Prev][Thread Next][Index]