[Thread Prev][Thread Next][Index]

[ferret_users] Reading Fortran binary file with mixed data types.



Hi all,

 

I am kind of beginner in FERRET.

I am trying to read the data from the Fortran binary file with mixed data types.

The Fortran 95 code to create the binary file as follow:

////

open(1,file=”filename.dat”,form=”binary”)

write(1) 4 ! integer

write(1) real(1.1001), real(2.1001), 1, real(4.001)

write(1) real(1.1002), real(2.1002), 2, real(4.002)

write(1) real(1.1003), real(2.1003), 3, real(4.003)

write(1) real(1.1004), real(2.1004), 4, real(4.004)

write(1) real(1.1005), real(2.1005), 5, real(4.005)

end do

close(1)

end

////

 

The Ferret script to read the file as follow:

 

/// unformat

set data/ez/format=unf/skip=1/var=v1,v2,v3,v4/col=4 filename.dat

! Error: **TMAP ERR: Invalid argument during SKIP reads

 

/// stream

define axis/x=1:4:1 xaxis

define axis/y=1:5:1 yaxis

define grid/x=xaxis/y=yaxis mygrid

set data/ez/format=stream/skip=1/grid=mygrid/var=myvar filename.dat

! Error: **ERROR: Size of file filename.dat doesn't match size specified by variables/grid

 

-  I have tried the non-fixed data types and it’s okay. (all values are real*4)

- I have tried to compile all in real*4 (float) and then Ferret can read it

- Can Ferret read the real*8 (double)?  

- When I tried to compile in real*8 (double) and then Ferret cannot read it correctly.

 

 

John

 


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement