[ncl-talk] looping over index in the name of a variable

Alan Brammer abrammer at albany.edu
Wed Oct 21 08:01:38 MDT 2015


See this link for more info. 
https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#StringRef

varname = ”eof"+ii+”def"
cont1w(ii,:,:)=data[0]->$varname$


Good luck, 
Alan Brammer.



> On 21 Oct 2015, at 05:58, Ioana Colfescu <ioana.colfescu at ed.ac.uk> wrote:
> 
> Hi,
> I'm trying to read a variable while looping over a number in the name of 
> the variable like :
> 
> .......................
> do ii=0,10
> cont1w(ii,:,:)=data[0]->eof+ii+djf
> end do
> 
> This syntax doesn't work - eof+ii+djf , for reading 
> eof1djf,eof2djf,eof3djf and so on doesn't work.
> Does anyone know what the correct syntax for this would be ? ( without 
> using a csh script).
> Thanks,
> Ioana
> 
> 
> -- 
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
> 
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk



More information about the ncl-talk mailing list