[ncl-talk] define infill color for inland water bodies

Matthew Fearon Matthew.Fearon at dri.edu
Mon Sep 8 14:28:38 MDT 2014


Thanks, Adam for your note, but unfortunately I tried your suggestion with no luck. The inland water bodies remain white. Therefore, I revised my code to NOT use wrf* functions, but I am still struggling with the white inland water bodies rather than grey. Any ideas what I am missing? I am using wrf_map_resources to set some resources, but it shouldn't overwrite like wrf_map_overlays. Here's my revised script:


begin


;type = "ps"

type = "png"


colors=(/"white","black","grey81","red","green","blue","black"/)


wks = gsn_open_wks(type,pname+ndt)

gsn_define_colormap(wks,colors)



;********************** mpres


mpres                              = True

mpres at gsnDraw                      = False

mpres at gsnFrame                     = False


mpres                              = wrf_map_resources(f,mpres)


mpres at mpDataBaseVersion            = "Ncarg4_1"

mpres at mpDataSetName                = "Earth..1"

mpres at mpNationalLineColor          = "black"

mpres at mpNationalLineThicknessF     = 3.5

mpres at mpGeophysicalLineColor       = "black"

mpres at mpGeophysicalLineThicknessF  = 3.5

mpres at mpProvincialLineColor        = "black"

mpres at mpProvincialLineThicknessF   = 3.5

mpres at mpFillOn                     = True

mpres at mpFillColors                 = (/"transparent","transparent","transparent","grey81"/)

mpres at mpFillDrawOrder              = "PostDraw"

;mpres at mpInlandWaterFillColor       = "grey81"

;mpres at mpOceanFillColor             = "grey81"

;mpres at mpLandFillColor              = "grey81"


mpres at tfDoNDCOverlay               = True

mpres at gsnAddCyclic                 = False


mpres at cnLinesOn                    = False

mpres at cnLineLabelsOn               = False

mpres at cnInfoLabelOn                = False

mpres at cnFillOn                     = True

mpres at cnFillMode                   = "RasterFill"

mpres at cnRasterSmoothingOn          = False

mpres at cnMinLevelValF               = 0

mpres at cnMaxLevelValF               = 3

mpres at cnLevelSpacingF              = 1


mpres at lbLabelBarOn                 = False

mpres at mpGridLineDashPattern        = 2

mpres at tmXBLabelFontHeightF         = 0.015

mpres at tmYLLabelFontHeightF         = 0.015

mpres at tmXBMajorLengthF             = 0.004

mpres at tmXBLabelDeltaF              = -0.4

mpres at gsnMaximize                  = True



mplot = gsn_csm_contour_map(wks,vmap,mpres)

draw(mplot)

frame(wks)


________________________________
From: Adam Phillips [asphilli at ucar.edu]
Sent: Monday, September 08, 2014 8:05 AM
To: Dennis Shea
Cc: Matthew Fearon; ncl-talk; wrfhelp at ucar.edu
Subject: Re: [ncl-talk] define infill color for inland water bodies

Hi Matthew,
Both Kyle and Dennis are correct in that the wrf* functions can overrule or ignore some resources. However, I have one more combination of resources for you to try. I see that you are color filling your contours and that you'd like the inland lakes to be filled gray. In order to do this you'd want to draw the map fill last, and set all map fill colors (default, ocean, land) to transparent other than inland water. I am also having you set the contour color fill draw order to "Draw" to further make sure  that the map fill is drawn after the contour color fill.

Try this:
; note that you could have set mpLandFillColor, mpOceanFIllColor, etc. instead of
; mpFillColors
mpres at mpFillColors = (/"transparent","transparent","transparent","grey81"/)
mpres at mpFillDrawOrder = "PostDraw"

var3_res at cnFillDrawOrder = "Draw"    ; might not be needed

If the above combination does not work, then I would follow Dennis' suggestions of either contacting wrf-help or stripping wrf_map_overlays out and modifying it to your own needs.
Adam

On Mon, Sep 8, 2014 at 7:45 AM, Dennis Shea <shea at ucar.edu<mailto:shea at ucar.edu>> wrote:
The wrf_* were written by wrfhelp. You should send questions to wrfhelp at ucar.edu<mailto:wrfhelp at ucar.edu> on all of these functions. You can cc ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>

