NCEPLIBS-bacio  2.5.0
bafrio.f90 File Reference

This version of bafrio.f is revised to have byteswap in FORTRAN data file control words. More...

Go to the source code of this file.

Functions/Subroutines

subroutine bafrindex (LU, IB, LX, IX)
 This subprogram calls bafrindexl() to either read an unformatted fortran record and return its length and start byte of the next fortran record; or given the record length, without I/O it determines the start byte of the next fortran record. More...
 
subroutine bafrindexl (LU, IB, LX, IX)
 This subprogram either reads an unformatted fortran record and return its length and start byte of the next fortran record; or given the record length, without i/o it determines the start byte of the next fortran record. More...
 
subroutine bafrread (LU, IB, NB, KA, A)
 This subprogram calls bafread() to read an unformatted fortran record. More...
 
subroutine bafrreadl (LU, IB, NB, KA, A)
 This subprogram reads an unformatted fortran record. More...
 
subroutine bafrwrite (LU, IB, NB, KA, A)
 This subprogram calls bafrwrite() to write an unformatted fortran record. More...
 
subroutine bafrwritel (LU, IB, NB, KA, A)
 This subprogram writes an unformatted fortran record. More...
 

Detailed Description

This version of bafrio.f is revised to have byteswap in FORTRAN data file control words.

It is designed to be run on on WCOSS(little endian machine) and to generate big endian files.

It does byteswap on fortran record control words (4 byte integer before and after data field), not on data field itself. Users need to byteswap their data after (for reading) or before (for writing) calling subroutines this file.

Program History Log

Date Programmer Comments
1999-01-21 iredell Initial.
Aug, 2012 Jun Wang bafrio for big and little endian files
Author
Mark Iredell
Date
1999-01-21

Definition in file bafrio.f90.

Function/Subroutine Documentation

◆ bafrindex()

subroutine bafrindex ( integer, intent(in)  LU,
integer, intent(in)  IB,
integer, intent(inout)  LX,
integer, intent(out)  IX 
)

This subprogram calls bafrindexl() to either read an unformatted fortran record and return its length and start byte of the next fortran record; or given the record length, without I/O it determines the start byte of the next fortran record.

The difference between bafrindex() and bafrindexl() is the kind type of integers in the argument list.

Program History Log

Date Programmer Comments
1999-01-21 Mark Iredell Initial
2009-04-20 Jun Wang Changes
Parameters
[in]lulogical unit to read. if lu<=0, then determine ix from lx.
[in]ibfortran record start byte. (for the first fortran record, ib should be 0).
[in,out]lxrecord length in bytes if lu<=0. If lu>0, or lx=-1 for i/o error (probable end of file), or lx=-2 for i/o error (invalid fortran record).
[out]ixstart byte for the next fortran record. (computed only if lx>=0).
Author
Mark Iredell
Date
1999-01-21

Definition at line 44 of file bafrio.f90.

References bafrindexl().

◆ bafrindexl()

subroutine bafrindexl ( integer, intent(in)  LU,
integer(kind=8), intent(in)  IB,
integer(kind=8), intent(inout)  LX,
integer(kind=8), intent(out)  IX 
)

This subprogram either reads an unformatted fortran record and return its length and start byte of the next fortran record; or given the record length, without i/o it determines the start byte of the next fortran record.

Program History Log

Date Programmer Comments
1999-01-21 Mark Iredell Initial
2009-04-20 Jun Wang Changes
Parameters
[in]lulogical unit to read. if lu<=0, then determine ix from lx.
[in]ibfortran record start byte. (for the first fortran record, ib should be 0).
[in,out]lxrecord length in bytes if lu<=0. If lu>0, or lx=-1 for i/o error (probable end of file), or lx=-2 for i/o error (invalid fortran record).
[out]ixstart byte for the next fortran record (computed only if lx>=0).
Author
Mark Iredell
Date
1999-01-21

Definition at line 83 of file bafrio.f90.

References bareadl(), and chk_endianc().

Referenced by bafrindex(), and bafrreadl().

