LCOV - code coverage report
Current view: top level - hemco/HEMCO/src/Shared/NcdfUtil - hco_m_netcdf_io_get_dimlen.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 16 0.0 %
Date: 2024-12-17 17:57:11 Functions: 0 2 0.0 %

          Line data    Source code
       1             : !------------------------------------------------------------------------------
       2             : !       NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group        !
       3             : !                      and NASA/GSFC, SIVO, Code 610.3                        !
       4             : !------------------------------------------------------------------------------
       5             : !BOP
       6             : !
       7             : ! !MODULE: HCO_m_netcdf_io_get_dimlen
       8             : !
       9             : ! !INTERFACE:
      10             : !
      11             : module HCO_m_netcdf_io_get_dimlen
      12             : !
      13             :   implicit none
      14             : !
      15             : ! !PUBLIC MEMBER FUNCTIONS:
      16             : !
      17             :   public  Ncget_Dimlen
      18             :   public  Ncget_Unlim_Dimlen
      19             : !
      20             : ! !DESCRIPTION: Provides routines to obtain the length of a given dimension.
      21             : !\\
      22             : !\\
      23             : ! !AUTHOR:
      24             : !  Jules Kouatchou
      25             : !
      26             : ! !REVISION HISTORY:
      27             : !  See https://github.com/geoschem/hemco for complete history
      28             : !EOP
      29             : !------------------------------------------------------------------------------
      30             : !BOC
      31             : CONTAINS
      32             : !EOC
      33             : !------------------------------------------------------------------------------
      34             : !       NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group        !
      35             : !                      and NASA/GSFC, SIVO, Code 610.3                        !
      36             : !------------------------------------------------------------------------------
      37             : !BOP
      38             : !
      39             : ! !IROUTINE: Ncget_Dimlen
      40             : !
      41             : ! !INTERFACE:
      42             : !
      43           0 :   subroutine Ncget_Dimlen(ncid, dim_name, dim_len)
      44             : !
      45             : ! !USES:
      46             : !
      47             :     use netCDF
      48             :     use m_do_err_out
      49             : !
      50             : ! !INPUT PARAMETERS:
      51             : !!  dim_name : netCDF dimension name
      52             : !!  ncid     : netCDF file id
      53             :     character (len=*), intent(in) :: dim_name
      54             :     integer,           intent(in) :: ncid
      55             : !
      56             : ! !OUTPUT PARAMETERS:
      57             : !!  dim_len: netCDF dimension length
      58             :     integer,           intent(out)   :: dim_len
      59             : !
      60             : ! !DESCRIPTION: Returns the length of a given netCDF dimension.
      61             : !               If err\_stop is set to FALSE, -1 is returned if
      62             : !               the given dimension cannot be found. Otherwise,
      63             : !               an error is prompted and the program stops.
      64             : !\\
      65             : !\\
      66             : ! !AUTHOR:
      67             : !  John Tannahill (LLNL) and Jules Kouatchou
      68             : !
      69             : ! !REVISION HISTORY:
      70             : !  See https://github.com/geoschem/hemco for complete history
      71             : !EOP
      72             : !------------------------------------------------------------------------------
      73             : !BOC
      74             : !
      75             : ! !LOCAL VARIABLES:
      76             :     character (len=512) :: err_msg
      77             :     integer             :: dimid
      78             :     integer             :: ierr
      79             : 
      80           0 :     ierr = NF90_Inq_Dimid(ncid, dim_name, dimid)
      81             : 
      82           0 :     if (ierr /= NF90_NOERR ) then
      83             :        err_msg = 'In Ncget_Dimlen #1:  ' // Trim (dim_name) // &
      84           0 :                  ', ' // NF90_Strerror (ierr)
      85           0 :        call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0)
      86             :     end if
      87             : 
      88           0 :     ierr = NF90_Inquire_Dimension(ncid, dimid, len=dim_len)
      89             : 
      90           0 :     if (ierr /= NF90_NOERR) then
      91           0 :        err_msg = 'In Ncget_Dimlen #2:  ' // NF90_Strerror (ierr)
      92           0 :        call Do_Err_Out (err_msg, .true., 2, ncid, dimid, 0, 0.0d0, 0.0d0)
      93             :     end if
      94             : 
      95           0 :     return
      96             :   end subroutine Ncget_Dimlen
      97             : !EOC
      98             : !------------------------------------------------------------------------------
      99             : !       NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group        !
     100             : !                      and NASA/GSFC, SIVO, Code 610.3                        !
     101             : !------------------------------------------------------------------------------
     102             : !BOP
     103             : !
     104             : ! !IROUTINE: Ncget_Unlim_Dimlen
     105             : !
     106             : ! !INTERFACE:
     107             : !
     108           0 :   subroutine Ncget_Unlim_Dimlen (ncid, udim_len)
     109             : !
     110             : ! !USES:
     111             : !
     112             :     use netCDF
     113             :     use m_do_err_out
     114             : !
     115             : ! !INPUT PARAMETERS:
     116             : !!  ncid     : netCDF file id
     117             :     integer,           intent(in) :: ncid
     118             : !
     119             : ! !OUTPUT PARAMETERS:
     120             : !!  udim_len : netCDF unlimited dimension length
     121             :     integer,           intent(out) :: udim_len
     122             : !
     123             : ! !DESCRIPTION: Returns the length of the unlimited netCDF dimension.
     124             : !\\
     125             : !\\
     126             : ! !AUTHOR:
     127             : !  John Tannahill (LLNL) and Jules Kouatchou
     128             : !
     129             : ! !REVISION HISTORY:
     130             : !  See https://github.com/geoschem/hemco for complete history
     131             : !EOP
     132             : !------------------------------------------------------------------------------
     133             : !BOC
     134             : !
     135             : ! !LOCAL VARIABLES:
     136             :     character(len=512) :: err_msg
     137             :     integer            :: ierr, udim_id
     138             : 
     139           0 :     udim_len = -1
     140           0 :     ierr = NF90_Inquire(ncid, unlimitedDimId=udim_id)
     141           0 :     IF ( ierr /= NF90_NOERR ) THEN
     142           0 :        ierr = NF90_Inquire_Dimension( ncid, udim_id, len=udim_len )
     143             :     ENDIF
     144             : 
     145           0 :   end subroutine Ncget_Unlim_Dimlen
     146             : !EOC
     147             : end module HCO_m_netcdf_io_get_dimlen

Generated by: LCOV version 1.14