Reading Group of files

Guilherme Martins jgmsantos at GMAIL.COM
Wed Feb 24 10:06:01 EST 2010


Try something like

For example, you have file this way:

u.1990.nc
u.1991.nc
u.1992.nc

Just do it:

'sdfopen u.1990.nc u.%y4.nc 100'
'd variable'

u.1990.nc = your fist nc file
u.%y4.nc = your template
100          = numbers times you want display

Guilherme.



2010/2/24 hersala <hersala at gmail.com>

> Hi MMME:
>
> As far as I know, it is possible to open several files (at least .nc files)
> using Templates. Please see
> http://www.iges.org/grads/gadoc/gadocindex.html for details.
> In my case I used two files to do that, one control file and a txt file
> with some command lines. I have attached both files, perhaps it serves you
> as example.
> Cheers,
>
> Hernán Sala
> DCT-IAA
>
>
> 2010/2/23 MMME <mhsanabary9 at yahoo.com>
>
> Hi
>>    I have group of files and I want to read all of them by one script. Is
>> it possible?
>>
>> I have:
>>
>> i=1
>> while (i < 9) 'sdfopen BlueNILEB-6i-ECMWF.nc'
>> 'set prnopts %10.8
>> 'set lat
>> 'set lon
>> 'set t 1
>>
>>
>> 'd
>> ascii = result
>> asciifile = 'precipitation.asc'
>> numbers = sublin(result,2)
>> if (numbers != '')
>> rc = write (asciifile,numbers)
>> else
>> say 'no ascii data to write'
>> return
>> endif
>> * write out remaining ascii data
>> i=3
>> while(1)
>> numbers = sublin(result,i)
>> if (numbers != '')
>> rc = write (asciifile,numbers,append)
>> else
>> break
>> endif
>> i = i+1
>> endwhile
>> rc = close(asciifile)
>> say 'return code from close is:'rc'set gxout print'e1
>> 1'7.5'35'1461'(cp+lsp+sf)*1000/60/60/6''set gxout contour'
>> 'd cp'i = i + 1
>> endwhile
>>
>>
>>
>>
>


-- 
-----------------------------------------------------------
José Guilherme Martins dos Santos
Grupo de Modelagem da Atmosfera e Interfaces - GMAI
Divisão de Modelagem e Desenvolvimento - DMD
Centro de Previsão de Tempo e Estudos Climáticos - INPE
Rodovia Presidente Dutra, km 39 - CEP 12630-000
Cachoeira Paulista, SP, Brasil
Telefone(CP): +55 12 3186 8502
Celular(SJC): +55 12 91678770 / +55 12 81528580
E-mail: guilherme.martins at cptec.inpe.br
E-mail alternativo: jgmsantos at gmail.com
Homepage: http://guilhermemartins.hd1.com.br/
-----------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100224/1b010c4c/attachment.html 


More information about the gradsusr mailing list