[ncl-talk] White for zero in a map

Rick Brownrigg brownrig at ucar.edu
Wed Mar 4 09:52:10 MST 2015


That function "span_color_indexes" was introduced with NCL v 6.2.0.  Do you
have an older version of NCL?

Rick

On Wed, Mar 4, 2015 at 9:38 AM, Jiang, Lifen <lfjiang at ou.edu> wrote:

>  Hi Mary,
>
>  Thank you very much for writing the script for me! But it showed below
> error when I ran it. I have attached the script and my data file again. It
> will be helpful if you or anybody else can help tell the problem.
>
>  fatal:Undefined identifier: (span_color_indexes) is undefined, can't
> continue
>  fatal:Execute: Error occurred at or near line 23 in file diff_test.ncl
>
>  Thanks again,
>
>  Lifen
>
> ______________________________
>
>          *From:* Mary Haley [haley at ucar.edu]
> *Sent:* Tuesday, March 03, 2015 3:29 PM
> *To:* Jiang, Lifen
> *Cc:* ncl-talk at ucar.edu
> *Subject:* Re: [ncl-talk] White for zero in a map
>
>   There are many ways you can do this.
>
>  I've attached a script that does this by using the cnFillColors resource
> to specify a list of color indexes into the "rainbow" color map, but then I
> changed the color index that represents level 0.0 to be 0 (the background
> color, and therefore white).
>
>  --Mary
>
>
> On Sun, Mar 1, 2015 at 3:01 PM, Jiang, Lifen <lfjiang at ou.edu> wrote:
>
>>   Hello,
>>
>>  I was trying to create a map of the attached variable. The min and and
>> max are -14 and 18, respectively.
>>
>>  I would like to set white for zero, but could not work out how to make
>> it. Script is at the end of this email.
>>
>>  Could anybody help with my issue?
>>
>>  I appreciate your time and help!
>>
>>  Thanks,
>>
>>  Lifen
>>
>>  ;************************************************
>> 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/contributed.ncl"
>>
>> begin
>>
>>   in = addfile("Diff.nc","r")
>>   t  = in->Diff
>>   t at _FillValue  = -999
>>   t at missing_value = t at _FillValue
>>
>>   printVarSummary(t)
>>
>>   wks = gsn_open_wks("png" ,"Plot_Diff")                ;
>>   gsn_define_colormap(wks,"rainbow")        ; choose colormap
>>
>>   res                       = True     ; plot mods desired
>>
>>   res at cnFillOn              = True     ; turn on color fill
>>   res at cnLinesOn             = False    ; turn off contour lines
>>   res at cnLevelSpacingF       = 3      ; contour spacing
>>
>> ;---This resource not needed in NCL V6.1.0
>>   res at gsnSpreadColors       = True     ; use full range of color map
>>
>>   res at lbLabelStride         = 1
>>
>>   res at pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
>>
>>   res at gsnAddCyclic          = False    ; data already has cyclic point
>>                                   ; this must also be set for any zoom
>>
>> ; note that the gsn_csm_*map_ce templates automatically set
>> ; res at mpLimitMode="LatLon" for you. If you are plotting a different
>> projection,
>> ; you may have to set this resource.
>>
>>   res at mpMinLatF            = -90      ; range to zoom in on
>>   res at mpMaxLatF            =  90
>>   res at mpMinLonF            = -180
>>   res at mpMaxLonF            = 180
>>
>>   res at cnLevelSelectionMode = "ManualLevels"
>>   res at cnMinLevelValF       = -15
>>   res at cnMaxLevelValF       = 20
>>
>>   plot = gsn_csm_contour_map_ce(wks,t({-90:90},{-180:180}), res)
>>
>>  end
>>
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150304/ea2150dd/attachment.html 


More information about the ncl-talk mailing list