[Thread Prev][Thread Next][Index]

Re: [ferret_users] FILL_XY and modulo operatinos



Hi Martin,
The exernal function code needs to explicitly do modulo operations. When writing an external function, the author can call the utility function ef_get_axis_info to find out whether the X axis is defined as a modulo axis, and if so the calculations may use that fact and do whatever is needed to carry out operations across the branch cut.

Since you're the original author of this function (10 years ago), would you like to take a look at this? If not I imagine I can see what is the right thing to do.

Ansley

On 3/17/2011 11:11 AM, Martin Schmidt wrote:
Hi ferreters,

processing satellite data with ferret, I found strange behaviour of the fill_xy - function. Earlier, I had processed data from a region 20W:22E, now the data sets are global. I notice different results from steps using
fill_xy near the 0 meridian compared with the earlier regional analysis.

To track this down the following example shows the problem:

!define a global grid:
define axis/x=10:350:20/unit=degrees_east/modulo xax
define axis/y=-50:50:10/unit=degrees_north yax

!define a variable and blank a stripe near the 0-meridian
let dummy=x[gx=xax]+0*y[gy=yax]
let d1= if i[gx=dummy] gt 3 then dummy else 1/0
let d2= if i[gx=d1] lt 17 then d1 else 1/0

This leaves two stripes undefined. Note that there are 3 cells empty in the east and 2 cells empty in the west.

Now save to a file otherwise results are really strange - but this is not the point here.

save/clobber/file=zw.nc dummy, d1, d2

ncdump shows a modula axis

variables:
        double XAX(XAX) ;
                XAX:units = "DEGREES_EAST" ;
                XAX:point_spacing = "even" ;
                XAX:axis = "X" ;
                XAX:modulo = 360. ;

Start ferret again

use zw.nc

Now fill d2 using fill_xy

shade fill_xy(d2,dummy,1)
shade fill_xy(d2,dummy,2)
shade fill_xy(d2,dummy,3)

The last example gives a wrong figure. Averaging should happen when filling near the 0 meridian, hence the modulo attribute is ignored
by fill_xy

Now define a region
set region/x=-60:100
shade fill_xy(d2,dummy,1)
shade fill_xy(d2,dummy,2)
shade fill_xy(d2,dummy,3)

This gives correct figures - in the last example, shade fill_xy(d2,dummy,3), averaging over right and left
neighbours of cells is carried out correctly.

Now consider the same for the @fnr transormation. Without any region
can region
shade d2[x=@fnr:1]
shade d2[x=@fnr:2]
shade d2[x=@fnr:3]

In the last example two neighbours are found and the average is displayed - should be correct.

But defining the region

set region/x=-60:100

gives a different result

shade d2[x=@fnr:1]

fills all missing cells and averages over both the neighbours. I would not expect this.

So both the filling methods show different behaviour if either a region around the 0-meridian is specified or not.

I would expect the same result as long as all points used for filling are within the region.
This should be achieved in future releases of ferret.

Greetings,
Martin








[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement