LCOV - code coverage report
Current view: | top level - hemco/HEMCO/src/Shared/NcdfUtil - hco_m_netcdf_io_create.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_create.F90
           8             : !
           9             : ! !INTERFACE:
          10             : !
          11             : module HCO_m_netcdf_io_create
          12             : !
          13             :   implicit none
          14             : !
          15             : ! !PUBLIC MEMBER FUNCTIONS:
          16             : !
          17             :   public  Nccr_Wr
          18             :   public  Ncdo_Sync
          19             : !
          20             : ! !DESCRIPTION: Routines for creating and syncronizing netCDF files.
          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: Nccr_Wr
          40             : !
          41             : ! !INTERFACE:
          42             : !
          43           0 :   subroutine Nccr_Wr (ncid, filname, WRITE_NC4)
          44             : !
          45             : ! !USES:
          46             : !
          47             :     use netCDF
          48             :     use m_do_err_out
          49             : !
          50             : ! !INPUT PARAMETERS:
          51             : !   ncid    : opened netCDF file id
          52             : !   filname : name of netCDF file to open for writing
          53             :     integer          , intent(INOUT) :: ncid
          54             :     character (len=*), intent(IN)    :: filname
          55             :     LOGICAL, OPTIONAL, INTENT(IN)    :: WRITE_NC4
          56             : !
          57             : ! !DESCRIPTION: Creates a netCDF file for writing and does some error checking.
          58             : !\\
          59             : !\\
          60             : ! !AUTHOR:
          61             : !  John Tannahill (LLNL) and Jules Kouatchou
          62             : !
          63             : ! !REMARKS:
          64             : !  If the netCDF4 library is used, then the NF90_CLOBBER flag will write
          65             : !  a classic (i.e. netCDF3) file.  Use OR(NF_NETCDF4,NF_CLASSIC_MODEL) to
          66             : !  create netCDF-4 file that supports compression and uses "classic"
          67             : !  netcdf data model (no groups, no user-defined types)
          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=128) :: err_msg
          77             :     integer             :: ierr
          78             :     INTEGER             :: mode
          79             :     LOGICAL             :: TMP_NC4
          80             : !
          81             :     ! Save the value of the optional WRITE_NC4 variable in
          82             :     ! a local shadow variable (bmy, 11/7/11)
          83           0 :     IF ( PRESENT( WRITE_NC4 ) ) THEN
          84           0 :        TMP_NC4 = WRITE_NC4
          85             :     ELSE
          86             :        TMP_NC4 = .FALSE.
          87             :     ENDIF
          88             :
          89           0 :     IF ( TMP_NC4 ) THEN
          90             : #if defined( NC_HAS_COMPRESSION )
          91             :        mode = IOR( NF90_NETCDF4, NF90_CLASSIC_MODEL )       ! netCDF4 file
          92             :        ierr = NF90_Create(filname, mode, ncid)              !  w/ compression
          93             : #else
          94           0 :        ierr = NF90_Create(filname, NF90_64BIT_OFFSET, ncid) ! netCDF4 file
          95             :                                                             !  w/o compression
          96             : #endif
          97             :     ELSE
          98           0 :        ierr = NF90_Create(filname, NF90_CLOBBER, ncid)      ! netCDF3 file
          99             :     ENDIF
         100             :
         101           0 :     if (ierr /= NF90_NOERR) then
         102           0 :        err_msg = 'In Nccr_Wr, cannot create:  ' // Trim (filname)
         103           0 :        call Do_Err_Out (err_msg, .true., 0, 0, 0, 0 , 0.0d0, 0.0d0)
         104             :     end if
         105             :
         106           0 :     return
         107             :
         108             :   end subroutine Nccr_Wr
         109             : !EOC
         110             : !------------------------------------------------------------------------------
         111             : !       NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group        !
         112             : !                      and NASA/GSFC, SIVO, Code 610.3                        !
         113             : !------------------------------------------------------------------------------
         114             : !BOP
         115             : !
         116             : ! !IROUTINE: Ncdo_Sync
         117             : !
         118             : ! !INTERFACE:
         119             : !
         120           0 :   subroutine Ncdo_Sync(ncid)
         121             : !
         122             : ! !USES:
         123             : !
         124             :     use netCDF
         125             :     use m_do_err_out
         126             : !
         127             : ! !INPUT PARAMETERS:
         128             : !!  ncid : netCDF file id
         129             :     integer, intent(in)   :: ncid
         130             : !
         131             : ! !DESCRIPTION: Synchronizes a netCDF file.
         132             : !\\
         133             : !\\
         134             : ! !AUTHOR:
         135             : !  John Tannahill (LLNL) and Jules Kouatchou
         136             : !
         137             : ! !REVISION HISTORY:
         138             : !  See https://github.com/geoschem/hemco for complete history
         139             : !EOP
         140             : !------------------------------------------------------------------------------
         141             : !BOC
         142             : !
         143             : ! !LOCAL VARIABLES:
         144             :     character (len=128) :: err_msg
         145             :     integer             :: ierr
         146             : !
         147           0 :     ierr = Nf90_Sync (ncid)
         148             :
         149           0 :     if (ierr /= NF90_NOERR) then
         150           0 :        err_msg = 'In Ncdo_Sync:  ' // Nf90_Strerror (ierr)
         151           0 :        call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0)
         152             :     end if
         153             :
         154           0 :   end subroutine Ncdo_Sync
         155             : !EOC
         156             : end module HCO_m_netcdf_io_create

Generated by: LCOV version 1.14