Re: strange impact of "quit " in the script

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 09 2011 - 13:38:14 MST

Also, it looks like you are missing an "end do".

--Mary

On Nov 9, 2011, at 1:36 PM, Rick Brownrigg wrote:

> Hi,
>
> That is the expected behavior; from the reference manual:
>
> Quit an NCL interactive session or script
>
> The 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.
>
> Rick
>
> 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"
>> ;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(nr drows)
>> print(nlev)
>> if(1.gt.2) 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")
>> quit
>> end if
>> ;end
>>
>> VVVVVVVVVVVV
>>
>> 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 http://www.ncl.ucar.edu/ 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(1.gt.2) 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")
>> ~
>> VVVVVVVVVV
>>
>> As shown in the output, the quit in the if(1.gt.2) block is always invoked.
>> Why? Where did I make any mistake?
>>
>> Your help is appreciated.
>> Best,
>> Ting Lei
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Nov 9 13:38:21 2011

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