[ncl-talk] landseamask

Mary Haley haley at ucar.edu
Wed Dec 19 09:24:50 MST 2018


Ehsan,

Do you mean that you want to fill the ocean in some solid color and hence
mask any data in that area? If so, you can try:

  res at mpFillOn = True
  res at mpOceanFillColor = "SkyBlue"     ; use whatever color you want
  res at mpLandFillColor = "Transparent"    ; to make sure land doesn't get
filled

You might also need to set some draw order resources, to make sure the
filled contours and filled map areas get drawn in the right order:

  res at cnFillDrawOrder = "Draw"     ; Also can try "predraw"
  res at mpFillDrawOrder = "PostDraw"

You can see some masking examples at:

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

Use your browser search to look for "draworder".

--Mary


On Wed, Dec 19, 2018 at 8:13 AM Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com>
wrote:

> Hi,
> May I ask how to fill sea (lake, ...) areas differently from land. I've
> tried using "https://www.ncl.ucar.edu/Applications/grid_fill.shtml" (
> grid_fill_5.ncl) and I've got attached map.
> That part which I used from grid_fill_5.ncl are:
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; Read/open NCL'ls crude (1x1) land-sea mask
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>   a2    = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/landsea.nc","r")
>   lsdata = a2->LSMASK
>   lsm  = landsea_mask(lsdata, xlat, xlong)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>      HGT2  := HGT                                  ; replicate for plot
>      HGT2  = where(lsm.eq.0 , HGT2 at _FillValue , HGT2)
>      HGT2  = where(lsm.eq.2 , HGT2 at _FillValue , HGT2)
>      HGT2  = where(lsm.eq.4 , HGT2 at _FillValue , HGT2)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> where "HGT" is "Terrain Height" of WRF. The issue of the attached file is
> raster filled of sea areas. However is there a better way to fill sea areas?
>
> Sincerely
> Ehsan
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181219/c0dd856c/attachment.html>


More information about the ncl-talk mailing list