From: Arlindo da S. <da...@al...> - 2008-09-11 04:02:45
|
Jose, I took at your implementation. Your README file appears to describe the API, so I'll comment on this, although I'll disclose that I know very little about TCL. grads::init [-options <grads_options>] [-prompt <grads_prompt>] \ [-undef <symbol>] Defaults: -options "-l -b" -prompt "ga->" -undef "?" Must be called first. Why do you need to specify a prompt? The -u option writes out markers so that you can determine when commands start and end, without the need to rely on the propmpt for that. proc grads::end {} Must be called last. proc grads::open {ctlfile} Must be called after grads::init and before any of other functions. The Open method that gerl/pygrads implement take a file name an optional file type, and can do a open, sdfopen or xdfopen depending on the extension. Usually nthe file type can be guessed from the file name. proc grads::exec {args} Sends a command to GrADS for execution. The resulting output from GrADS is saved in an internal variable, and it can retrieved by the following three functions: grads::value grads::output grads::output_list grads::output_line grads::output_word A couple of comments; this method is called "cmd" in gerl/python. These interfaces define 2 functions rline(i) and rword(i,j) to get to the output. I'd suggest have functions of the same name (you can keep the others), and taking the same arguments (yours already do), and these arguments having the same range: lines and words start at "1", not zero. This is important to allow translating functions from gerl/python into tcl. (It is much easier f you do not have to change offsets of indices.) proc grads::value {} Returns the result value from the last command excuted by GrADS (e.g., d tmpprs). If the last command did not correspond to a variable evaluation, the return value is the "undef" parameter ("?" by default). proc grads::output {} Returns the entire output result of GrADS after a call to grads::exec as a single text string. proc grads::output_list {} Returns the output result of GrADS after a call to grads::exec, with the text split in lines as a tcl list. proc grads::output_line {lineindex} Returns the line indexed by $lineindex from the output list. proc grads::output_word {lineindex wordindex} Returns the word indxed by $wordindex from the line indexed by $lineindex. See above. proc grads::evalvar {varname} Returns the result of evaluation of a variable by GrADS. Do you mean an array? How are you exchanging data with grads? Are you using bi-directional pipes, named pipes (FIFOs) or disk transfer files? Gerl/pygrads uses bi-directional pipes; up to recently I exclusively used the IPC extension for data exchange through strdin/stdout, but in pygrads 1.1.0 I start using 'fwrite' to stdout (set fwrite -) with grads v2.0.a3; named pipes did not work in versions prior to 2.0.a3, bit work now. proc grads::get_sizes {array_name} Fills the array (passed in the argument by name) with the various sizes of the data file: number of longitude points (nx) number of latitude points (ny) number of levels (nz) number of times (nt) lon1, lon2, lat1, lat2 In gerl/pygrads I implement a generic query() functions that captures the result of the grads query command. Your function is similar to query("dims"). proc grads::get_levels {level_list} Returns a (tcl) list of the levels in the file (the argument must be passed by name). proc grads::get_times {times_list} Returns a (tcl) list of the forecast times in the file (the argument must be passed by name). See the coords() method in pygrads (gacore.py), not yet implemented in perl. This function returns the value of all ccordinates. How to do you currently retrieve the non-uniform latitudes of a gaussian grid? I checked in your code to contrib/interfaces/tcl; I added a few standard files (such as ChangeLog), but these are blank. Arlindo Define 'gacvs' as an alias to cvs -z3 -d:ext:da...@op...:/cvsroot/opengrads then, check out the code as: % gacvs co -P contrib % cd contrib/interfaces/tcl -- Arlindo da Silva da...@al... |