Re: CLO command line options/arguments in NCL

From: Dennis Shea (shea AT XXXXXX)
Date: Tue Feb 24 2004 - 17:53:39 MST

  • Next message: Juno Hsu: "NCL IO problem"

    The NCL development people [via Rick Grubin] have asked for user
    input before deciding which direction they should proceed with
    Command Line Options (CLOs). Based upon experience teaching NCL,
    I offer the following comments to ncl-talk (like Christian
    Marquardt) rather than replying directly to Rick.
     
    (1) Most students are science oriented people. The vast majority
        do not know languages like Perl or Python. Some are familiar
        with shell programming [eg: C-shell] but are from from experts.
        Generally the students include: grad student, post-docs,
        research scientists and operationally oriented people.
         
    (2) The people who have requested CLOs in the classes have requested
        simple features.
         
    (3) They would like something "sooner-than-later".
        Implementing a simple interface that does not preclude
        adding more sophisticated capabilities at a later time
        would be my choice.
     
    (4) One simple approach that is consistent with how NCL currently
        does things is:
       
              opt = GetOpt( optName:string, optType:string)
               
        For the sake of discussion:
        
        Predefined opts are capitals, eg: If P did not appear on the options
        list, then, if the user queries the CL via GetOpt and no "P" was there, it
        would default to (say) "ps"; "S" - would be the script
        name ; "V" - NCL version which would be a string.
     
      
        examples, the defaults for predefined option are in [...]
        
           fil = GetOpt("F" , "string") ; -F foo.nc ["missing"]
           pType = GetOpt("P" , "string") ; -P X11 ["ps"]
           sName = GetOpt("S" , "string") ; -S ["missing"]
           vName = GetOpt("V" , "string") ; -V
           n = GetOpt("navg" , "integer") ; -navg 5
           con = GetOpt("constant", "float") ; -con 3.75
           cyc = GetOpt("cyclic" , "logical") ; -cyclic True

        non-predefined options can be set to the NCL default type
      
                  fruitType = GetOpts("fruit", "string")
                  
        and if "fruit" was not on the CL then fruitType would be
        set to "missing" which is the default _FillValue for a
        variable of type string.
        
        
    (5) A nice feature might be to allow wild cards on the CL
      
               -F foo1.nc,foo2.nc,foo3.nc [explicit file naming]
               -F foo*.nc [wild card]
               -F foo[1-3].nc [another wild card]
      
               fils = GetOpt("F" , "string")
               
    (6) Most users are not aware of the single and/or double dash
        options and will cheerfully [ :-) ] adapt to whatever is presented.

    (7) More sophisticated approaches, such as, getting all the options
        at once would be nice but, IMHO, not at the expense of delayed
        implementation of CLOs.

            options = ("option-1", "option-2", ... "option-N")

        Since NCL does not allow arrays of mixed type [ie, structures],
        "options" would be an array of strings.
        
        
    Comments to ncl-talk are welcome.

    Dennis Shea

    _______________________________________________
    ncl-talk mailing list
    ncl-talk AT ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Wed Feb 25 2004 - 07:53:57 MST