[Thread Prev][Thread Next][Index]

Re: [ferret_users] L-shaped masking spatially



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>



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

Privacy Policy | Disclaimer | Accessibility Statement