Re: write binary

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 6 Sep 2006 07:05:23 -0600 (MDT)

> I am wondering if the following fortran and NCL commands are equivalant.
>
> Fortran:
> open(nfic,file=ficodem,form='unformatted')
> write(nfic)float(year),float(month),float(day),1.,0.
> write(nfic)((v(jlo,ila),jlo=nlod,nlof),ila=nlad,nlaf)
>
> NCL:
> dateF = (/year,month,day,1.,0./)
> fbindirwrite(outpath, dateF )
> fbindirwrite(outpath, v({nlod:nlof},{nlad:nlaf}))
>
> But, both the outputs show different file sizes!
> Any help is greatly appreciated.
>_________________________________________________

No. They are not.
     The above Fortran writes unformatted *sequential*
     (not direct) binary records. Logical records are
     separated by embedded record length information.

fbindirwrite: Writes binary records to a file in manner
               analogous to fortran's "access=direct".
               All records must be the same size.
               These are flat binary files: ie, no
               record separating information is embedded.

fbinrecwrite: Writes a single unformatted sequential access
               Fortran record to a file. This allows for mixed
               length [and type] records. Each logical record is
               separated by embedded record separating information
               eg: the length of the record

The following should be equivalent:

  fbinrecwrite (outpath, -1, dateF)
  fbinrecwrite (outpath, -1, v({nlod:nlof},{nlad:nlaf}))

The file size will be slightly larger than the size
of dateF and the v subset due to the embedded record information.

Good luck
D
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 06 2006 - 07:05:23 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 06 2006 - 10:52:20 MDT