strange impact of "quit " in the script

From: <leiting2002_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 09 2011 - 13:15:30 MST

Hi, NCL users,

How to use quit /exit correctly in the ncl script is a problem.
Now, I just want to the ncl script to quit under some conditions ( judged by if block).
I had found the following strange behavior (at least to me) .
As an example, I have the script(t.ncl) :
load "/opt/ncl/5.2.0_bin/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "/opt/ncl/5.2.0_bin/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "/opt/ncl/5.2.0_bin/lib/ncarg/nclscripts/csm/contributed.ncl"
 do itim = 0, ntim-1
 nrdrows = numAsciiRow("/mnt/lfs1/projects/hybda/tlei/hbrid-gsi/experiments/ecmwf-data/dr-experiments/gsi-0815case/dr-fcst-"+suffx_tim(itim)+"/com_cor__ugrdprs-climate-sh.out_1")

 nrdrows = numAsciiRow("/mnt/lfs1/projects/hybda/tlei/hbrid-gsi/experiments/ecmwf-data/dr-experiments/ens4dvar-0815case-bc1/dr-fcst-"+suffx_tim(itim)+"/com_cor__ugrdprs-climate-sh.out_1")
 if( then
; print("wrong,not the expected rows in the file,stop "+"ens4dvar-0815case-bc1"+suffx_tim(itim)+"/com_cor__ugrdprs-climate-sh.out_1")
 end if


I ran it by " ncl -x t.ncl".
the output is :
 Copyright (C) 1995-2010 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 5.2.0
 The use of this software is governed by a License Agreement.
 See for more details.
Loading file "/opt/ncl/5.2.0_bin/lib/ncarg/nclscripts/csm/gsn_code.ncl"
Loading file "/opt/ncl/5.2.0_bin/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
Loading file "/opt/ncl/5.2.0_bin/lib/ncarg/nclscripts/csm/contributed.ncl"
+ ;begin
+ nlev=7
+ nexp=6
+ ntim=5
+ nreg=4
+ do itim = 0, ntim-1
+ nrdrows = numAsciiRow("/mnt/lfs1/projects/hybda/tlei/hbrid-gsi/experiments/ecmwf-data/dr-experiments/gsi-0815case/dr-fcst-"+suffx_tim(itim)+"/com_cor__ugrdprs-climate-sh.out_1")
+ nrdrows = numAsciiRow("/mnt/lfs1/projects/hybda/tlei/hbrid-gsi/experiments/ecmwf-data/dr-experiments/ens4dvar-0815case-bc1/dr-fcst-"+suffx_tim(itim)+"/com_cor__ugrdprs-climate-sh.out_1")
+ print(nrdrows)
+ print(nlev)
+ if( then
+ print("thinkdeb33")
+ ; print("wrong,not the expected rows in the file,stop "+"ens4dvar-0815case-bc1"+suffx_tim(itim)+"/com_cor__ugrdprs-climate-sh.out_1")

As shown in the output, the quit in the if( block is always invoked.
Why? Where did I make any mistake?

Your help is appreciated.
Ting Lei


ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Wed Nov 9 13:15:54 2011

This archive was generated by hypermail 2.1.8 : Mon Nov 14 2011 - 10:41:55 MST