RE: [ncl-talk] how to get user input

From: Lunde, Bruce N CIV NAVOCEANO, NP1 <bruce.lunde_at_nyahnyahspammersnyahnyah>
Date: Wed, 10 Sep 2008 10:13:35 -0500

Hello Joe,

To get user input into an NCL program I usually do the method
of Dennis and Mary - write a shell script driver to collect
all my expected inputs and pass them on the command line.

However, sometimes I do get the user input from within the
NCL script using variations on the technique shown below.

Put the following NCL code into file "foo.ncl":

    begin
      print("Enter a Number")
      ans = stringtointeger(systemfunc("read ANS; echo $ANS"))
      print("Number * 10 = "+(ans*10))
    end

Execute this code to see the result.

    ncl -n foo.ncl

Bruce

> Hi,
>
> This probably seems like a simple question, but I can't find
> an answer
> to this problem anywhere on the NCL page. When running an
> NCL program,
> how does one ask the user for a value? For example, my
> program reads in
> a field for 5 seasons, but I want it to ask the user which season to
> plot. In FORTRAN I would just use the read function, but I
> can't find
> its equivalent for NCL. Could you help me out here?
>
> Thanks a lot!
>
> Joe Grim

=====
Bruce Lunde
Bruce.Lunde_at_navy.mil
228-688-5843
Code NP1
Naval Oceanographic Office
Stennis Space Center, MS
=====
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 10 2008 - 09:13:35 MDT

This archive was generated by hypermail 2.2.0 : Fri Sep 12 2008 - 21:42:04 MDT