[ncl-talk] plot color fill problem

Chao Luo chaoluo888 at gmail.com
Wed Dec 28 21:38:30 MST 2016


Thanks, Dennis!  This works.

Chao

On Wed, Dec 28, 2016 at 7:57 PM, Dennis Shea <shea at ucar.edu> wrote:

> By default, 'gsn_csm_contour_map' uses 'gray' to fill land.
>
> See: http://www.ncl.ucar.edu/Applications/maponly.shtml
>
> To turn this off:
>      res at mpFillOn = False
>
> ===
> The areas with no data (_FillValue) are set to the background color...
> white here
>
>
> On Wed, Dec 28, 2016 at 7:40 PM, Chao Luo <chaoluo888 at gmail.com> wrote:
>
>> Hi,
>>
>> I am using NCL script to plot map contour. The plot shows gray and white
>> color, which they are not defined in the script. I have tried some map
>> color fill options, it is still  problem. Any suggestions and comments are
>> very appreciated.
>>
>> Thanks,
>>
>> Chao
>>
>> attachments are plot  and script
>>
>>  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>
>> procedure metaUtil (z[*][*][*]:numeric, time[*], lat[*], lon[*])
>>
>> begin
>>    z!0  = "time"    ; name dimensions
>>    z!1  = "lat"
>>    z!2  = "lon"
>>    z&time = time    ; assign coordinate variables
>>    z&lat  = lat
>>    z&lon  = lon
>> end
>> begin
>>   f       = addfile ("data/IC_TO_CG.hdf", "r")
>>   lat   = f->Latitude
>>   lon   = f->Longitude
>>   time  = f->Day_of_year
>> ; print(f)
>>   IC2CG =  f->IC_TO_CG(:,:,:)    ; IC to CG ratio
>>  IC2CG at _FillValue = -1
>>
>> ;;;;average data to annualy data
>> ;   AvgTime_IC_TO_CG = dim_avg_Wrap(IC2CG(Latitude|:, Longitude|:,
>> Day_of_year|:) )
>>
>>    AvgTime_July = dim_avg_Wrap(IC2CG(Latitude|:, Longitude|:,
>> Day_of_year|181:211) )
>>    AvgTime_Aug = dim_avg_Wrap(IC2CG(Latitude|:, Longitude|:,
>> Day_of_year|212:242) )
>>
>>    printVarSummary(AvgTime_July)
>>
>> ;;;;; read mask data
>>     f       = addfile ("/home/cluo/landmask.nc","r")
>>     lat_mask =  f->lat
>>     lon_mask =  f->lon
>>     land = f->land(:,:,:)
>>     printVarSummary(land)
>>     mask1 = land
>>     printVarSummary(mask1)do i=0, 360-1
>>     ii = 360+i
>>     do j=0, 360-1
>>     jj = 359-j
>>     mask1(0,j,i) = land(0,jj,ii)
>>     end do
>>     end do
>>
>>     do i=360, 720-1
>>     ii = i-360
>>     do j=0, 360-1
>>     jj = 359-j
>>     mask1(0,j,i) = land(0,jj,ii)
>>     end do
>>     end do
>>
>>     do i = 0, 720-1
>>     do j = 1, 360-1
>>     if (mask1(0,j,i).ne.0) then
>>     AvgTime_July(j,i) = 0
>>     end if
>>     end do
>>     end do
>> ;*************create plots*******************
>>   wks  = gsn_open_wks ("ps", "narr")          ; open workstation
>>   gsn_define_colormap(wks,"BlAqGrYeOrRe")        ; choose colormap
>> ; gsn_define_colormap (wks,"gui_default")         ; choose color map
>>   plot = new(1,graphic)
>>
>>   res                        = True               ; plot mods desired for
>> original grid
>>
>>   res at gsnDraw       = False      ; Don't draw plot or advance the
>>   res at gsnFrame      = False      ; frame after plot is created.
>>
>>   res at cnFillOn               = True               ; color fill
>>   res at cnLinesOn              = False              ; no contour lines
>>   res at gsnSpreadColors        = True               ; use total colormap
>>   res at gsnSpreadColorStart    = 4
>>   res at gsnSpreadColorEnd      = -1
>>   res at mpGridAndLimbOn        = False
>>   res at pmTickMarkDisplayMode  = "Always"           ; turn on tickmarks
>>   res at tmXTOn                 = False
>>   res at gsnAddCyclic           = False              ; regional data
>>   res at mpOutlineOn           = True                ; turn on map outline
>>   res at mpOutlineBoundarySets = "USStates"          ; turn on state
>> boundaries
>> ; res at mpOutlineBoundarySets = "National"
>>
>>
>>   ;;;; set boundary for subregion plot
>>    res at mpLimitMode = "LatLon"
>>    res at mpMinLonF   = -125
>>    res at mpMaxLonF   = -70
>>    res at mpMinLatF   = 25
>>    res at mpMaxLatF   = 50
>>    res at mpPerimOn   = True
>>    res at mpCenterLonF =-97
>>    res at mpCenterLatF = 35
>> res at gsnCenterString         = "Monthly mean IC/CG, August"             ;
>> draw center subtitle
>>   res at gsnCenterStringFontHeightF=25
>>   res at gsnLeftString           = ""                         ; draw left
>> subtitle
>>   res at cnLevelSelectionMode = "ExplicitLevels" ; set explicit contour
>> levels
>>   res at cnLevels = (/1,2.,3.,4.,5.,6.,8.,10./)
>>   res at cnFillColors        = (/10,20,30,40,50,65,75,85,96/)
>>   res at gsnCenterString         = "Climatology IC/CG, averaged in July"
>>   plot(0) = gsn_csm_contour_map(wks,AvgTime_July(:,:),res)
>>
>>   resP                            = True
>>   resP at gsnPanelYWhiteSpacePercent = 5
>>   resP at gsnPanelXWhiteSpacePercent = 5
>>   resP at cnFillColors      =  (/5,10,20,30,40,50,65,75,85,96/)
>>   resP at gsnMaximize                = True
>> ;  resP at gsnPanelLabelBar           = True
>>   resP at lbLabelBarOn = True
>>   resP at gsnPaperOrientation = "portrait"
>> ; resP at lbOrientation       = "vertical" ; vertical label bar
>>   resP at lbOrientation       = "horizontal"
>>   resP at lbLabelAutoStride   = True       ; nice label bar labels
>>   resP at lbTitleOn           = True
>>   resP at lbLabelFont = "helvetica"
>> ; resP at lbTitleString       = "Sig lvl"
>>   resP at lbTitlePosition     = "Bottom"
>>   resP at lbTitleFontHeightF  = .022
>>   resP at lbTitleDirection    = "Across"
>> ; resP at txString            = title
>>   gsn_panel(wks,plot,(/1,1/),resP)
>> end
>>
>>
>> _______________________________________________
>> 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/20161228/1037803e/attachment.html 


More information about the ncl-talk mailing list