Hi Lev,It looks like ferret writes individual numbers rather than arrays. I don't have V6.93 installed but for V6.842 and V6.96 this looks to be true.
list/file=myfile.bin/clob/form=unf i[i=1:2]results in a file 32 bytes long. i.e. two records of 8 bytes and the before/after padding with 4 byte record length markers. This is doubling the size of the file. An octal dump confirms this.
Your monolithic write appears to be the right size for a double precision write (1.87GB=21061*110801*8). The larger file corresponds to 21061*110801 individual records being written (Ugh!).
Try something like od -j 4 -t f8 GEBCO_2D_1min.bincollatrec | moreto look at the first few entries. You should see the correct elevations in the second column of output.
Your real*8 read should have resulted in the correct value for rh1(1) but rubbish for rh1(2). Is this correct? If not then there may be an endian issue.
Cheers, Russ On 20/01/16 05:20, Lev Tarasov wrote:
Hi Ansley; I had already tried reading the data as real*8, and just reading the first field value gave a garbled result: 1.857317845909682E-313 (supposed to be -4227.) and INTEGER, PARMETER :: nlond=360*60+1 real*8 rh1(nlond) read(iu) rh1(1:2) gives: Fortran runtime error: Short record on unformatted read version FERRET v6.93 Linux 2.6.9-89.ELsmp 64-bit - 11/18/14 Lev Tarasov - Dept of Physics and Physical Oceanography, Memorial University of Newfoundland. email: lev@xxxxxx http://www.physics.mun.ca/~lev/ Tel (709)-864-2675 Fax (709)-864-8739 On Tue, 19 Jan 2016, Ansley C. Manke wrote:Hi Lev,Double -precision Ferret will write double-precision output. So that would be the first thing to test; perhaps write some small test files and read the data using a short Fortran test program, reading into variables declared as real*8.There is not an option to write single-precision data with double-precision versions of Ferret; binary and stream file IO is in Ferret but not actively supported.Ansley On 1/19/2016 7:39 AM, Lev Tarasov wrote:Should have checked the output first: Ferret Binary output is garbled when read in fortran: file was output in ferret as set region /J=10801 LIST /FORMAT=UNF/FILE=GEBCO_2D_1min.bincollatrec ELEVATION can regionrepeat /J=10800:1:-1 LIST /FORMAT=UNF/APP/FILE=GEBCO_2D_1min.bincollatrec ELEVATIONand the data set should have 21601 entries from just the first list command:1> ./GEBCO_global_2D_1min.nc (default)name title I J K L M NELEVATIONElevation relative to sea level 1:21601 1:10801 ... ... ... ...in my fortran code I have: real*4 rh1(nlond) .. open(unit=iu,file=fname,FORM='UNFORMATTED',status='old') read(iu) rh1(1:2) print *, rh1(1:2) -5.515991 1.1210388E-44 but this does not match the source data: yes? list ELEVATION[i=1:2,j=10801] 180E / 1: -4227. 179.983W / 2: -4227. And if I try to read the first first 5 values of the binary data, I get an runtime error: Fortran runtime error: Short record on unformatted read What gives? Cheers, Lev Tarasov - Dept of Physics and Physical Oceanography, Memorial University of Newfoundland. email: lev@xxxxxx http://www.physics.mun.ca/~lev/ Tel (709)-864-2675 Fax (709)-864-8739 On Tue, 19 Jan 2016, Lev Tarasov wrote:Hi all; to facilitate reuse of some old code, I needed to converta netcdf DEM to binary, with sequential records for each latitude (and colatitude ordering):ie: set region /J=10801 LIST /FORMAT=UNF/FILE=GEBCO_2D_1min.bincollatrec ELEVATION can regionrepeat /J=10800:1:-1 LIST /FORMAT=UNF/APP/FILE=GEBCO_2D_1min.bincollatrec ELEVATIONthis gave -rw-r----- 1 3732998416 Jan 19 10:50 GEBCO_2D_1min.bincollatrec This nearly doubled the size of the file compared to simply LIST /FORMAT=UNF/FILE=GEBCO_2D_1min.bin ELEVATION -rw-r----- 1 1866585616 Jan 19 09:04 GEBCO_2D_1min.bin Why the doubling? Cheers, Lev Lev Tarasov - Dept of Physics and Physical Oceanography, Memorial University of Newfoundland. email: lev@xxxxxx http://www.physics.mun.ca/~lev/ Tel (709)-864-2675 Fax (709)-864-8739