Hi,
There's a function,
yes? show func pt*
PT_IN_POLY(A,XVERT,YVERT)
Return -1 outside, 0 if on edge, 1 if inside polygon
A: Variable on the XY grid and region to be tested
XVERT: X-coordinates of vertices of polygon
YVERT: Y-coordinates of vertices of polygon
If you have the boundaries as lists of longitude and latitude
values, this function will return a mask as shown in the
description. So, check how it looks:
yes? let state_mask = pt_in_poly( var, xvert, yvert)
yes? let var_in_state = if state_mask eq 1 then state_mask * var
yes? shade var_in_state
yes? plot/vs/over/line xvert, yvert ! just to see the
outline
It's up to you whether you make the mask include any grid points
that happen to match the boundary.
if state_mask GE 0 then...
And you can list out var_in_state, in whatever format you want.
On 11/25/2014 7:40 AM, Nitin Patil
wrote:
Dear ferret users,
I have a netcdf file from which I have to extract grid
values of one state.
I know the state boundaries grid lat lon but it is not a
perfect square, How to write in jnl script the know grid
values for state to extract the values in txt?
|