Re: File variable string references

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon, 17 Aug 2009 14:47:10 -0600

Hi Sara,
I think this will do what you want:

copy_VarCoords(vctlavg,prob)
tname = "t"+names(i)
out->$tname$ = prob

Adam

Sara Rauscher wrote:
> Hello,
> 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 (rank.ge.2) then
> print("Variable Name: " + names(i))
> vctlavg = ctlavg->$names(i)$
> vexpavg = expavg->$names(i)$
> vctlstd = ctlstd->$names(i)$(0,:,:)
> vexpstd = expstd->$names(i)$(0,:,:)
> prob=
> 100*(1-ttest(vexpavg,vexpstd^2,100,vctlavg,vctlstd^2,100,True,False))
> copy_VarCoords(vctlavg,prob)
> 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
>

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 17 2009 - 14:47:10 MDT

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