As noted, the resources may not be allowed or are overwritten by the wrf code.
I'd suggest extracting the function from the library, modifying the function and then calling the modified function.

Good luck

On Sun, Sep 7, 2014 at 11:10 PM, Kyle Griffin <ksgriffin2 at wisc.edu<mailto:ksgriffin2 at wisc.edu>> wrote:

Although I'm not certain, most WRF plotting scripts overwrite many of the more complicated resources. It sounds like these map fill resources are included in the list that they either don't recognize or overwrite.


Kyle

On Sep 7, 2014 8:27 PM, "Matthew Fearon" <Matthew.Fearon at dri.edu<mailto:Matthew.Fearon at dri.edu>> wrote:
Thanks, Kyle, but I'm missing something still. My script is below. The wrf_map_overlays function is perhaps messing up the draw order or recoloring inland water bodies white. Any ideas?



type = "png"


wks = gsn_open_wks(type,pname+ndt)

gsn_define_colormap(wks,"MPL_terrain")

res                                = True

res at NoHeaderFooter                 = True


mpres                              = True

mpres at mpDataBaseVersion            = "Ncarg4_0"

mpres at mpDataSetName                = "Earth..1"

mpres at mpNationalLineColor          = "black"

mpres at mpNationalLineThicknessF     = 2

mpres at mpGeophysicalLineColor       = "black"

mpres at mpGeophysicalLineThicknessF  = 2

mpres at mpProvincialLineColor        = "black"

mpres at mpProvincialLineThicknessF   = 3

;mpres at mpFillOn                     = True

;mpres at mpFillDrawOrder              = "PreDraw"

mpres at mpInlandWaterFillColor       = "grey81"

mpres at mpOceanFillColor             = "grey81"

mpres at mpLandFillColor              = "grey81"


pltres = True


var3_res = res

var3_res at ContourParameters     = (/ 0, 3, 1 /)

var3_res at cnFillMode            = "RasterFill"

var3_res at cnFillOn              = True

var3_res at cnRasterSmoothingOn   = False

var3_res at cnFillColors          = (/"grey81","red","green","blue","black"/)

var3_res at cnFillDrawOrder       = "Draw"

con3_var = wrf_contour(f,wks,vmap,var3_res)



pltres at CommonTitle = True

pltres at PlotTitle = ndt

plot = wrf_map_overlays(f,wks,(/con3_var/),pltres,mpres)


________________________________
From: windrunnerxc at gmail.com<mailto:windrunnerxc at gmail.com> [windrunnerxc at gmail.com<mailto:windrunnerxc at gmail.com>] on behalf of Kyle Griffin [ksgriffin2 at wisc.edu<mailto:ksgriffin2 at wisc.edu>]
Sent: Sunday, September 07, 2014 5:33 PM
To: Matthew Fearon; ncl-talk
Subject: Re: [ncl-talk] define infill color for inland water bodies


Don't use mpFillColor. Use a combination of mpLandFillColor, mpOceanFillColor, and mpInlandWaterFillColor. These are your desired resources.

Kyle

On Sep 7, 2014 4:56 PM, "Matthew Fearon" <Matthew.Fearon at dri.edu<mailto:Matthew.Fearon at dri.edu>> wrote:
Dear NCL Users,

What is the correct method for filling in inland water bodies with a specified color. Here's the resources I have been experimenting with, but none seem to work, eg, inland lakes are consistently colored white not grey81. Thanks, Matt



mpres                              = True

;mpres at mpDataBaseVersion            = "Ncarg4_0"

;mpres at mpDataSetName                = "Earth..4"

mpres at mpNationalLineColor          = "black"

mpres at mpNationalLineThicknessF     = 2

mpres at mpGeophysicalLineColor       = "black"

mpres at mpGeophysicalLineThicknessF  = 2

mpres at mpProvincialLineColor        = "black"

mpres at mpProvincialLineThicknessF   = 3

mpres at mpFillOn                     = True

mpres at mpMonoFillColor              = True

mpres at mpFillColor                  = "grey81"

mpres at mpFillAreaSpecifiers         = "water"   ;"inlandwater"

mpres at mpSpecifiedFillColors        = "grey81"

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk


_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk




--
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Division, NCAR
www.cgd.ucar.edu/staff/asphilli/<http://www.cgd.ucar.edu/staff/asphilli/>   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140908/0ba6e3a3/attachment.html 


More information about the ncl-talk mailing list