Re: strange impact of "quit " in the script

From: <leiting2002_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 09 2011 - 13:56:33 MST


I got it.

Thank you so much. I'm sorry I hadn't found what you pointed out in the ncl manual by "google ".

Also thanks to Mary for kindly reminding of that missing end do.


Subject: Re: strange impact of "quit " in the script
Date: Wed, 9 Nov 2011 13:36:52 -0700

That is the expected behavior; from the reference manual:
Quit an NCL interactive session or scriptThe quit command immediately exits from an NCL interactive session or script. Like the load command it is processed immediately when encountered and cannot be executed conditionally. NCL takes care of closing any open graphics or data files properly before exiting. In order to exit a script conditionally see either the exit or the status_exit procedure.
On Nov 9, 2011, at 1:15 PM, wrote: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")
 print(nr drows)
 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 = numAsc iiRow("/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:


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

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