[Thread Prev][Thread Next][Index]

Re: [ferret_users] Changed behaviour in regridding one point axes

Hi Martin,
                     First, regarding your example:

this has to do with the Ferrets "delayed evaluation mode". If you use a specific value instead of the
"RANDU" function, this example will work just fine.
              define axis/x=163e/npoints=1 x1pt
              let var_1pt =x[gx=x1pt]*0 + 0.4914
              list var_1pt
              define axis/x=161e:165e:1 x5pt
              list var_1pt[gx=x5pt@MAX]

Both will give you 0.4914, which is the correct answer.

Second, your original problem of assigning point time series to the model grid: here is an example,
which will work just fine. Please note that, the grid point which matches with the station lat-lon will
have data and all other points will have missing values. This could be easily manipulated as shown
towards the end of the example:

! get a grid

    use coads_climatology
    define grid/x=sst[d=1]/y=sst[d=1] rgrid  ! just XY axes, no time axis

! define river runoff data, at a single grid point

    define axis/x=90E/npoints=1 x1pt
    define axis/y=10N/npoints=1 y1pt
    let roff = x[gx=x1pt]*0 + y[gy=y1pt]*0 + sin(t[gt=sst,d=1]/1000) + 2 ! with time axis

! assign runoff to destination grid

    let runoff = roff[gx=rgrid@MAX,gy=rgrid@MAX]

! check values --> @MAX picks lon 91E and lat 11N as the dx=dy=2Degrees

    list runoff[x=91,y=11],roff
    shade/l=10 runoff

! apply proper mask

    let mask_tmp = IF sst[d=1,l=1] THEN 1         ! this is on XYT grid
    let mask     = RESHAPE(mask_tmp, runoff)      ! with proper time axis   
    let river_1  = IF runoff THEN runoff ELSE 0   ! 0-for all missing data
    let river    = river_1 * mask                 ! model's land mask
    shade/l=10 river

You could use @XACT regrdding if there is an exact match between river location and grid point.
This way of assigning grid, by specifying each axis instead of the variable or /like, found to work
as intended in most of the situations.

Hope this helps,

Please let me know if you have any questions,


On Mon, Oct 5, 2009 at 1:41 AM, Martin Schmidt <martin.schmidt@xxxxxxxxxxxxxxxxx> wrote:
I am trying to regrid a variable defined at a single point with two dimensions.
>From one file I read a 2d-field "wet" that is 1 at ocean points and 0 otherwise.
I define a new grid (for short notation)

define grid/like=wet[d=1] rgrid

Read the river data
use "with_coordinates/angola.nc"

rivers data are time series with a single latitude and longitude coordinate and a time axis

let runoff= RIVER_BENGO[gx=rgrid@sum,gy=rgrid@sum]

I would expect, that ferret searches, in which grid cell the river is and sets runoff to the data value.
Otherwise runoff should be zero.

This does not work, the river appears to be spread over an area. The sum over all grid
points is the correct data value.

I was playing around with the examples in the manual. For example:

yes? define axis/x=163e/npoints=1 x1pt
yes? let var_1pt = randu(x[gx=x1pt]) ! a random value at a single coordinate
yes? list var_1pt
           VARIABLE : RANDU(X[GX=X1PT])
           LONGITUDE: 163E
yes? define axis/x=161e:165e:1 x5pt
yes? list var_1pt[gx=x5pt@max] ! same value embedded within 5 point axis
           VARIABLE : RANDU(X[GX=X1PT])
                      regrid: 1 deg on X@MAX
           SUBSET   : 5 points (LONGITUDE)
161E   / 1:     ....
162E   / 2:     ....
163E   / 3:  0.04804
164E   / 4:     ....
165E   / 5:     ....

This differes from the example in the manual and is wrong. The number should be .4914.
I am using ferret 6.03. An old version (5.41 for AIX gives the correct result,
but does not work too for the river example. 5.7 and 5.8 are wrong too.

What I am doing wrong with the river example?
Seems there is a bug in ferret 6. Version 6.01 gives the same result.


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement