Dear all,
I read a variable from nc file and write out to a binary file, then I used
a simple Fortran code to read it. But somehow the data read from Fortran
doesn't look right. I am attaching my ncl and Fortran codes below, can
anyone see what is wrong with the codes?
many thanks in advance,
Xiaoyan
==============================
begin
   nlat  = 180
   nlon  = 360
   ntim  = 148
   setfileoption("bin","WriteByteOrder","BigEndian")
;*********************************
  fils = "data.nc"
  in = addfile(fils,"r")
  var0 = in->cldarea_daynight_mon
  cf  = var0(:,:,:)     ; all data
  printVarSummary(cf)
;  print(cf)
  fo = "11"
 do nt = 0, ntim-1
   fbindirwrite(fo,cf(nt,:,:) )
 end do
end
======================================
          parameter (nlat=180,nlon=360,ntim=148)
          real cf(nlat,nlon)
          open(10,file="11",
     &     ACCESS='direct',FORM='unformatted',recl=4*nlat*nlon)
          do nt = 1, ntim
           read(10) cf
           write(*,*) ((cf(i,j),i=1,nlat),j=1,nlon)
          enddo
          end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon May 13 08:40:03 2013
This archive was generated by hypermail 2.1.8 : Wed May 15 2013 - 10:19:28 MDT