strange wks error

From: Erik Noble <enoble_at_nyahnyahspammersnyahnyah>
Date: Thu, 2 Apr 2009 12:27:22 -0400

Hi I keep getting an error for writing out a postscript of PDF file. Is
there a solution to this. My terminal history and ncl code is below.Erik

fatal:Workstation with PID#8 is not open

noble:WRF-FNL_SOP3_ifort11.0_ICC enoble$ ncl Stats_r1_test.ncl
 Copyright (C) 1995-2009 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 5.1.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

Variable: rain
Type: float
Total Size: 32760 bytes
            8190 values
Number of Dimensions: 3
Dimensions and sizes: [time | 30] x [lat | 13] x [lon | 21]
Coordinates:
            time: [1..30]
            lat: [5.249551..11.19823]
            lon: [-29.81596..-19.79379]
Number Of Attributes: 1
  _FillValue : -999

Variable: rainb
Type: float
Total Size: 32760 bytes
            8190 values
Number of Dimensions: 3
Dimensions and sizes: [time | 30] x [lat | 13] x [lon | 21]
Coordinates:
            time: [1..30]
            lat: [ 5..11]
            lon: [-30..-20]
Number Of Attributes: 2
  units : mm
  _FillValue : -999

Variable: rainZon
Type: float
Total Size: 2520 bytes
            630 values
Number of Dimensions: 2
Dimensions and sizes: [time | 30] x [lon | 21]
Coordinates:
            time: [1..30]
            lon: [-29.81596..-19.79379]
Number Of Attributes: 2
  _FillValue : -999
  average_op_ncl : dim_avg over dimension: lat

Variable: TRMM2D
Type: float
Total Size: 2520 bytes
            630 values
Number of Dimensions: 2
Dimensions and sizes: [time | 30] x [lon | 21]
Coordinates:
            time: [1..30]
            lon: [-30..-20]
Number Of Attributes: 3
  average_op_ncl : dim_avg over dimension: lat
  units : mm
  _FillValue : -999

Variable: rainZon_a
Type: float
Total Size: 2400 bytes
            600 values
Number of Dimensions: 2
Dimensions and sizes: [time | 30] x [lon | 20]
Coordinates:
            time: [1..30]
            lon: [-29.31486..-19.79379]
Number Of Attributes: 2
  average_op_ncl : dim_avg over dimension: lat
  _FillValue : -999

Variable: TRMM2D_a
Type: float
Total Size: 2400 bytes
            600 values
Number of Dimensions: 2
Dimensions and sizes: [time | 30] x [lon | 20]
Coordinates:
            time: [1..30]
            lon: [-29.5..-20]
Number Of Attributes: 3
  _FillValue : -999
  units : mm
  average_op_ncl : dim_avg over dimension: lat
(0) 1D Values for WRF are:

Variable: rn
Type: float
Total Size: 2400 bytes
            600 values
Number of Dimensions: 1
Dimensions and sizes: [600]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999
(0) 1D Values for TRMM are:

Variable: tn
Type: float
Total Size: 2400 bytes
            600 values
Number of Dimensions: 1
Dimensions and sizes: [600]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999
(0) Significance level = 0.25
(0) The correlation of the hovmoller FNL/WRF Forecasts to TRMM for Region_1
is 0.214566
(0) R Test Statistical Significance is: 1.1161e-07
warning:Dimension (0) has not been defined
(0) The RMS Error is: 109.768
(0) The Bias is: 26.8417
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:NhlGetValues:PID #-4 is invalid
fatal:Execute: Error occurred at or near line 3103 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

fatal:Execute: Error occurred at or near line 3288 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

fatal:Execute: Error occurred at or near line 78 in file Stats_r1_test.ncl

fatal:Variable (wks) is undefined
fatal:Execute: Error occurred at or near line 99 in file Stats_r1_test.ncl

fatal:Variable (wks) is undefined
fatal:Execute: Error occurred at or near line 101 in file Stats_r1_test.ncl

Variable: dataXY
Type: float
Total Size: 240 bytes
            60 values
