[Thread Prev][Thread Next][Index]

Re: Outlining grid boxes

On Mon, 1 Nov 2004, John Krasting wrote:
> I am using GFDL climate model output and I am trying to outline individual
> grid boxes and areas of grid boxes.
> The GO BOX script uses latitude and longitude as its inputs.  Is there an
> easier way to outline individual grid boxes without having to manually
> compute the coordinates of the box corners?

Hi John,
	I take it you can define a mask that identifies the grid cells
that you need to outline. If so then the "polygon" command may be a
way to achieve what you need.
	The example below illustrates the case of a grid where the
interval in uniform in both directions.  If the grid were not regular
in one or both direction then one would need a more clever way of
defining the box surrounding each "valid" grid cell. (I suspect there
may be a cunning way to outline the outermost boundary of a group of
selected cells too in several passes of left, right, top and bottom
edges ... )

	In the following example I will plot a chart of the Indian
Ocean, then outline the grid cells in the coarser etopo120 bathymetry
that are deeper than 3000m and lie between 30S and the equator.

use etopo20
shade/nolab/nokey/pal=black if(rose ge 0)then rose

use etopo120 ! 2 degree spacing in x and y, centered on odd degrees
let dx=2 ; let dy=2  ! the uniform intervals
let bx=zsequence({-0.5,0.5,0.5,-0.5}) ! coords of a unit cell
let by=zsequence({0.5,0.5,-0.5,-0.5}) !  centered in this case

! now define mask for the desired grid cells
let deep=if(rose lt -3000)then rose
let deepx=if(deep)then x[g=rose]+0*y[g=rose] ! coords of "valid" grid
let deepy=if(deep)then y[g=rose]+0*x[g=rose] !    converted to a 2-d field

show grid/y deep[d=2]
! ... use something like this to identify j=31:45 as the zonal
!        band of interest

repeat/j=31:45 (polygon/nolab/o/line=1/d=2/coord_ax=z \

! adding something like /pal=grey to the last command might further
! highlight the valid cells.

! another idea to highlight a region of interest (but without the
! outlining of individual cells would be to use "shade/pat=..."
! as for example
shade/nolab/nokey/pal=black/d=1 if(rose ge 0)then rose
shade/o/nolab/pat=lite_up_right_to_left/pal=black/y=30s:0 deep[d=2]

! a lite shading like this can allow an underlying filled field to
! show through.

Good Luck,
Mick Spillane

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement