NCEPLIBS-bacio  2.6.0
bafrio.F90 File Reference

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.

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.

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 33 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.

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 65 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.

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 137 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.

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 170 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.

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 212 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.

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 244 of file bafrio.F90.

References bawritel(), and chk_endianc().

Referenced by bafrwrite().