Re: Ocean Mask

From: <Valkhorn_at_nyahnyahspammersnyahnyah>
Date: Sun, 20 Apr 2008 21:17:40 EDT

That worked, thanks. I'd hate to ask further, but is there a way to define
the masked countries fill color, too?
 
-William
 
 
In a message dated 4/20/2008 8:40:46 A.M. Central Daylight Time,
haley_at_ucar.edu writes:

William,

There are a number of ways you can do this, depending on your data.

Please see our "masking" applications examples at:

http://www.ncl.ucar.edu/Applications/mask.shtml

Here's a very simple example, that shows how to use a "DrawOrder"
resource to control masking:

----------------------------------------------------------------------

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
;
; Generate an ny x nx array of random data with a minimum of -10 and a
; maximum of 110.
;
nx = 40
ny = 40
z = generate_2d_array(15,15,-10.,110.,0,(/ny,nx/))
;
; Generate 1D lat/lon coord arrays and attach to data. Make sure
; to include the units so we don't get warning messages from the
; gsn_csm_contour_map routine.
;
lat = fspan(-90,90,ny)
lon = fspan(-179,179,nx)
z!0 = "lat"
z!1 = "lon"
z&lat = lat
z&lon = lon
z&lat_at_units = "degrees_north"
z&lon_at_units = "degrees_east"

; Open workstation and define colormap.
;
wks = gsn_open_wks("ncgm","mask")
gsn_define_colormap(wks,"BlAqGrYeOrReVi200")

; Set some resources.
;
res = True
res_at_gsnMaximize = True
res_at_gsnSpreadColors = True

res_at_cnFillOn = True
res_at_mpFillDrawOrder = "PostDraw"
res_at_mpOceanFillColor = 27 ; this is a light blue
res_at_mpLandFillColor = "Transparent"

contour = gsn_csm_contour_map(wks,z,res)
end

----------------------------------------------------------------------

--Mary

On Sat, 19 Apr 2008 Valkhorn_at_aol.com wrote:

> Is there a way to set up NCL so that the ocean is filled with a color and
> masks any contour lines that overlap it from land?
>
> Thanks!
>
> -William
>
>
>
> **************Need a new ride? Check out the largest site for U.S. used car
> listings at AOL Autos.
> (http://autos.aol.com/used?NCID=aolcmp00300000002851)
>

**************Need a new ride? Check out the largest site for U.S. used car
listings at AOL Autos.
(http://autos.aol.com/used?NCID=aolcmp00300000002851)

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Apr 20 2008 - 19:17:40 MDT

This archive was generated by hypermail 2.2.0 : Mon Apr 21 2008 - 08:22:49 MDT