[Thread Prev][Thread Next][Index]

[no subject]

Hi Stefan,

Some suggestions:

1) Masking is the easy approach to integration over irregular areas.
 (i.e defining a variable of 1's and 0's indicating where the calculation
should be performed.)  Multiply your variables by this mask ... then integrate.
Only be aware that the integration is simply a sum of rectangular grid cells
-- that's adequate as long as the grid cells are highly resolved relative to
the domain of the problem.  If they are not (i.e. if coastline irregularities
cut across individual grid cells in ways that will effect the result) then
regrid to a finer grid prior to integration.

2) Here's some script code to help make ocean masks that are "hand tuned"
to exactly the region shape desired:

! define a general land/ocean mask tailored to your particular grid
! (such a mask may already be available as a part of your model)
	yes? set data etopo60	! also available 40, 20, and 5 min. resolution
	yes? DEFINE GRID/X=my_var[d=my_dset]/Y=my_var[d=my_dset] my_grid
	yes? let bathymetry = rose[d=etopo60,g=my_grid]
	yes? let ocean_mask = IF bathymetry LT 0.0 THEN 1 ELSE 0
! Now we need to define an atlantic ocean mask.  A simple rectangle would
! include fragments of Pacific Ocean (etc.), too.  These must be eliminated.
! Start with the rectangular region which includes those annoying "corners"
	yes? let atlantic_mask = ocean_mask	! the default
	yes? set region/x=80w:30e/y=60s:60n	! or whatever ... Atlantic
	yes? save/file=atlantic_mask.cdf atlantic_mask
! now redefine "atlantic_mask" so we can lay 0's over the incorrect regions
	yes? let atlantic_mask = 0 * ocean_mask	! an electronic eraser ...
! erase the lower left corner (in the Pacific Ocean)
	yes? save/file=atlantic_mask.cdf/append/x=80w:70w/y=60s:0 atlantic_mask
	yes? ...
	yes? .... continue erasing other rectangles as needed ...
	yes? ...
! verify that the resulting mask is correct
	yes? CANCEL VARIABLE atlantic_mask ! must do this in current version
	yes? use atlantic_mask.cdf
	yes? shade atlantic_mask

	- steve

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / ERL / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement