problems read binary grads file with a fortran file
ela at COLA.IGES.ORG
Thu Jul 31 15:21:56 EDT 2008
The problem may be that your fortran program opens unit 11 for sequential access but grads writes the fwrite file as flat binary (no control words) which would have to be read in the fortran program by direct access. Opening unit 11 for direct access is one way to solve the problem, but it is easier to tell grads to write the fwrite file sequentially by adding the -sq flag to 'set fwrite':
'set fwrite -sq -le mocambique.gra'
Also, you have specified the dimensions of the array 'a' as (42,42). Be sure that the X-Y dimensions in the grads dimension environment are also (42,42) when the fwrite file is written. It's not possible to tell from your 'set lon' and 'set lat' commands how many grid points are in the lat-lon region you have specified.
Eric L. Altshuler
Assistant Research Scientist
Center for Ocean-Land-Atmosphere Studies
4041 Powder Mill Road, Suite 302
Calverton, MD 20705-3106
E-mail: ela at cola.iges.org
Phone: (301) 902-1257
Fax: (301) 595-9793
----- Original Message -----
From: "Isilda da Cunha Menezes" <isilda at UEVORA.PT>
To: GRADSUSR at LIST.CINECA.IT
Sent: Thursday, July 31, 2008 6:27:14 AM GMT -05:00 US/Canada Eastern
Subject: problems read binary grads file with a fortran file
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:
'set gxout fwrite'
'set fwrite -le mocambique.gra'
'set lon -8.967 -7.077'
'set lat 36.999 38.511'
'set t 't
'set z 1'
'set z 1'
* Fim do loop no tempo
And I read the data created in a fortran program as follows:
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?
More information about the gradsusr