I have one query (find attached script) that when I am doing list in my script it is saving all the grid points in the txt file, but I want to save only the grid points which comes under the shaded area (xgp, ygp). Any mistake I am doing in list statement?Dear Ansley Manke,Thanks for your steps.On Tue, Nov 25, 2014 at 10:46 PM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:Hi,
There's a function,
yes? show func pt*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:
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
yes? let state_mask = pt_in_poly( var, xvert, yvert)It's up to you whether you make the mask include any grid points that happen to match the boundary.
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
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?
--Regards,Nitin Patil