[ncl-talk] White for zero in a map

Jiang, Lifen lfjiang at ou.edu
Wed Mar 4 12:18:29 MST 2015


Hi Alan,

Thanks for the instructions. I will read both.

Lifen

From: Alan Brammer [abrammer at albany.edu]
Sent: Wednesday, March 04, 2015 1:15 PM
To: Jiang, Lifen
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] White for zero in a map

Please read the two links below.  You have to define the coordinates of the data, as detailed in the first link.  Then overlay the contours on the map, can be done through the function in the 2nd link.

https://www.ncl.ucar.edu/Document/Graphics/overlays_on_map.shtml

https://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_csm_contour_map.shtml

Good luck.



On Wed, Mar 4, 2015 at 12:41 PM, Jiang, Lifen <lfjiang at ou.edu<mailto:lfjiang at ou.edu>> wrote:
Hi Dennis, Rick and Mary,

Sorry, I was using 6.0.0. I ran it aagin in 6.2.1 and got a figure like in "Plot_Diff". But I would like to see a figure like in "Map". Could you please give me more help?

Thank you for telling me my mistake.

Lifen
______________________________
From: Dennis Shea [shea at ucar.edu<mailto:shea at ucar.edu>]
Sent: Wednesday, March 04, 2015 10:48 AM
To: Jiang, Lifen
Cc: Mary Haley; ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>

Subject: Re: [ncl-talk] White for zero in a map

What version of NCL are you using?

https://www.ncl.ucar.edu/Document/Functions/Built-in/span_color_indexes.shtml

indicates that  this function is "Available in version 6.2.0<https://www.ncl.ucar.edu/prev_releases.shtml#6.2.0> and later."



On Wed, Mar 4, 2015 at 9:38 AM, Jiang, Lifen <lfjiang at ou.edu<mailto: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<mailto:haley at ucar.edu>]
Sent: Tuesday, March 03, 2015 3:29 PM
To: Jiang, Lifen
Cc: ncl-talk at ucar.edu<mailto: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<mailto: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



_______________________________________________
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/38b46368/attachment.html 


More information about the ncl-talk mailing list