File variable string references

From: Sara Rauscher <rauscher_at_nyahnyahspammersnyahnyah>
Date: Mon, 17 Aug 2009 14:41:22 -0600

I am running a script where I read in a file, and use "getfilevarnames"
to determine variable names. If the variables have 2 or more dimensions
I then process further, like this:

  names = getfilevarnames( ctlavg )
    do i = 0, dimsizes( names ) - 1
     rank = dimsizes(dimsizes(ctlavg->$names(i)$)) ; # of dimensions
     if ( then
     print("Variable Name: " + names(i))
     vctlavg = ctlavg->$names(i)$
     vexpavg = expavg->$names(i)$
     vctlstd = ctlstd->$names(i)$(0,:,:)
     vexpstd = expstd->$names(i)$(0,:,:)
     out->$names(i)$ = prob

This seems to be work, but I want to change the output variable name so
that it is not just $names(i)$ but the variable name with a "t" in front
of it or something like that. I've tried putting quotes around the names
and using plus signs but I am not sure 1) if this is possible and 2)
what the syntax would be. I know I could do this with a shell script
where I pass the variable names through the shell and process one at a
time that way, but I'd like to process all the variables within the ncl
script itself.

thanks for any help.

Sara A. Rauscher
T-3 Fluid Dynamics
MS B216
Los Alamos National Lab
Los Alamos, NM 87545 USA
(505) 606-0512
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Mon Aug 17 2009 - 14:41:22 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 24 2009 - 11:15:23 MDT