◆ bafrread()

subroutine bafrread ( integer, intent(in)  LU,
integer, intent(in)  IB,
integer, intent(in)  NB,
integer, intent(out)  KA,
character, dimension(nb), intent(out)  A 
)

This subprogram calls bafread() to read an unformatted fortran record.

The difference between bafrread() and bafrreadl() is the kind type of integers in the argument list.

Program History Log

Date Programmer Comments
1999-01-21 Mark Iredell Initial
2009-04-20 Jun Wang Changes
Parameters
[in]lulogical unit to read.
[in]ibfortran record start byte (for the first fortran record, ib should be 0).
[in]nbnumber of bytes to read.
[out]kanumber of bytes in fortran record (in which case the next fortran record should have a start byte of ib+ka),
  • or ka=-1 for i/o error (probable end of file),
  • or ka=-2 for i/o error (invalid fortran record),
  • or ka=-3 for i/o error (request longer than record)
[out]adata read
Author
Mark Iredell
Date
1999-01-21

Definition at line 162 of file bafrio.f90.

References bafrreadl().

◆ bafrreadl()

subroutine bafrreadl ( integer, intent(in)  LU,
integer(kind=8), intent(in)  IB,
integer(kind=8), intent(in)  NB,
integer(kind=8), intent(out)  KA,
character, dimension(nb), intent(out)  A 
)

This subprogram reads an unformatted fortran record.

Program History Log

Date Programmer Comments
1999-01-21 Iredell Initial
2009-04-20 Jun Wang Changes
Parameters
[in]lulogical unit to read.
[in]ibfortran record start byte. (For the first fortran record, ib should be 0.)
[in]nbnumber of bytes to read.
[out]kanumber of bytes in fortran record (in which case the next fortran record should have a start byte of ib+ka),
  • or ka=-1 for i/o error (probable end of file),
  • or ka=-2 for i/o error (invalid fortran record),
  • or ka=-3 for i/o error (request longer than record)
[out]adata read.
Author
Mark Iredell
Date
1999-01-21

Definition at line 202 of file bafrio.f90.

References bafrindexl(), and bareadl().

Referenced by bafrread().

◆ bafrwrite()

subroutine bafrwrite ( integer, intent(in)  LU,
integer, intent(in)  IB,
integer, intent(in)  NB,
integer, intent(out)  KA,
character, dimension(nb), intent(in)  A 
)

This subprogram calls bafrwrite() to write an unformatted fortran record.

The difference between bafrwrite() and bafrwritel() is the kind type of integers in the argument list.

Program History Log

Date Programmer Comments
1999-01-21 Iredell Initial
2009-04-20 Jun Wang Changes
Parameters
[in]lulogical unit to write to.
[in]ibfortran record start byte. (For the first fortran record, ib should be 0.)
[in]nbnumber of bytes to write.
[out]kanumber of bytes in fortran record (in which case the next fortran record should have a start byte of ib+ka), or ka=-1 for i/o error.
[in]adata to write.
Author
Mark Iredell
Date
1999-01-21

Definition at line 251 of file bafrio.f90.

References bafrwritel().

◆ bafrwritel()

subroutine bafrwritel ( integer, intent(in)  LU,
integer(kind=8), intent(in)  IB,
integer(kind=8), intent(in)  NB,
integer(kind=8), intent(out)  KA,
character, dimension(nb), intent(in)  A 
)

This subprogram writes an unformatted fortran record.

Program History Log

Date Programmer Comments
1999-01-21 Iredell Initial
2009-04-20 Jun Wang Changes
Parameters
[in]lulogical unit to write to.
[in]ibfortran record start byte. (For the first fortran record, ib should be 0.)
[in]nbnumber of bytes to write.
[out]kainteger number of bytes in fortran record (in which case the next fortran record should have a start byte of ib+ka), or ka=-1 for i/o error.
[in]adata to write.
Author
Mark Iredell
Date
1999-01-21

Definition at line 290 of file bafrio.f90.

References bawritel(), and chk_endianc().

Referenced by bafrwrite().