[Thread Prev][Thread Next][Index]

Re: [ferret_users] extracting state grid from netcdf file

Dear Ansley Manke,

Thanks for your steps.

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?

Nitin Patil

Webpage: https://sites.google.com/site/nitinpatil85/

On Tue, Nov 25, 2014 at 10:46 PM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
There's a function,
yes? show func pt*
    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?

Nitin Patil

Attachment: temp.jnl
Description: Binary data

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

Privacy Policy | Disclaimer | Accessibility Statement