[MITgcm-devel] Re: notice the last checkin?
Chris Hill
cnh at mit.edu
Tue Jul 20 13:48:16 EDT 2004
Unfortunately I think Ed is right i.e. endianess also applies to integers so
the implied do loop would have a problem with g77. Apart from netCDF other
options are
(1) the PGI compiler allows you request byte swapping I/O.
(2) Matlab can be used to swap bytes offline.
Chris
> -----Original Message-----
> From: mitgcm-devel-bounces at mitgcm.org
> [mailto:mitgcm-devel-bounces at mitgcm.org] On Behalf Of Ed Hill
> Sent: Tuesday, July 20, 2004 12:53 PM
> To: MITgcm-devel
> Subject: [MITgcm-devel] Re: notice the last checkin?
>
> On Tue, 2004-07-20 at 12:27, Andrea Molod wrote:
> > hi ed,
> > just wanted to make sure you took notice of the last
> checkin i did for
> > fizhi. it now does the byteswapping if it needs to. i
> forget whether
> > its big_endian or little_endian, but i know that if you
> make a file on
> > a dell you need to do the byteswapping before writing to
> get it all to
> > come out ok. AND that the files you will read from my data/bcs
> > directory were created on an SGI so need to be byteswapped
> to be read
> > on the linux box.
>
>
> Hi Andrea,
>
> I'm moving this over to the devel list since I'd like Chris
> to see it and am hoping he will correct me if I'm wrong. [Please!]
>
> The byte-swapping needs to be done for all variables that
> have a size greater than one byte. Thus, code such as:
>
> ====== pkg/fizhi/update_ocean_exports.F : Lines 653--661 ======
>
> read(iunit,rec=nrec,err=500) cname, cdscrip,
> . im_32, jm_32, npx_32, npy_32, lat0_32, lon0_32,
> . ndatebc_32, undef_32,
> . (nymdbc_32(i), nhmsbc_32(i), i=1,ndatebc_32)
> #ifdef _BYTESWAPIO
> call MDS_BYTESWAPR4( 1, lat0_32)
> call MDS_BYTESWAPR4( 1, lon0_32)
> call MDS_BYTESWAPR4( 1, undef_32)
> #endif
>
> ====== pkg/fizhi/update_ocean_exports.F : Lines 653--661 ======
>
> will not work with the same input files on both big- and
> little-endian systems because all the variables (including
> the "integer*4 ndatebc_32"
> in the implied read loop) must be byte-swapped before they
> can be used.
>
> This byte-swapping problem is one of the many advantages of
> NetCDF since all I/O done through calls to NetCDF routines
> are (transparently to the
> caller) correctly byte-swapped.
>
> Ed
>
> --
> Edward H. Hill III, PhD
> office: MIT Dept. of EAPS; Rm 54-1424; 77 Massachusetts Ave.
> Cambridge, MA 02139-4307
> emails: eh3 at mit.edu ed at eh3.com
> URLs: http://web.mit.edu/eh3/ http://eh3.com/
> phone: 617-253-0098
> fax: 617-253-4464
>
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://dev.mitgcm.org/mailman/listinfo/mitgcm-devel
>
More information about the MITgcm-devel
mailing list