Number of Dimensions: 2
Dimensions and sizes: [2] x [30]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999
(0)
(0) min=2.2479 max=621.781
(0)
(0) min=0.0461538 max=36.6485
fatal:Variable (wks) is undefined
fatal:Execute: Error occurred at or near line 122 in file Stats_r1_test.ncl

(0) The correlation of the longitude -24FNL/WRF Forecasts to TRMM for
Region_1 is 0.0291131
(0) The RMS Error is: 112.46

Variable: dataXY
Type: float
Total Size: 240 bytes
            60 values
Number of Dimensions: 2
Dimensions and sizes: [2] x [30]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999
fatal:Variable (wks) is undefined
fatal:Execute: Error occurred at or near line 149 in file Stats_r1_test.ncl

(0) The correlation of the area_average of FNL/WRF Forecasts to TRMM for
Region_1 is 0.325642
(0) The RMS Error is: 112.46

Variable: r1
Type: float
Total Size: 32760 bytes
            8190 values
Number of Dimensions: 3
Dimensions and sizes: [lat | 13] x [lon | 21] x [time | 30]
Coordinates:
            lat: [5.249551..11.19823]
            lon: [-29.81596..-19.79379]
            time: [1..30]
Number Of Attributes: 1
  _FillValue : -999

Variable: ccr5
Type: float
Total Size: 1092 bytes
            273 values
Number of Dimensions: 2
Dimensions and sizes: [lat | 13] x [lon | 21]
Coordinates:
            lat: [ 5..11]
            lon: [-30..-20]
Number Of Attributes: 1
  _FillValue : -999
 ERROR 1 IN NGSETI - Uncleared prior error
 ERROR 1 IN NGSETC - Uncleared prior error
 ERROR 1 IN NGSETI - Uncleared prior error
 ERROR 1 IN NGSETI - Uncleared prior error
warning:GKS:GOPWK: --PostScript error: error opening output file
 ERROR 3 IN SETER - AN UNCLEARED PRIOR ERROR EXISTS
 ... MESSAGE FOR UNCLEARED PRIOR ERROR IS AS FOLLOWS:
 ... ERROR 1 IN NGSETI - Uncleared prior error
 ... MESSAGE FOR CURRENT CALL TO SETER IS AS FOLLOWS:
 ... ERROR **** IN GKS ERROR REPORTED FROM libhlu.a(Error.o)
noble:WRF-FNL_SOP3_ifort11.0_ICC enoble$
************************************************************
************************************************************
************************************************************

NCL Code

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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

; Global
dir = "./"
wrfoutfile="Region_1_Rain-Bi_Interp.nc"
obsfile =
"/Volumes/Data_and_Models/Precipitation_data/observed/TRMM/ASCII/Daily_TRMM_2006-09-.
5x.5.nc"
region = "Region_1"
regiontitle = "Atlantic ITCZ"
set="FNL/WRF"
elaptime = 30 ;
a = addfile (wrfoutfile,"r")
b = addfile (obsfile,"r")
rain = a->raingrd
printVarSummary(rain)
rainb = b->RAIN(0:29,{5:11},{-30:-20})
printVarSummary(rainb)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;At this point, we do the Hovmeuller Transformation after
 ;interpolation in order to compare it to TRMM
 ; dim_avg_Wrap will do a dimension average over the rightmost variable;
here it should be "lat" since we are want time vs. lon
rainZon = dim_avg_Wrap(rain(time|:,lon |:, lat|:) ) ; Rearranged the
dimensions so that lat is right-most variable
printVarSummary(rainZon)
trmmZon = dim_avg_Wrap(rainb(time|:,lon |:, lat|:) )
TRMM2D = trmmZon
printVarSummary(TRMM2D)
;;;;;;;;;;;;;;;;;;;;;;;
;you have tims vs. lon arrays.
;Now do statistics.
; Calculate the corelation and the RMSE
;;;;;;VERY IMPORTANT;;
;;;;;;
;The WRF data contains FILL VALUES. THESE cannot be used for the Statistics;
here they were ignored in the lat Avg, but lon -20 needs to go
;;;BUT the NCL Cross Correlation function will ignore Fill values: escorc
;rainZon_2 = rainZon
;TRMM2D_2 = TRMM2D

