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

Adam Phillips asphilli at ucar.edu
Tue Sep 9 10:39:13 MDT 2014


Hi Matthew,
A few thoughts:
- You are attempting to contour color fill and map color fill at the same
time (=2 complete fill layers), and that's why resources (specifically the
DrawOrder resources) have to be just so.
- mpFillOn by default goes to True, so by not setting it you are
essentially leaving it on.
- With v6.1.2 one cannot set transparent colors when doing a raster fill.
This is why you are getting white lakes with raster and gray with the other
cnFillMode(s). (In v6.2.0 you can set transparent colors w/raster fill.)
- I cannot explain why mpFillColors isn't working for you, but as long as
the individual mpFill resources are working this isn't that big of a deal.
- If possible I would recommend that you download and use v6.2.1 as v6.1.2
is 1.5yrs old..

If you have any further questions let ncl-talk know..
Adam



On Mon, Sep 8, 2014 at 4:58 PM, Matthew Fearon <Matthew.Fearon at dri.edu>
wrote:

>  Thanks, Adam and Rick for your continued assistance. What a bear for
> something so simple. I have a version working. However, it is tied to
> certain caveats that I don't understand. My full script is below. The
> cnFillMode resource controls the outcome; RasterFill gives me white water
> bodies whereas CellFill and AreaFill give me the grey. Also, mpFillOn and
> mpFillColors never works for me no matter the combination; I always get
> white water bodies. The use of mpInlandWaterFillColor and the following
> draw orders work. Perhaps my NCL version has an impact, v6.1.2.
>
>  ---partial script
>  ;;;mpres at mpFillOn                     = True
> ;;;mpres at mpFillColors                 =
> (/"transparent","transparent","transparent","grey81"/)
>
>  mpres at mpInlandWaterFillColor       = "grey81"
> mpres at cnFillDrawOrder = "Draw"
> mpres at mpFillDrawOrder = "Draw"
> mpres at mpOutlineDrawOrder = "PostDraw"
> mpres at mpPerimDrawOrder = "PostDraw"
>
>
>  ----full script
>  begin
>
>
>  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 mpInlandWaterFillColor       = "grey81"
>
>  mpres at cnFillDrawOrder = "Draw"
> mpres at mpFillDrawOrder = "Draw"
> mpres at mpOutlineDrawOrder = "PostDraw"
> mpres at mpPerimDrawOrder = "PostDraw"
>
>  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)
>
>
>
>  end
>
>
>
>
>
>
>  ------------------------------
> *From:* Rick Brownrigg [brownrig at ucar.edu]
> *Sent:* Monday, September 08, 2014 2:12 PM
> *To:* Matthew Fearon
> *Cc:* Adam Phillips; ncl-talk; wrfhelp at ucar.edu
> *Subject:* Re: [ncl-talk] define infill color for inland water bodies
>
>   Hi Matthew,
>
> Never mind what I said about commenting out the mpFillColors resource
> line.  I misunderstood what you were trying to do.  For what its worth,
> since I didn't have your data, I slightly modified your script to use just
> gsn_csm_map(), and I did indeed get an image consisting of only inland
> water colored in grey81 -- all other areas of the map where "transparent".
> So I think Adam is right -- it must be a draw-order issue in the presence
> of data to plot over the map.  Unfortunately, I'm not sure what to
> recommend at this point.
>
>  Sorry about that...
> Rick
>
>
> On Mon, Sep 8, 2014 at 3:01 PM, Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> I got a different result when I commented out this line:
>>
>> mpres at mpFillColors                 =
>> (/"transparent","transparent","transparent","grey81"/)
>>
>> On Mon, Sep 8, 2014 at 2:28 PM, Matthew Fearon <Matthew.Fearon at dri.edu>
>> wrote:
>>
>>>  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> wrote:
>>>
>>>>   The wrf_* were written by wrfhelp. You should send questions to
>>>> wrfhelp at ucar.edu on all of these functions. You can cc
>>>> 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>
>>>> 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>
>>>>> 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 [windrunnerxc at gmail.com] on behalf of
>>>>>> Kyle Griffin [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>
>>>>>> 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/   303-497-1726
>>>
>>>  <http://www.cgd.ucar.edu/staff/asphilli>
>>>
>>> _______________________________________________
>>> 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/   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/20140909/99358d0c/attachment.html 


More information about the ncl-talk mailing list