[ncl-talk] sub: Contour plot

dale zuri dalezuri at gmail.com
Wed Mar 25 18:54:27 MDT 2020


Hi NCL user,
I have been trying to overlay the contour lines of the sea ice area
fraction. Ended up getting the contour lines across the continental region
instead of the Arctic region. Also there is a straight white line showing
up on the map. I couldn't adjust the min/max of Lon/Lat.
I would appreciate any help to fix this.
Thanks



  f      = addfile ("blackbox.cice.h.0001-01.nc", "r")


  TIME   = f->time

;  VAR    = short2flt(f->$vname$(:,{latS:latN},:))

  VAR    = f->$vname$

  icearea    = f->aice

  printVarSummary(VAR)                              ; variable overview

  printVarSummary(icearea)                              ; variable overview

lat2d = f->TLAT

 lon2d = f->TLON

;============================================================

; PLOTS

;============================================================


  wks = gsn_open_wks("x11","eof")         ; send graphics to PNG file

;  plot = new(neof,graphic)                ; create graphic array

                                          ; only needed if paneling

; EOF patterns


  res                      = True

  res at gsnDraw              = False        ; don't draw yet

  res at gsnFrame             = False        ; don't advance frame yet

  res at gsnPolar             = "NH"


  res at mpFillOn             = False        ; turn off map fill

  res at gsnAddCyclic = False

  res at sfYArray = lat2d

  res at sfXArray = lon2d

  res at cnFillOn             = True         ; turn on color fill

  res at cnFillPalette        = "grads_rainbow"     ; choose colormap

;  res at cnFillPalette        = "NCV_banded"     ; choose colormap

  res at cnLinesOn            = False        ; True is default

  res at cnLineLabelsOn       = False        ; True is default

  res at lbLabelBarOn         = False        ; turn off individual lb's

res at trGridType = "TriangularMesh"

                                          ; set symmetric plot min/max


; panel plot only resources

  resP                     = True         ; modify the panel plot

  resP at gsnMaximize         = True         ; large format

  resP at gsnPanelLabelBar    = True         ; add common colorbar

;

     plot=gsn_csm_contour_map_polar(wks,VAR(0,:,:),res)

;*****************************

; create second plot

;*****************************

  res1 = True

  res1 at gsnTickMarksOn   = False ; no tickmarks

  res1 at gsnDraw          = False ; don't draw

  res1 at gsnFrame         = False ; don't advance frame

res1 at gsnAddCyclic = False

  res1 at gsnLeftString    = "" ; no titles

  res1 at gsnRightString   = ""

  res1 at tiXAxisString    = ""

  res1 at tiYAxisString    = ""

  res1 at cnLineThicknessF = 1.0 ; thicker contours

  res1 at cnLineLabelsOn   = False ; no line labels

  res1 at cnFillMode = "RasterFill"

  res1 at cnRasterSmoothingOn = True

  res1 at sfYArray = lat2d

  res1 at sfXArray = lon2d

res1 at trGridType = "TriangularMesh"

 plot2 = gsn_csm_contour(wks,icearea(0,:,:),res1)

;******************************

; overlay the plots

;******************************

  overlay(plot,plot2)

  draw(plot)

  frame(wks)

end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200325/1c835237/attachment.html>


More information about the ncl-talk mailing list