variables undefined?

From: Catherine Mavriplis <Catherine.Mavriplis_at_nyahnyahspammersnyahnyah>
Date: Wed, 22 Mar 2006 12:05:53 -0600

I am new to NCL but have a weird bug:
I am running examples form NCL website
on a Mac PowerBook G4, NCL version 4.2.0.a032
error message says some variables undefined in gsn_code.ncl
but when I look there they are defined.
Not sure what the problem is. On the example below, I manage to get by
with a x11 or pdf plot but not a ps (when defining wks). Other variables
undefined as well (polytype).

output below, as well as source ncl code and my calls:
------------------------------------------------------------------
fatal:syntax error: line 2054 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
reset_device_coordinates
procedure reset_device_coordinates
---------------------------------^

fatal:error in statement
fatal:Variable (wks) is undefined
fatal:Execute: Error occurred at or near line 2062 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

fatal:syntax error: line 2923 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
gsn_primitive
procedure gsn_primitive
----------------------^

fatal:error in statement
fatal:syntax error: line 2926 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near local
local
----^

fatal:error in statement
fatal:Variable (polytype) is undefined
fatal:Execute: Error occurred at or near line 2929 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

----------------------------------------------------------------------

here is the source for those spots:

procedure reset_device_coordinates(wks:graphic)
begin
  setvalues wks
    "wkOrientation" : get_res_value(wks,"wkOrientation", 0)
    "wkDeviceLowerX" : get_res_value(wks,"wkDeviceLowerX", 36)
    "wkDeviceLowerY" : get_res_value(wks,"wkDeviceLowerY",126)
    "wkDeviceUpperX" : get_res_value(wks,"wkDeviceUpperX",576)
    "wkDeviceUpperY" : get_res_value(wks,"wkDeviceUpperY",666)
  end setvalues
end

AND

procedure gsn_primitive(wks:graphic,plotid:graphic,x[*]:numeric,\
                        y[*]:numeric,isndc:logical,polytype:string, \
                        resources:logical)
local res2, gsid, gsres, gmres, canvas, xf, yf, x2, y2
begin
  if(.not.any(polytype.eq.(/"polymarker","polygon","polyline"/)))
    print("Warning: gsn_primitive: Do not recognize primitive type '"+
polytype + "'.")
    return
  end if
.......... etc.........

----------------------- here are my calls -------------------------

;*************************************************
; adapted solution and initial solution
;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************
begin
;************************************************
; open file and read in variable
;************************************************
x1=asciiread("fort.16",(/13/),"float")
x2=asciiread("fort.36",(/49/),"float")
y1=asciiread("fort.26",(/13/),"float")
y2=asciiread("fort.46",(/49/),"float")
;************************************************
; plot the correlations
;************************************************
  wkspdf = gsn_open_wks("pdf","adapted") ; open a pdf plot
  wksx11 = gsn_open_wks("x11","adapted") ; open a x11 plot
  wksps1 = gsn_open_wks("ps","adapted1") ; open a ps plot
  wksps2 = gsn_open_ps("ps","adapted2") ; open a ps plot
  res1 = True ; make plot mods

  res1_at_xyLineColor = "blue" ; change line color
  res1_at_xyLineThicknesses = 2. ; 1 is default

  res2 = True ; make plot mods
  res2_at_tiMainString = "Initial Condition (blue) and Solution (red) at
t" ; title
  res1_at_tiXAxisString = "X" ; x-axis label
  res1_at_tiYAxisString = "U" ; y-axis label

  res2_at_xyLineColor = "red" ; change line color
  res2_at_xyLineThicknesses = 3. ; 1 is default

  plot =
gsn_csm_x2y2(wksps1,x1,x2,y1,y2,res1,res2) ; plot
correlation
  plot =
gsn_csm_x2y2(wksps2,x1,x2,y1,y2,res1,res2) ; plot
correlation
  plot =
gsn_csm_x2y2(wkspdf,x1,x2,y1,y2,res1,res2) ; plot
correlation
  plot =
gsn_csm_x2y2(wksx11,x1,x2,y1,y2,res1,res2) ; plot
correlation

;************************************************
end

any help appreciated
Thanks

-- 
Catherine Mavriplis, PhD
Research Scientist, 
University of Oklahoma 
Cooperative Institute for Mesoscale Meteorological Studies (CIMMS)
NOAA National Severe Storms Laboratory
1313 Halley Circle,
Norman, OK 73069 
(405) 366-0534 Voice
(405) 366-0472 FAX
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 22 2006 - 11:05:53 MST

This archive was generated by hypermail 2.2.0 : Wed Mar 29 2006 - 11:52:49 MST