Read 3-D NCL output binary data

From: Yongxin Zhang <yongxin_at_nyahnyahspammersnyahnyah>
Date: Tue, 21 Mar 2006 18:45:03 -0700

Hello,

     I output a subset of my 4-D array, Pres(ntim, nlon, nlat, nlev)
where ntim=13, nlon=315, nlat=306 and nlev=30, as binary data using
the following NCL code

      fout = "Pres_3D.bin"

      do i = 4, 16
       fbinrecwrite(fout, -1, Pres(i, :, :, :))
      end do

and my Fortran code looks like this

        parameter(ntim=13,nlon=315,nlat=306,nlev=30)
        real pres(ntim, ?, ?, ?)

        open
(11,file="Pres_3D.bin",form="unformatted",access="sequential")

        do i = 1, 13
          read(11) pres(i, :, :, :)
         enddo

       One thing I am not sure is how to define my pres variable in
my Fortran code. I used "real pres(ntim, nlon, nlat, nlev)" but did
not get the correct data format. The NCL webpage does indicate a swap
of dimensions order for a 2-D array from the NCL code (e.g. u
(64,128)) to the Fortran code (e.g. u(128, 64)) but there is no
example for a 3-D array. Your suggestions on how to correctly define
the pres variable are greatly appreciated.

Thank you,
Yongxin
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Mar 21 2006 - 18:45:03 MST

This archive was generated by hypermail 2.2.0 : Wed Mar 29 2006 - 11:52:49 MST