You might think of defining variables, var[i=@shf:1], var[i=@shf:-1]
and so forth and require that those be present in the grid.
Something like this
let var_ip = ifv var[i=@shf:1] then 1
let var_im = ifv var[i=@shf:-1] then 1
let var_jp = ifv var[j=@shf:1] then 1
let var_jm = ifv var[j=@shf:-1] then 1
let var_neighbors = var_ip + var_im + var_jp + var_jm
! use as a mask
let var_masked = if var_neighbors gt 2 then var
The above just looks one grid cell in x and y, but you could include
more such definitions: var[i=@shf:1,j=@shf:1],
var[i=@shf:1,j=@shf:-1], ...
On 3/24/2014 8:34 AM, jagadish
karmacharya wrote:
Dear
all,
Actually I am able to find the dates of highest
gridpoint rainfall events in a 3 D dataset but the
problem is the model dataset I am using seems to have
many grid point stroms resulting in many maxima's that
occur only in a grid but having no rainfall in
surrounding grid. To avoide this problem I am wonding
whether it would be possible to define a maxima event
that also take into account rainfall in the grids
surrounding the maximum rainfall grid (e.g. say
rainfall in surrounding 1/3 of the grids i.e. 8 out of
sorround 24 grids is above a threshold (e.g. 10% of
the maxamima or a fix threshold)).
I am using following script to find the dates of 10
highest gridpoint rainfall maxima: (actually the list
may contain more than one maxima value in a given data
(corresponding extereme rainfall occuring in more than
one grid on the same data) but I am sorting uniqe
dates in excel)
let sorted_i1=sorti(xsequence(pr[X=79:89,Y=26:31]))
let
sorted_pr=samplei(xsequence(pr[X=79:89,Y=26:31]),sorted_i1)
let isize=sorted_pr[i=@ngd]
list sorted_pr[i=`isize-9`:`isize`],
sorted_i1[i=`isize-9`:`isize`] ! This would
list the 10 highest rainfall and i-values
corresponding to those max
I could then find the date (timestep) by dividing
those i-values with number of grids in each time step
(say 800 for the region above in the dataset) and then
adding 1 and ignoring the decimal points from the
result i.e.
list (sorted_i1[i=`isize-9`:`isize`]/800)+1 !
would list the time steps of occurance of 10 highest
rainfall
For the problem I mentioned above, one opition I can
think of is to intepolate the model output to a
coarser grid and then repeat above procedure but I
wonder if there is a better alternative.
Best regards,
Jagadish