[Thread Prev][Thread Next][Index]

Re: [ferret_users] pick up SST of the round area.



Hi -
You can do this by defining a mask. The idea is described in the FAQ on averaging or integrating over an irregular region :
http://www.ferret.noaa.gov/Ferret/FAQ/analysis/avg_integ_irreg.html

For a circle of radius r centered at (x1,y1) the equation is

  r*r = (x-x1)*(x-x1) + (y-y1)*(y-y1)

If we solve this for y as a function of x

  y = y1 + (r*r - (x-x1)*(x-x1))^0.5   ! Upper half of the circle
  y = y1 - (r*r - (x-x1)*(x-x1))^0.5    ! Lower half of the circle

( in Ferret the square root is done as a power of one half.  In some email tools, this may make the 0.5 become a superscript, but it is the upper carat character before the 0.5)

Here is a quick example using a topography data set on a fine grid:

use "http://www.ferret.noaa.gov/cgi-bin/nph-dods/data/PMEL/smith_sandwell_topo_v8_2.nc"

! A circle around Hawaii
let r = 5
let x1 = 203
let y1 = 21

let xpts = x[gx=rose]
let ypts = y[gy=rose]

!  upper and lower halves of the circle

let upc = y1 + (r*r - (xpts-x1)*(xpts-x1))^0.5
let lpc = y1 - (r*r - (xpts-x1)*(xpts-x1))^0.5

!  Define a mask: points with y less than the upper 
!  half and greater than the lower half of the circle
let mask1 = if ypts lt upc then 1
let mask2 = if ypts gt lpc then 1
let mask = mask1 * mask2
let masked_rose = mask * rose
! Define a region around the circle to plot

let xmin = x1-r-2
let xmax = x1+r+2
let ymin = y1-r-2
let ymax = y1+r+2
set region/x=`xmin`:`xmax`/y=`ymin`:`ymax`
set win/asp=1/siz=0.4
shade/pal=dark_land_sea/lev=(-inf)(-4000,4000,500)(inf) masked_rose
frame/file=circlemask.gif
  
You could do other computations on the variable masked_rose or in your case masked_sst. Of course the resolution of the circle is only as fine as the grid of the variable.

Ansley

Namba Takaya wrote:
Dear users

I like to get the SST of the round or eclipse area on the
map, not rectangle area.

Could you tell me how to do it?

Best Regards,

Takaya Namba

--------------------------------------
STOP HIV/AIDS.
Yahoo! JAPAN Redribbon Campaign 2005
http://pr.mail.yahoo.co.jp/redribbon/
  

GIF image


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement