[ncl-talk] looping over index in the name of a variable
Ioana Colfescu
ioana.colfescu at ed.ac.uk
Wed Oct 21 08:04:10 MDT 2015
Hi,
Thanks lots ! I also found a way using getfilevarnames:
names1 = getfilevarnames(data[0])
names=names1(3:)
do i=0,dimsizes(names)-1
cont1(i,:,:) = data[0]->$names(i)$
cont2(i,:,:) = data[1]->$names(i)$
end do
Ioana
On 21/10/15 15:01, Alan Brammer wrote:
> 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
>
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the ncl-talk
mailing list