[ncl-talk] landseamask
Mary Haley
haley at ucar.edu
Thu Dec 20 09:58:23 MST 2018
Hi Ehsan,
Good catch on the inland water resource addition!
When you set cnFillDrawOrder to PostDraw, this causes the filled contours
to be drawn last, and since these are raster contours and hence blocky
looking, you are seeing the artefacts of the blocks bleeding into the
contour lines
There is a cnLineDrawOrder resource, so perhaps try setting to to
"PostDraw" and see if it gets drawn on top of the filled contours. You
might have to play around with the cnFillDrawOrder too, maybe setting it to
"Draw" instead of "PostDraw".
If you continue to have problems, let us know. There are other ways to do
this kind of ordering, but it can get a little more involved.
Good luck,
--Mary
On Thu, Dec 20, 2018 at 6:41 AM Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com>
wrote:
> Dear Mary
> Your answer is exactly what I want. However I still have 2 problems and
> I'll be thankful for any help about them.
> 1. Caspian sea and Black sea didn't fill (WRF1.png in attached)! So I
> added following line:
> res_ter at mpInlandWaterFillColor = "SkyBlue"
> and it seems works (WRF2.png in attached).
> 2. However in both figures I missed last shaded contours (here
> precipitation) on water lands! So I added following line too:
> res_tot at cnFillDrawOrder = "PostDraw" ; Also can try "Predraw"
> Now I missed contour lines for both precipitation and boundaries (WRF3.png
> in attached)! Beside that I've got RasterFill for precipitation. I've
> used
> res_tot at cnFillMode = "RasterFill"
> however it didn't affect for figures (WRF1.png and WRF2.png), but it
> affected WRF3.png!
>
> My plot lines are as below:
> plot_terrain = gsn_csm_contour_map(wks,HGT,res_ter)
> add_outlines_to_map(wks,plot_terrain) ; OK
> add_places_to_map(wks,plot_terrain) ; OK
> plot_raintot = gsn_csm_contour(wks,RainTotal,res_tot)
>
> overlay(plot_terrain, plot_raintot)
> draw(plot_terrain)
> frame(wks)
>
> I hope my email is clear and I ask my problem correctly. Also I attached
> my script, even though it seems sloppy and doesn't have input data!
> Any help will be appreciated.
>
> Sincerely
> Ehsan
> On Wednesday, December 19, 2018, 7:55:28 PM GMT+3:30, Mary Haley <
> haley at ucar.edu> wrote:
>
>
> 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
>
> _______________________________________________
> 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/20181220/7d3f0af4/attachment.html>
More information about the ncl-talk
mailing list