[ncl-talk] Plot Pressure reduced to MSL with contours.

Rabah Hachelaf hachelaf at sca.uqam.ca
Sat Aug 30 14:31:23 MDT 2014


Hi All,

May be this is an easy issue for you but i have some errors when i try to
plot Pmsl variable using gsn_contour_map .

When using the ncl script below i get this error :

fatal:ContourPlotDraw: coordinates are out of range for drawing over a map:
standard line or line label rendering method will not work;
 consider setting the resource trGridType to "TriangularMesh" if
coordinates contain missing values

;************************************************
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

;************************************************
; read in GRIB2 file
;************************************************


   a = addfile("gfs_data/gfs.t00z.pgrb2f12.grib2","r")

    lon = a->lon_0
    lat = a->lat_0
    slp = short2flt(a->PRMSL_P0_L101_GLL0(:,:))
    slp = (/ slp/100 /) ; convert to hpa

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

printMinMax(slp, True)
;********************************************************
;  Display parameters
;***************************************

pixel=2048
;***************************************************

wks_type="png"

  wks_type at wkWidth = pixel
   wks_type at wkHeight = pixel
  wks_type at wkBackgroundOpacityF = 1.0
wks = gsn_open_wks(wks_type,"slp_test")


res = True

res                   = True
  res at mpProjection      = "Mercator"       ; choose projection
  res at mpGridAndLimbOn   = False             ; turn on lat/lon lines
  res at mpPerimOn         = False             ; turn off box around plot
  res at mpFillOn          = False
  res at cnLinesOn         = False
  res at mpOutlineOn       = True
  res at cnLineLabelsOn    = True            ; turn off contour lines
   res at mpLimitMode  = "LatLon"
   res at mpMinLatF            =   -85.0
    res at mpMaxLatF            =  85.0
    res at mpMinLonF            = -180
    res at mpMaxLonF            = 180
  res at vpXF            = 0                 ; make plot bigger
  res at vpYF            = 1
  res at vpWidthF        = 1
  res at vpHeightF       = 1

  res at cnLevelSelectionMode = "ManualLevels"  ; manually set cont levels

  res at cnLevelSpacingF           = 4             ; spacing in hpa
  res at cnLineThicknessF          = 1.10            ; change line thickness
  res at cnLineColor = "Black"
 map = gsn_contour_map(wks,slp,res)

end


-- 
------------------------------
Cordialement,
Best regards,
Rabah Hachelaf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140830/ea6256c8/attachment.html 


More information about the ncl-talk mailing list