[gradsusr] define a array time series of multiple files

Jennifer M Adams jadams21 at gmu.edu
Thu Jan 5 17:57:22 EST 2017


Hi, Isilda —
With ‘define’, everything that comes before the = sign is the variable name, which must be alphanumeric. I believe the syntax you’re looking for might be something like this:

nfiles=124
i=1
while (i<=nfiles)
  if (i=1)
    ‘sum=tmp2m.’i’(t=1)’
  else
     ‘sum=sum+’tmp2m.’i’(t=1)’
  endif
  i=i+1
endwhile
'ave=sum/‘nfiles

—Jennifer

On Jan 5, 2017, at 5:36 PM, Isilda Menezes <isilda at uevora.pt<mailto:isilda at uevora.pt>> wrote:

Hello, I want created a ave in a gs script with multiple open files with the same time=1.

I made a loop like this,

i=1
while (i<124)
'set dfile 'i
'define ll(t='i')=TMP2m'
i=i+1
endwhile
'd ave(ll,t=1,t=124)'

But a have this error:

DEFINE error:  Name too long; missing '='
Syntax Error:  Invalid Operand
  'll' not a variable or function name
Operation Error:  Error from ave function
  Error ocurred at column 1
DISPLAY error:  Invalid expression
  Expression = ave(ll,t=1,t=124)
Error opening script file: cbarn.gs<http://cbarn.gs/>

I've been trying to do it in other ways but I always get errors. Can someone give me some advice how to solve this problem.

Thanks,
Isilda

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>
http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer Miletta Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
George Mason University



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20170105/2be53662/attachment-0001.html 


More information about the gradsusr mailing list