NOAA-EMC / NCEPLIBS-bufr

The NCEPLIBS-bufr library contains routines and utilites for working with the WMO BUFR format.
Other
44 stars 19 forks source link

why do we have a fortran_close() function? #419

Closed edwardhartnett closed 8 months ago

edwardhartnett commented 1 year ago

We have:

!> Close a Fortran file on the local system.
!>
!> @param[in] lunit - integer: Fortran logical unit number for Fortran file
!> @param[out] iret - integer: return code from the Fortran close statement
!>
!> @author Jeff Whitaker @date 2015-08-30
recursive subroutine fortran_close(lunit, iret)

  use modv_im8b

  implicit none
  integer, intent(in)  :: lunit
  integer, intent(out) :: iret
  integer my_lunit

! check for i8 integers

  if(im8b) then
     im8b=.false.

     call x84(lunit,my_lunit,1)
     call fortran_close(my_lunit,iret)
     call x48(iret,iret,1)

     im8b=.true.
     return
  endif

  close(lunit, iostat=iret)
  return
end

Why can't the fortran close() statement be used directly?

jbathegit commented 1 year ago

fortran_open and fortran_close are used in the python layer, so that a python application can open or close a fortran file with just a simple and abstract call to a wrapper. That's why Jeff W. originally wrote them.

I agree that they're superfluous for use with fortran applications.

edwardhartnett commented 1 year ago

That's not great. Is there no other way for python to open a file?

We should not have to support these extra functions.

@jswhit any comments welcome...

edwardhartnett commented 1 year ago

@jswhit any comments welcome...