[ncl-talk] Fwd: Plot Pressure reduced to MSL with contours.
David Brown
dbrown at ucar.edu
Thu Sep 4 14:05:15 MDT 2014
Hi Rabah,
Sorry for the delay in answering your question. The reason you are getting
this message is that the correct coordinate arrays are not being
communicated to the plotting routines. There are two ways to fix your
script.
1) You are using the routine gsn_contour_map. This function does not
automatically communicate the coordinates that are attached to the
variable. To make it do what you want you need to set the resources
sfXArray and sfYArray. Just add these lines prior to the gsn_contour_map
call:
res at sfXArray = lon
res at sfYArray = lat
2) Just substitute the routine gsn_csm_contour_map for gsn_contour_map. The
'csm' version of the routine does extract the coordinates from the
variable. This is the easiest fix.
-dave
On Wed, Sep 3, 2014 at 5:20 PM, Rabah Hachelaf <hachelaf at sca.uqam.ca> wrote:
>
>
> 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
>
>
>
>
> _______________________________________________
> 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/20140904/1c5523fe/attachment.html
More information about the ncl-talk
mailing list