[Thread Prev][Thread Next][Index]

Re: [ferret_users] restrict polymark to transect

Hi Russ,

Le 2015-10-15 Russ a écrit:
> The trick is to define the x axis to be stations and the y axis to be 
> observations. You then spread the station locations to a 2D grid, 
> subtract the locations of the obs and check the differences against
> your criteria giving you a mask.
> Something like
> let lon_2d = 0*longitude + ysequence(TransLon)   ! 2D. Could also 
> reshape onto a proper grid.
> let lat_2d = 0*latitude + ysequence(TransLat)
> let d_lon = abs(lon_2d-longitude)
> let d_lat = abs(lat_2d-latitude)
> ! Check that x and y criteria are met simultaneously
> let mask_2d = if d_lon le dx and d_lat le dy then 1
> ! Reduce to 1D. The distance criterion only needs to be satisfied
> once.
> let mask = if mask_2d[j=1:`nstations`@ngd] ge 1 then 1

Thanks, your method works well.

Other earlier suggestions were very much appreciated as well, all
suggesting to define a mask in a smart way (on the appropriate grid),
instead of defining a very long string for the mask.


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

Privacy Policy | Disclaimer | Accessibility Statement