[Thread Prev][Thread Next][Index]

Re: [ferret_users] Averaging of data in a irregular domain / diamond shape



Hi Muraleedharan,
Here you can define a mask which is 1 inside the region and missing everywhere else. Here's documentation about masking:
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/XPRESSIONS#_VPID_181

The PT_IN_POLY function would let you define a mask which is 1 inside the region and missing everywhere else

yes? show func pt_in_poly
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 xpts = {x1,x2,x2,x1}
yes? let ypts = {y1,y1,y2,y2,y1}

yes? let mask = ifv pt_in_poly(var, xpts, ypts) GE 0 then 1  ! or GT 0, your choice
yes? let masked_var = var* mask

! check the region and mask graphically
yes? shade var
yes? plot/over/nolab/vs/line xpts, ypts
yes? shade/over/nolab masked_var

yes? list masked_var[x=@ave,y=@ave]


On 4/23/2016 11:20 PM, Murali Kallungal wrote:
Hi friends
I am working in a region where numerous islands and zig-zag coastline.
I would like to average data over a polygon or diamond shape (x1y1,x2y1,x2y2,x1y2,x1y1)
How can I do this in ferret

Regards
Muraleedharan 

--
-------------------------------

Muraleedharan K.R
-------------------------------
Scientist
National Institute of Oceanography
Regional Centre
Salim Ali Road
P.B. No. 1913

Kochi - 682 018
Kerala, India
Ph (O): +91-484-2390306
Fax:     +91-484-2390618
Mob:    +91 9495254557
E-mail: muraleedharan@xxxxxxx



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

Privacy Policy | Disclaimer | Accessibility Statement