[Thread Prev][Thread Next][Index]

Re: [ferret_users] L-shaped masking spatially



Hi,

Just to add one more idea to this topic - A mask region made up of a few rectagles is easy to define with these kinds of IF statements, but for regions that get more complicated, the best way to define masks is with the PT_IN_POLY function.  It works with any closed path, so if you can outline the region you can define a mask .

On 11/30/2019 5:47 PM, saurabh rathore wrote:
Dear Billy,
G'day

Thank you so much for your reply. Now I understand it is the way around for such type of masking. Your solution was a perfect one I was looking for.

Cheers Saurabh

On Sun, Dec 1, 2019 at 5:26 AM William Kessler <william.s.kessler@xxxxxxxx> wrote:
Try masking off rectangle by rectangle:

let xx=x[gx=correl]; let yy=y[gy=correl]

! first mask to the overall region if necessary:
let maskregion = if xx ge 50 and xx le 210 and yy ge (-50) and yy le 10 then correl

! now mask off any needed rectangles within that region
let maskax = if xx lt 180 then 1 else 0; let maskay = if yy lt (-10) then 1 else 0

let mask = maskax*maskay

let masked_cor = if mask eq 0 then maskregion

-> Assign 0 for the region you want to keep along each axis because any product will always have the value zero and can be reliably tested

-> I defined maskAx, maskAy because you might need to mask more than 1 rectangle. In that case, for example:
let maskbx = if xx lt 120 then 1 else 0; let maskby = if yy gt 5 then 1 else 0
let mask = maskax*maskay + maskbx*maskby  ! etc

Billy K

> On Nov 29, 2019, at 8:40 PM, saurabh rathore <rohitsrb2020@xxxxxxxxx> wrote:
>
> Dear Ferreters,
> G'day
>
> I am struggling with the masking of the data. I want to create a mask for an L-shaped region spatially. I know I am doing something stupid that I am unable to create this mask.
>
> I am trying in this way, as masking a straight box is easy but I am not understanding the logic for the L-shaped complexity.
>
> let maskpp=if x[gx=correl] ge 50 and x[gx=correl] le 210 and y[gy=correl] ge (-45) and x[gx=correl] le 155 and y[gy=correl] ge (-10) and x[gx=correl] le 50 then correl else 0
>
> the boxes as shown in the plot are having dimensions like this
>
> go box 50, 210, (-10), 10
> go box 180, 210, (-45), (-10)
>
> Any suggestions will be appreciated.
>
> cheers, Saurabh
>
> --
>
>
> REGARDS
>
> Saurabh Rathore
> Research Scholar (PhD.)
> Centre For Oceans, Rivers, Atmosphere & Land Science Technology
> Indian Institute Of Technology, Kharagpur
> contact :- 91- 8345984434
> <mask-data.nc><test.png>



--


REGARDS

Saurabh Rathore
Research Scholar (PhD.)
Centre For Oceans, Rivers, Atmosphere & Land Science Technology
Indian Institute Of Technology, Kharagpur
contact :- 91- 8345984434

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

Privacy Policy | Disclaimer | Accessibility Statement