problems read binary grads file with a fortran file

Isilda da Cunha Menezes isilda at UEVORA.PT
Thu Jul 31 06:27:14 EDT 2008


Hello!
I have a problem when I try to read with a fortran program  the binary
data generated by the grads that extracts with the fwrite.


I extracts the data as follows:

'open prec-temp-mocamb_g3.ctl'
'set gxout fwrite'
'set fwrite -le mocambique.gra'
'set lon -8.967 -7.077'
'set lat 36.999 38.511'

************precipitacao******
t=2
while(t<746)
'set t 't
'set z 1'

'd (totpcp-totpcp(t-1))+(acccon-acccon(t-1))'

************temperature********
'set z 1'

'd tempc'

* Fim do loop no tempo
t=t+1
endwhile

*'disable fwrite'
'quit'




And I read the data created in a fortran program as follows:


      program ler

      real a(42,42),x(42,42,2,24,31)
      integer var,dia,hora,lat,long,soma,j,id,imi,imf,hour

      open(11,file='mocambique.gra',status='old',form='unformatted')
      open(12,file='dados-mocamb.dat',status='new',form='formatted')

      do hour=1,744
      do var=1,2
      read(11) ((a(long,lat),long=1,42),lat=1,42)
      enddo
      enddo
      write(*,*)'estou aqui'

But get an error of core dump. I tried reading the matrix of different
ways, but always get the same error. This file .gra is read  directly with
a fortran program or will have to use another method? If not needed,
someone could indicate me where I have the error?

Best regards,
Isilda



More information about the gradsusr mailing list