have troble to run NCL

From: Feng Song (songfeng AT XXXXXX)
Date: Mon Apr 09 2001 - 08:40:29 MDT


Hi

I am a new user of NCL, I have trouble to run a very simple NCL script (see the end of the email) at 'dataproc.ucar.edu'. Any help will be appreciated.

Song Feng

I run the ncl script (filename:h_lat_1.ncl) and get the following error:
*********************************************
>ncl
ncl 0> h_lat_1.ncl
fatal:syntax error: line 0 before or near .
h_lat_1.
-------^
fatal:error in statement

My second run :
**********************************************
ncl 1> ng4ex h_lat_1.ncl
fatal:syntax error: line 1 before or near h_lat_1
ng4ex h_lat_1
------------^
fatal:syntax error: possibly an undefined procedure

*******************************************************************
When I run the script sentence by sentence, every command was okay except the final one ('end'). My procedure are the following:

ncl 2> ;*************************************************
ncl 3> ;
ncl 4> ; CSM Graphics: h_lat_1.ncl
ncl 5> ;
ncl 6> ;************************************************
ncl 7> load "/fs/cgd/data0/shea/nclGSUN/gsn_code.ncl" ; functions required to
ncl 8> load "/fs/cgd/data0/shea/nclGSUN/gsn_csm.ncl" ; plot. Include before
ncl 9> ;************************************************
ncl 10> begin
ncl 11> ;************************************************
ncl 12> ; read in netCDF file
ncl 13> ;************************************************
ncl 14> ; "a" here is a variable that represents a pointer to the
ncl 15> ; file. you could call this "in", "myfile", whatever
ncl 16> ; you want
ncl 17>
ncl 18> a = addfile("/wp/cgd/murphys/Data/ATMOS/atmos.nc","r")
ncl 19> ;************************************************
ncl 20> ; read in data required for calculation
ncl 21> ;************************************************
ncl 22> z3 = a->Z3 ; read in z3
ncl 23> hyam = a->hyam
ncl 24> hybm = a->hybm
ncl 25> P0mb = a->P0*0.01
ncl 26> ps = a->PS
ncl 27> lat = a->lat
ncl 28>
ncl 29> ; choose what pressure levels you want to interpolate to
ncl 30>
ncl 31> lev_p = (/10,30,50,100,200,250,300,400,500,600,700,800,900,1000/)
ncl 32> lev_p@units = "hPa" ; required for vinth2p
ncl 33> ;************************************************
ncl 34> ; interpolate data to pressure levels
ncl 35> ;************************************************
ncl 36> z3press = vinth2p (z3/1000., hyam,hybm, lev_p ,ps, 2, P0mb, 1, False )
ncl 37> ;************************************************
ncl 38> ; create plot
ncl 39> ;************************************************
ncl 40> wks = gsn_open_wks("ps","h_lat") ; open a ncgm file
ncl 41> gsn_define_colormap(wks,"gui_default") ; choose a colormap
ncl 42>
ncl 43> res = True
ncl 44>
ncl 45>
ncl 46> res@gsnLeftString = z3@long_name ; add some labels
ncl 47> res@gsnRightString= z3@units
ncl 48> res@gsnCenterString = "scaled by 1000."
ncl 49>
ncl 50>
ncl 51> res@cnFillOn = True ; turn on color
ncl 52> res@lbOrientation = "Vertical"
ncl 53> res@pmLabelBarOrthogonalPosF=.07
ncl 54>
ncl 55> plot= gsn_csm_pres_hgt(wks,z3press(0,:,:,14),res) ; create plot
ncl 56> end
warning:GKS:GOPWK: --PostScript error: error opening output file
fatal:Workstation with PID#8 is not open
 ERROR 3 IN NGSETI - value for WO must reference an open workstation.
 ERROR 1 IN NGSETI - Uncleared prior error
 ERROR 1 IN NGSETI - Uncleared prior error
 ERROR 1 IN NGSETI - Uncleared prior error
 ERROR 1 IN NGSETI - Uncleared prior error
 ERROR 1 IN NGSETI - Uncleared prior error
fatal:Unable to open Workstation-Can't Create
fatal:Unable to access object with id:-4
fatal:PID #-4 can't be found in NhlSetValues
fatal:GOPWK:libncarg Error:NGSETI - Uncleared prior error
fatal:_NhlCreate:Invalid Parent id #-4
fatal:PID #-4 can't be found in NhlSetValues
fatal:NhlGetValues:PID #-4 is invalid
fatal:Execute: Error occurred at or near line 1014 in file /fs/cgd/data0/shea/nclGSUN/gsn_code.ncl

fatal:Execute: Error occurred at or near line 4453 in file /fs/cgd/data0/shea/nclGSUN/gsn_code.ncl

fatal:Execute: Error occurred at or near line 7009 in file /fs/cgd/data0/shea/nclGSUN/gsn_csm.ncl

fatal:Execute: Error occurred at or near line 7139 in file /fs/cgd/data0/shea/nclGSUN/gsn_csm.ncl

fatal:Execute: Error occurred at or near line 7412 in file /fs/cgd/data0/shea/nclGSUN/gsn_csm.ncl

fatal:Execute: Error occurred at or near line 55

____________________________________________________________

The samle ncl scirpt

;*************************************************
;
; CSM Graphics: h_lat_1.ncl
;
;************************************************
load "/fs/cgd/data0/shea/nclGSUN/gsn_code.ncl" ; functions required to
load "/fs/cgd/data0/shea/nclGSUN/gsn_csm.ncl" ; plot. Include before
;************************************************
begin
;************************************************
; read in netCDF file
;************************************************
; "a" here is a variable that represents a pointer to the
; file. you could call this "in", "myfile", whatever
; you want

  a = addfile("/wp/cgd/murphys/Data/ATMOS/atmos.nc","r")
;************************************************
; read in data required for calculation
;************************************************
  z3 = a->Z3 ; read in z3
  hyam = a->hyam
  hybm = a->hybm
  P0mb = a->P0*0.01
  ps = a->PS
  lat = a->lat

; choose what pressure levels you want to interpolate to

  lev_p = (/10,30,50,100,200,250,300,400,500,600,700,800,900,1000/)
  lev_p@units = "hPa" ; required for vinth2p
;************************************************
; interpolate data to pressure levels
;************************************************
  z3press = vinth2p (z3/1000., hyam,hybm, lev_p ,ps, 2, P0mb, 1, False )
;************************************************
; create plot
;************************************************
  wks = gsn_open_wks("ps","h_lat") ; open a ncgm file
  gsn_define_colormap(wks,"gui_default") ; choose a colormap

  res = True

  res@gsnLeftString = z3@long_name ; add some labels
  res@gsnRightString= z3@units
  res@gsnCenterString = "scaled by 1000."

  res@cnFillOn = True ; turn on color
  res@lbOrientation = "Vertical"
  res@pmLabelBarOrthogonalPosF=.07

  plot= gsn_csm_pres_hgt(wks,z3press(0,:,:,14),res) ; create plot

end



This archive was generated by hypermail 2b29 : Mon Apr 09 2001 - 10:05:13 MDT