rainZon_a = rainZon(:,1:20)
printVarSummary(rainZon_a)
TRMM2D_a = TRMM2D(:,1:20)
printVarSummary(TRMM2D_a)

;;;;;;;;;NOW do STATISTICS;;;;;;;;;;;;;;;;;
rn=ndtooned(rainZon_a) ;gets everything into 1 dimension
print("1D Values for WRF are: ")
printVarSummary(rn)
tn=ndtooned(TRMM2D_a)
print("1D Values for TRMM are: ")
printVarSummary(tn)
;;;;;;;;;;;;:wq;;;;;;;;;Cross Correlation;;;;;;;;;;;;;;;;;;
siglvl= 0.25
print("Significance level = "+siglvl)
mxlag=0
ccr1 = escorc(rn,tn)
print("The correlation of the hovmoller "+set+" Forecasts to TRMM for
"+region+" is "+ccr1)
Nr=dimsizes(rn)
rprob = rtest(ccr1, Nr, 0)
print("R Test Statistical Significance is: "+rprob)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rmsdTime1 = dim_rmsd_Wrap(rn,tn)
print("The RMS Error is: "+rmsdTime1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
wrf_avg = dim_avg_Wrap(rainZon_a)
trm_avg = dim_avg_Wrap(TRMM2D_a)
d_bias = wrf_avg - trm_avg
;print(d_bias)
meanWr = dim_avg_Wrap(wrf_avg)
meanTr = dim_avg_Wrap(trm_avg)
bias = meanWr - meanTr
print(" The Bias is: "+bias)
;;;;;;;;;
; PLOTS
wks = gsn_open_wks("ps", "TEST1__WRF-GFS_"+region+"_ACCUM_PRECIP-"+set)
;;;;;;;;;
;HOVMEULLER
;;;;;;;;;;
res = True ; plot mods desired
;res_at_gsnDraw = False ; don't draw
;res_at_gsnFrame = False ; don't advance frame
;res_at_cnInfoLabelOn = False ; turn off cn info label
res_at_gsnScale = True ; Nice scaled Plot Feature

;Title
res_at_tiMainString = regiontitle
res_at_gsnLeftString = "WRF (FNL B.C) " ; add the gsn titles
res_at_gsnCenterString = " (Avg Lats: 5~S~o~N~N - 11~S~o~N~N) "
res_at_gsnRightString = "[mm]"
res_at_tmXBLabelFontHeightF = 0.014 ; resize tick labels
res_at_tmYLLabelFontHeightF = 0.014
res_at_tmXBValues = (/ -30, -29, -28, -27, -26, -25, -24, -23, -22, -21,
-20/)
res_at_tmXBLabels = (/"30~S~o~N~W","29~S~o~N~W","28~S~o~N~W","27~S~o~N~W",\
"26~S~o~N~W","25~S~o~N~W","24~S~o~N~W","23~S~o~N~W",
"22~S~o~N~W","21~S~o~N~W",\
"20~S~o~N~W"/)
plot = gsn_csm_hov(wks, rainZon, res) ; default hovmueller
res_at_gsnLeftString = "TRMM Daily" ; add the gsn titles
plot = gsn_csm_hov(wks, TRMM2D, res)
delete(res)
;;;;;;;;;;;;;;;;;;;;;
nx = 30 ; x axis, number of days
x = ispan(0,nx-1,1)
dataXY = new((/2,nx/),float)
printVarSummary(dataXY)
r = rainZon(:,{-24})
t = TRMM2D(:,{-24})
printMinMax(r,True)
printMinMax(t,True)

dataXY(0,:) = r
dataXY(1,:) = t
resXY = True
resXY_at_tiMainString = regiontitle+": 24~S~o~N~W: 1st 24-hour set "
resXY_at_tiXAxisString = "Elapsed Time (SEP. 1 to OCT. 1, 2006)"
resXY_at_tiYAxisString = "Accumulated Precipitation (mm)"
;resXY_at_tmXBMode = "Explicit" ; Define own tick mark
labels.
resXY_at_tmXBValues = x
;resXY_at_tmXBLabels = (/"SEP 1","SEP 2","SEP 3","SEP 4","SEP 5","SEP
6","SEP 7","SEP 8","SEP 9","SEP 10","SEP 11","SEP 12","SEP 13","SEP 14","SEP
15","SEP 16","SEP 17","SEP 18","SEP 19","SEP 20","SEP 22","SEP 23","SEP
24","SEP 25","SEP 26","SEP 27","SEP 28","SEP 29","SEP 30","OCT 01"/)
plot = gsn_xy(wks,x,dataXY,resXY)

ccr2 = escorc(r,t)
print("The correlation of the longitude -24"+set+" Forecasts to TRMM for
"+region+" is "+ccr2)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rmsdTime2 = dim_rmsd_Wrap(r,t)
print("The RMS Error is: "+rmsdTime2)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
delete(resXY)
delete(dataXY)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Area Average
wrf_aa = dim_avg_Wrap(rainZon)
trm_aa = dim_avg_Wrap(TRMM2D)
nx = 30 ; x axis, number of days
dataXY = new((/2,nx/),float)
printVarSummary(dataXY)
dataXY(0,:) = wrf_aa
dataXY(1,:) = trm_aa
x = ispan(0,nx-1,1)
resXY = True
resXY_at_tiMainString = regiontitle+": Area Average: "+set
resXY_at_tiXAxisString = "Elapsed Time (SEP. 1 to OCT. 1, 2006)"
resXY_at_tiYAxisString = "Accumulated Precipitation (mm)"
;resXY_at_tmXBMode = "Explicit" ; Define own tick mark
labels.
;resXY_at_tmXBValues = x
;resXY_at_tmXBLabels = (/"SEP 1","SEP 2","SEP 3","SEP 4","SEP 5","SEP
6","SEP 7","SEP 8","SEP 9","SEP 10","SEP 11","SEP 12","SEP 13","SEP 14","SEP
15","SEP 16","SEP 17","SEP 18","SEP 19","SEP 20","SEP 22","SEP 23","SEP
24","SEP 25","SEP 26","SEP 27","SEP 28","SEP 29","SEP 30","OCT 01"/)
plot = gsn_csm_xy(wks,x,dataXY,resXY)
ccr3 = escorc(wrf_aa,trm_aa)
print("The correlation of the area_average of "+set+" Forecasts to TRMM for
"+region+" is "+ccr3)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rmsdTime3 = dim_rmsd_Wrap(r,t)
print("The RMS Error is: "+rmsdTime3)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  r1 = rain(lat|:,lon|:,time|:)
  r2 = rainb(lat|:,lon|:,time|:)
  printVarSummary(r1)
;************************************************
; calculate cross correlations
;************************************************
  ccr5 = escorc(r1,r2) ; calc cross correlations

; copy meta data and coordinate variables using contributed functions
  copy_VarAtts(r1, ccr5)
  copy_VarCoords_1(r2,ccr5)
  printVarSummary(ccr5)
;************************************************
; plot the correlations
;************************************************
  wks = gsn_open_wks("ps","corel_r1") ; open a ps plot
  gsn_define_colormap(wks,"BlWhRe") ; choose colormap

  res = True ; make plot mods

  res_at_cnFillOn = True ; turn on color
  res_at_gsnSpreadColors = True ; use full colormap
  res_at_cnLinesOn = False ; turn off contour lines
  res_at_lbLabelAutoStride = True ; automatic lb label stride
  res_at_pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
  res_at_gsnAddCyclic = False ; data already has cyclic point
       ; this must also be set for any zoom
  res_at_mpMinLonF = -29 ; select a subregion
  res_at_mpMaxLonF = -20
  res_at_mpMinLatF = 6
  res_at_mpMaxLatF = 11

  res_at_cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
  res_at_cnMinLevelValF = -1. ; min level
  res_at_cnMaxLevelValF = 1. ; max level
  res_at_cnLevelSpacingF = .1 ; contour level spacing
  res_at_tiMainString = "Daily Precipitation Correlations: GFS/WRF vs.
TRMM (ATL. ITCZ)"
  plot = gsn_csm_contour_map_ce(wks,ccr5,res)
;************************************************

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 02 2009 - 10:27:22 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 07 2009 - 10:01:36 MDT