Re: Plotting problem

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 06 2013 - 10:48:29 MST

Always look at the variable you want to plot.
The variable is type "short". It must be unpacked
(scale and offset applied) prior to plotting

Please read:
   http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml

The data need not be 'flipped' for graphics.
If you want the center longitude different than the default, use

     res@mpCenterLonF = ....

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;************************************************
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
;************************************************
; open file and read in data
;************************************************
   in = addfile("med_c0.nc","r")
   t = short2flt(in->med_c0) ; convert to float
   printVarSummary(t)

;************************************************
; create plot
;************************************************
   wks = gsn_open_wks("pdf" ,"Olson") ;
   gsn_define_colormap(wks,"rainbow") ; choose colormap
   res = True ; plot mods desired
   res@cnFillOn = True ; turn on color fill
   res@cnLinesOn = False ; turn of contour lines
  ;res@cnLevelSpacingF = 0.5 ; contour spacing
;---This resource not needed in NCL V6.1.0
   res@gsnSpreadColors = True ; use full range of color map
   res@lbLabelAutoStride = True
   plot = gsn_csm_contour_map_ce(wks,t, res)
;************************************************
end

On 02/06/2013 10:16 AM, Jiang, Lifen wrote:
> ;************************************************
> 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
> ;************************************************
> ; open file and read in data
> ;************************************************
> in = addfile("med_c0.nc","r")
> t = in->med_c0
> printVarSummary(t)
> t@_FillValue = -32768
> t@missing_value = t@_FillValue
> t = lonFlip(t) ; reorder
> ;************************************************
> ; create plot
> ;************************************************
> wks = gsn_open_wks("pdf" ,"Olson") ;
> gsn_define_colormap(wks,"rainbow") ; choose colormap
> res = True ; plot mods desired
> res@cnFillOn = True ; turn on color fill
> res@cnLinesOn = False ; turn of contour lines
> res@cnLevelSpacingF = 0.5 ; contour spacing
> ;---This resource not needed in NCL V6.1.0
> res@gsnSpreadColors = True ; use full range of color map
> res@lbLabelStride = 4
> res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
> res@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@mpLimitMode="LatLon" for you. If you are plotting a different projection,
> ; you may have to set this resource.
> res@mpMinLatF = -90 ; range to zoom in on
> res@mpMaxLatF = 90
> res@mpMinLonF = -180
> res@mpMaxLonF = 180
> 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
Received on Wed Feb 6 10:48:42 2013

This archive was generated by hypermail 2.1.8 : Wed Feb 06 2013 - 16:37:00 MST