Re: read fortan binary file

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 06 2010 - 06:41:01 MDT

http://www.ncl.ucar.edu/Document/Functions/Built-in/fbindirread.shtml

   do i=0,364
      x = fbindirread(filename, i, -1, "float") ; x(:)=>x(Nsta)
        :
        :
   end do

or

   Nsta = ...
   Nday = 365
   x = new( (/Nday,Nsta/), "float")

   do i=0,Nday-1
      x(i,:) = fbindirread(filename, i, -1, "float")
   end do

If you are reading the file on a different system than it was created
on, you *may* need to use
     setfileoption("bin","ReadByteOrder","LittleEndian")
or
     setfileoption("bin","ReadByteOrder","BigEndian")

http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml

On 10/6/10 1:44 AM, Mehmet Coskun wrote:
> How can I read fortran binary file by NCL which has written below,
>
> array type;
> type cell1
> real(4),dimension(:),allocatable :: Var end type cell1
> type(cell1),dimension(:),allocatable :: daily
> !allocate array
> allocate(daily(1:365))
> do i=1,365
> allocate(daily(i)%Var(Nsta))
> end do
>
> do j=1,365
> open (unit=100, file=trim(filename), form='unformatted',
> access='direct', status='unknown', recl=4*Nsta) ! 4 bytes / cell (real 4)
> write (100,rec=k) daily(j)%Var(:)
> end do
>
>
> thank you
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 6 06:41:06 2010

This archive was generated by hypermail 2.1.8 : Wed Oct 06 2010 - 09:53:35 MDT