text:
      subroutine evol_alphaopl(n_K,n_alpha,np1_K,np1_alpha,x,Nx,gma,gmb,
     &ht,myzero,phys_bdy,res)
      implicit none
      integer i
      integer Nx
      real*8 gma
      real*8 gmb
      real*8 ht
      real*8 myzero
      real*8 n_K(Nx)
      real*8 n_alpha(Nx)
      real*8 np1_K(Nx)
      real*8 np1_alpha(Nx)
      real*8 x(Nx)
      integer phys_bdy(2)
      real*8 res(Nx)
      real*8 qb
      if (phys_bdy(1) .eq. 1) then
      do i=1, 1, 1
      qb = np1_alpha(i) - 0.2D1 / (gma * np1_alpha(i) ** gmb * gmb * np1
     #_K(i) * ht + 0.2D1 * np1_alpha(i)) * ht * np1_alpha(i) * ((-0.1D1
     #* n_alpha(i) + np1_alpha(i)) / ht + 0.5000000000000000D0 * gma * n
     #p1_alpha(i) ** gmb * np1_K(i) + 0.5000000000000000D0 * gma * n_alp
     #ha(i) ** gmb * n_K(i))
      res(i)=qb
      end do
      endif
      do i=2, Nx-1, 1
      qb = np1_alpha(i) - 0.2D1 / (gma * np1_alpha(i) ** gmb * gmb * np1
     #_K(i) * ht + 0.2D1 * np1_alpha(i)) * ht * np1_alpha(i) * ((-0.1D1
     #* n_alpha(i) + np1_alpha(i)) / ht + 0.5000000000000000D0 * gma * n
     #p1_alpha(i) ** gmb * np1_K(i) + 0.5000000000000000D0 * gma * n_alp
     #ha(i) ** gmb * n_K(i))
      res(i)=qb
      end do
      if (phys_bdy(2) .eq. 1) then
      do i=Nx, Nx, 1
      qb = -0.1D1 * myzero * x(i) + 0.1D1
      res(i)=qb
      end do
      endif
      END

ext: f


text:
      module e3_func_m
c
c----------------------------------------
c    aims to calculate the conservative
c    and primitive variables for the
c    interior elements
c----------------------------------------
        use conpar_m
        use elmpar_m
        use genpar_m
        use e3_param_m
        use eqn_state_m
        use shpdat_m
        use intpt_m
        use e3metric_m
        implicit none
c
        real*8, dimension(:), pointer :: detJ
        real*8, dimension(:,:,:), pointer :: yl,xl
c
      contains
c
      subroutine e3_int_conserv(s,shp,shgl,sgn)
        implicit none
        real*8, dimension(:,:), pointer :: s
        real*8, dimension(nshl,ngauss), intent(in) :: shp
        real*8, dimension(nsd,nshl,ngauss), intent(in) :: shgl
        integer, dimension(npro,nshl), intent(in) :: sgn
c
        integer :: iflow
        real*8 :: shp_qpt(npro,nshl)
        real*8 :: dui(npro,nflow)
c        real*8 :: dxidx(npro,nsd,nsd)
        real*8, dimension(:), pointer :: WdetJ
        real*8, dimension(:,:,:), pointer :: shg_qpt, shgl_qpt
        real*8, dimension(:,:,:), pointer :: dxidx ! added
c
        allocate(WdetJ(npro))
        allocate(shg_qpt(npro,nshl,nsd))
        allocate(shgl_qpt(npro,nsd,nshl))
        allocate(dxidx(npro,nsd,nsd)) !added
c
        s = zero
c
        do intp = 1,ngauss
c
          call getshp(shp, shgl, sgn, shp_qpt, shgl_qpt)
          call calc_primitive(dui,shp_qpt)
          call getthm6_ptr
          call calc_conservative(dui)
          call e3metric(shg_qpt,dxidx,shgl_qpt,xl)
c
c... multiply by weight
c
          do iflow = 1,nflow
            s(:,iflow) = s(:,iflow) + wdetj(:)*dui(:,iflow)
          enddo
c
        enddo
c
        deallocate(WdetJ,shg_qpt,shgl_qpt)
c
      end subroutine e3_int_conserv
c
      subroutine calc_primitive(dui,shp)
        real*8, dimension(npro,nflow), intent(out) :: dui
        real*8, dimension(npro,nshl), intent(in) :: shp
        integer :: n
        dui = zero
        do n = 1, nshl
           dui(:,1) = dui(:,1) + shp(:,n) * yl(:,n,1) ! p
           dui(:,2) = dui(:,2) + shp(:,n) * yl(:,n,2) ! u1
           dui(:,3) = dui(:,3) + shp(:,n) * yl(:,n,3) ! u2
           dui(:,4) = dui(:,4) + shp(:,n) * yl(:,n,4) ! u3
           dui(:,5) = dui(:,5) + shp(:,n) * yl(:,n,5) ! T
        enddo
        pres = dui(:,1)
        T = dui(:,5)
      end subroutine calc_primitive
c
      subroutine calc_conservative(dui)
        real*8, dimension(npro,nflow), intent(inout) :: dui
        dui(:,1) = rho
        dui(:,2) = rho * dui(:,2)
        dui(:,3) = rho * dui(:,3)
        dui(:,4) = rho * dui(:,4)
        dui(:,5) = rho * (ei + rk)
      end subroutine calc_conservative
c
      end module e3_func_m

max_stars_repo_name: SCOREC/phasta

max_issues_repo_name: SCOREC/phasta

max_forks_repo_name: SCOREC/phasta


text:
C$Procedure  DACOSH ( Double precision arc hyperbolic cosine )

      DOUBLE PRECISION FUNCTION  DACOSH ( X )

C$ Abstract
C
C      Return the inverse hyperbolic cosine of a double
C      precision argument.
C
C$ Disclaimer
C
C     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
C     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
C     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
C     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
C     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
C     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
C     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
C     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
C     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
C     SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
C
C     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
C     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
C     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
C     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
C     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
C     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
C
C     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
C     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
C     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
C     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
C
C$ Required_Reading
C
C     None.
C
C$ Keywords
C
C      HYPERBOLIC,  MATH
C
C$ Declarations

      DOUBLE PRECISION   X

C$ Brief_I/O
C
C      VARIABLE  I/O  DESCRIPTION
C      --------  ---  --------------------------------------------------
C       X         I   Number whose inverse hyperbolic cosine is desired.
C                     X must be >= 1.
C
C$ Detailed_Input
C
C      X      is any double precision number greater than or equal to 1.
C
C$ Detailed_Output
C
C      DACOSH is the inverse hyperbolic cosine of X.
C
C$ Parameters
C
C     None.
C
C$ Particulars
C
C      This function simply implements the definition of the inverse
C      hyperbolic cosine as follows:
C
C      DACOSH = DLOG (X + DSQRT (X*X-1.D0))
C
C      If the input value is not valid, an error is signalled.
C
C$ Examples
C
C      The following table gives a few values for X and the resulting
C      value of DACOSH.
C
C      X                       DACOSH(X)
C      ----------------------------------------------
C      1.000000000000000      0.0000000000000000E+00
C      10.00000000000000       2.993222846126381
C      100.0000000000000       5.298292365610485
C      1000.000000000000       7.600902209541989
C
C$ Restrictions
C
C      The value of the input variable X must be greater than or equal
C      to 1.0d0.
C
C$ Exceptions
C
C      1) If X is less than 1.0d0, the error SPICE(INVALIDARGUMENT) is
C         signalled.
C
C$ Files
C
C      None.
C
C$ Author_and_Institution
C
C      H.A. Neilan     (JPL)
C      W.M. Owen       (JPL)
C
C$ Literature_References
C
C      Any good book of mathematical tables and formulae, for example
C      the "Standard Mathematical Tables" published by the Chemical
C      Rubber Company.
C
C$ Version
C
C-     SPICELIB Version 1.1.0, 17-MAY-1994 (HAN)
C
C        Set the default function value to either 0, 0.0D0, .FALSE.,
C        or blank depending on the type of the function.
C
C-     SPICELIB Version 1.0.1, 10-MAR-1992 (WLT)
C
C        Comment section for permuted index source lines was added
C        following the header.
C
C-     SPICELIB Version 1.0.0, 31-JAN-1990 (WMO)
C
C-&

C$ Index_Entries
C
C     d.p. arc hyperbolic_cosine
C
C-&

C
C     SPICELIB functions
C

      LOGICAL               RETURN

C
C   Set up the error processing.
C
      IF ( RETURN() ) THEN
         DACOSH = 0.0D0
         RETURN
      ELSE
         CALL CHKIN ( 'DACOSH' )
         DACOSH = 0.0D0
      END IF

C
C  Check that X >= 1.
C

      IF ( X .LT. 1.D0 ) THEN

         CALL SETMSG ( 'DACOSH: Invalid argument, X is less than one.' )
         CALL SIGERR ( 'SPICE(INVALIDARGUMENT)' )

         CALL CHKOUT ( 'DACOSH' )
         RETURN
      END IF
C
C  Abiding by the order implied by the parentheses in the expression
C  (1.0D0/X)/X prevents floating point overflow that might occur for
C  large values of X if the equivalent expression, 1.0D0/(X*X), were
C  used.
C
      DACOSH = DLOG (X + X * DSQRT (1.0D0 - (1.0D0/X)/X) )

      CALL CHKOUT ( 'DACOSH' )
      RETURN
      END

max_stars_repo_name: agforero/FTFramework

max_issues_repo_name: agforero/fortran-testing-framework

max_forks_repo_name: agforero/fortran-testing-framework


text:
C
C  Subroutine to read the file "MADIS - Hydrological Surface"
C
      subroutine read_madis_hydro_netcdf(nf_fid, ICcheckNum,
     +     QCcheckNum, maxStaticIds, nInventoryBins, recNum,
     +     elevation, latitude, longitude, precip12hr, precip12hrQCD,
     +     precip1hr, precip1hrQCD, precip24hr, precip24hrQCD,
     +     precip3hr, precip3hrQCD, precip5min, precip5minQCD,
     +     precip6hr, precip6hrQCD, precipAccum, precipAccumQCD,
     +     riverFlow, riverStage, ICT, QCT, dataProvider,
     +     handbook5Id, homeWFO, precip12hrDD, precip1hrDD,
     +     precip24hrDD, precip3hrDD, precip5minDD, precip6hrDD,
     +     precipAccumDD, providerId, rawMessage, staticIds,
     +     stationId, stationName, stationType, observationTime,
     +     receivedTime, reportTime, riverReportChangeTime,
     +     filterSetNum, firstInBin, firstOverflow, globalInventory,
     +     invTime, inventory, isOverflow, lastInBin, lastRecord,
     +     nStaticIds, numericWMOid, precip12hrICA, precip12hrICR,
     +     precip12hrQCA, precip12hrQCR, precip1hrICA, precip1hrICR,
     +     precip1hrQCA, precip1hrQCR, precip24hrICA, precip24hrICR,
     +     precip24hrQCA, precip24hrQCR, precip3hrICA, precip3hrICR,
     +     precip3hrQCA, precip3hrQCR, precip5minICA, precip5minICR,
     +     precip5minQCA, precip5minQCR, precip6hrICA, precip6hrICR,
     +     precip6hrQCA, precip6hrQCR, precipAccumICA,
     +     precipAccumICR, precipAccumQCA, precipAccumQCR,
     +     prevRecord, secondsStage1_2, secondsStage3,badflag)
C
      include 'netcdf.inc'
      integer ICcheckNum, QCcheckNum, maxStaticIds, nInventoryBins,
     +     recNum,nf_fid, nf_vid, nf_status
      integer filterSetNum, firstInBin(nInventoryBins), firstOverflow,
     +     globalInventory, invTime(recNum), inventory(maxStaticIds),
     +     isOverflow(recNum), lastInBin(nInventoryBins),
     +     lastRecord(maxStaticIds), nStaticIds,
     +     numericWMOid(recNum), precip12hrICA(recNum),
     +     precip12hrICR(recNum), precip12hrQCA(recNum),
     +     precip12hrQCR(recNum), precip1hrICA(recNum),
     +     precip1hrICR(recNum), precip1hrQCA(recNum),
     +     precip1hrQCR(recNum), precip24hrICA(recNum),
     +     precip24hrICR(recNum), precip24hrQCA(recNum),
     +     precip24hrQCR(recNum), precip3hrICA(recNum),
     +     precip3hrICR(recNum), precip3hrQCA(recNum),
     +     precip3hrQCR(recNum), precip5minICA(recNum),
     +     precip5minICR(recNum), precip5minQCA(recNum),
     +     precip5minQCR(recNum), precip6hrICA(recNum),
     +     precip6hrICR(recNum), precip6hrQCA(recNum),
     +     precip6hrQCR(recNum), precipAccumICA(recNum),
     +     precipAccumICR(recNum), precipAccumQCA(recNum),
     +     precipAccumQCR(recNum), prevRecord(recNum),
     +     secondsStage1_2(recNum), secondsStage3(recNum)
      real elevation(recNum), latitude(recNum), longitude(recNum),
     +     precip12hr(recNum), precip12hrQCD( QCcheckNum, recNum),
     +     precip1hr(recNum), precip1hrQCD( QCcheckNum, recNum),
     +     precip24hr(recNum), precip24hrQCD( QCcheckNum, recNum),
     +     precip3hr(recNum), precip3hrQCD( QCcheckNum, recNum),
     +     precip5min(recNum), precip5minQCD( QCcheckNum, recNum),
     +     precip6hr(recNum), precip6hrQCD( QCcheckNum, recNum),
     +     precipAccum(recNum), precipAccumQCD( QCcheckNum, recNum),
     +     riverFlow(recNum), riverStage(recNum)
      double precision observationTime(recNum), receivedTime(recNum),
     +     reportTime(recNum), riverReportChangeTime(recNum)
      character precip5minDD(recNum)
      character precip12hrDD(recNum)
      character*72 ICT(ICcheckNum)
      character precip1hrDD(recNum)
      character*11 dataProvider(recNum)
      character*60 QCT(QCcheckNum)
      character*11 handbook5Id(recNum)
      character precip24hrDD(recNum)
      character precipAccumDD(recNum)
      character*51 stationName(recNum)
      character precip3hrDD(recNum)
      character*11 stationType(recNum)
      character precip6hrDD(recNum)
      character*256 rawMessage(recNum)
      character*24 staticIds(maxStaticIds)
      character*12 providerId(recNum)
      character*11 stationId(recNum)
      character*4 homeWFO(recNum)

      write(6,*)' subroutine read_madis_hydro_netcdf: recNum = ',recNum

C   Variables of type REAL
C
C     Variable        NETCDF Long Name
C     elevation     "elevation"
C
      nf_status=NF_INQ_VARID(nf_fid,'elevation',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for elevation'
       print *,'Set elevation to badflag'
       elevation = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,elevation)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for elevation'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - elevation'
       else
        call ck_array_real(elevation,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - elevation'
       else
        call ck_array_real(elevation,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     latitude      "latitude"
C
      nf_status=NF_INQ_VARID(nf_fid,'latitude',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for latitude'
       print *,'Set latitude to badflag'
       latitude = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,latitude)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for latitude'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - latitude'
       else
        call ck_array_real(latitude,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - latitude'
       else
        call ck_array_real(latitude,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     longitude     "longitude"
C
      nf_status=NF_INQ_VARID(nf_fid,'longitude',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for longitude'
       print *,'Set longitude to badflag'
       longitude = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,longitude)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for longitude'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - longitude'
       else
        call ck_array_real(longitude,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - longitude'
       else
        call ck_array_real(longitude,recNum,valmis
     1                    ,badflag)
       endif
      endif

C
C     Variable        NETCDF Long Name
C     precip12hr    "12 hour precip accumulation "
C
      nf_status=NF_INQ_VARID(nf_fid,'precip12hr',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip12hr'
       print *,'Set precip12hr to badflag'
       precip12hr = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip12hr)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip12hr'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip12hr'
       else
        call ck_array_real(precip12hr,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip12hr'
       else
        call ck_array_real(precip12hr,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip12hrQCD "12-hr precip amount QC departures"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip12hrQCD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip12hrQCD'
       print *,'Set precip12hrQCD to badflag'
       precip12hrQCD = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip12hrQCD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip12hrQCD'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip12hrQCD'
       else
        call ck_array_real(precip12hrQCD,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip12hrQCD'
       else
        call ck_array_real(precip12hrQCD,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip1hr     "1 hour precip accumulation "
C
      nf_status=NF_INQ_VARID(nf_fid,'precip1hr',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip1hr'
       print *,'Set precip1hr to badflag'
       precip1hr = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip1hr)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip1hr'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip1hr'
       else
        call ck_array_real(precip1hr,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip1hr'
       else
        call ck_array_real(precip1hr,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip1hrQCD  "1-hr precip amount QC departures"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip1hrQCD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip1hrQCD'
       print *,'Set precip1hrQCD to badflag'
       precip1hrQCD = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip1hrQCD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip1hrQCD'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip1hrQCD'
       else
        call ck_array_real(precip1hrQCD,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip1hrQCD'
       else
        call ck_array_real(precip1hrQCD,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip24hr    "24 hour precip accumulation "
C
      nf_status=NF_INQ_VARID(nf_fid,'precip24hr',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip24hr'
       print *,'Set precip24hr to badflag'
       precip24hr = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip24hr)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip24hr'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip24hr'
       else
        call ck_array_real(precip24hr,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip24hr'
       else
        call ck_array_real(precip24hr,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip24hrQCD "24-hr precip amount QC departures"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip24hrQCD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip24hrQCD'
       print *,'Set precip24hrQCD to badflag'
       precip24hrQCD = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip24hrQCD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip24hrQCD'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip24hrQCD'
       else
        call ck_array_real(precip24hrQCD,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip24hrQCD'
       else
        call ck_array_real(precip24hrQCD,recNum,valmis
     1                    ,badflag)
       endif
      endif

C
C     Variable        NETCDF Long Name
C     precip3hr     "3 hour precip accumulation "
C
      nf_status=NF_INQ_VARID(nf_fid,'precip3hr',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip3hr'
       print *,'Set precip3hr to badflag'
       precip3hr = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip3hr)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip3hr'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip3hr'
       else
        call ck_array_real(precip3hr,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip3hr'
       else
        call ck_array_real(precip3hr,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip3hrQCD  "3-hr precip amount QC departures"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip3hrQCD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip3hrQCD'
       print *,'Set precip3hrQCD to badflag'
       precip3hrQCD = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip3hrQCD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip3hrQCD'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip3hrQCD'
       else
        call ck_array_real(precip3hrQCD,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip3hrQCD'
       else
        call ck_array_real(precip3hrQCD,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip5min    "5 minute precip accumulation "
C
      nf_status=NF_INQ_VARID(nf_fid,'precip5min',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip5min'
       print *,'Set precip5min to badflag'
       precip5min = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip5min)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip5min'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip5min'
       else
        call ck_array_real(precip5min,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip5min'
       else
        call ck_array_real(precip5min,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip5minQCD "5-min precip amount QC departures"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip5minQCD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip5minQCD'
       print *,'Set precip5minQCD to badflag'
       precip5minQCD = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip5minQCD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip5minQCD'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip5minQCD'
       else
        call ck_array_real(precip5minQCD,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip5minQCD'
       else
        call ck_array_real(precip5minQCD,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip6hr     "6 hour precip accumulation "
C
      nf_status=NF_INQ_VARID(nf_fid,'precip6hr',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip6hr'
       print *,'Set precip6hr to badflag'
       precip6hr = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip6hr)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip6hr'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip6hr'
       else
        call ck_array_real(precip6hr,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip6hr'
       else
        call ck_array_real(precip6hr,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip6hrQCD  "6-hr precip amount QC departures"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip6hrQCD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip6hrQCD'
       print *,'Set precip6hrQCD to badflag'
       precip6hrQCD = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precip6hrQCD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip6hrQCD'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precip6hrQCD'
       else
        call ck_array_real(precip6hrQCD,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precip6hrQCD'
       else
        call ck_array_real(precip6hrQCD,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precipAccum   "precip accumulation with an unknown time period"
C
      nf_status=NF_INQ_VARID(nf_fid,'precipAccum',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precipAccum'
       print *,'Set precipAccum to badflag'
       precipAccum = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precipAccum)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precipAccum'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precipAccum'
       else
        call ck_array_real(precipAccum,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precipAccum'
       else
        call ck_array_real(precipAccum,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precipAccumQCD"precip amount QC departures"
C
      nf_status=NF_INQ_VARID(nf_fid,'precipAccumQCD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precipAccumQCD'
       print *,'Set precipAccumQCD to badflag'
       precipAccumQCD = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,precipAccumQCD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precipAccumQCD'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - precipAccumQCD'
       else
        call ck_array_real(precipAccumQCD,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - precipAccumQCD'
       else
        call ck_array_real(precipAccumQCD,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     riverFlow     "River flow"
C
      nf_status=NF_INQ_VARID(nf_fid,'riverFlow',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for riverFlow'
       print *,'Set riverFlow to badflag'
       riverFlow = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,riverFlow)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for riverFlow'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - riverFlow'
       else
        call ck_array_real(riverFlow,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - riverFlow'
       else
        call ck_array_real(riverFlow,recNum,valmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     riverStage    "River stage"
C
      nf_status=NF_INQ_VARID(nf_fid,'riverStage',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for riverStage'
       print *,'Set riverStage to badflag'
       riverStage = badflag
      else
       nf_status=NF_GET_VAR_REAL(nf_fid,nf_vid,riverStage)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for riverStage'
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'_FillValue',valfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - riverStage'
       else
        call ck_array_real(riverStage,recNum,valfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_REAL(nf_fid,nf_vid,'missing_value',valmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - riverStage'
       else
        call ck_array_real(riverStage,recNum,valmis
     1                    ,badflag)
       endif
      endif

C   Variables of type INT
C
C
C     Variable        NETCDF Long Name
C     filterSetNum
C
      nf_status=NF_INQ_VARID(nf_fid,'filterSetNum',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for filterSetNum'
       print *,'Set filterSetNum to -99'
       filterSetNum = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,filterSetNum)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for filterSetNum'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     firstInBin
C
      nf_status=NF_INQ_VARID(nf_fid,'firstInBin',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for firstInBin'
       print *,'Set firstInBin to -99'
       firstInBin = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,firstInBin)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for firstInBin'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     firstOverflow
C
      nf_status=NF_INQ_VARID(nf_fid,'firstOverflow',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for firstOverflow'
       print *,'Set firstOverflow to -99'
       firstOverflow = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,firstOverflow)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for firstOverflow'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     globalInventory
C
      nf_status=NF_INQ_VARID(nf_fid,'globalInventory',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for globalInventory'
       print *,'Set globalInventory to -99'
       globalInventory = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,globalInventory)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for globalInventory'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     invTime
C
      nf_status=NF_INQ_VARID(nf_fid,'invTime',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for invTime'
       print *,'Set invTime to -99'
       invTime = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,invTime)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for invTime'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     inventory
C
      nf_status=NF_INQ_VARID(nf_fid,'inventory',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for inventory'
       print *,'Set inventory to -99'
       inventory = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,inventory)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for inventory'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     isOverflow
C
      nf_status=NF_INQ_VARID(nf_fid,'isOverflow',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for isOverflow'
       print *,'Set isOverflow to -99'
       isOverflow = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,isOverflow)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for isOverflow'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     lastInBin
C
      nf_status=NF_INQ_VARID(nf_fid,'lastInBin',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for lastInBin'
       print *,'Set lastInBin to -99'
       lastInBin = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,lastInBin)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for lastInBin'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     lastRecord
C
      nf_status=NF_INQ_VARID(nf_fid,'lastRecord',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for lastRecord'
       print *,'Set lastRecord to -99'
       lastRecord = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,lastRecord)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for lastRecord'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     nStaticIds
C
      nf_status=NF_INQ_VARID(nf_fid,'nStaticIds',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for nStaticIds'
       print *,'Set nStaticIds to -99'
       nStaticIds = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,nStaticIds)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for nStaticIds'
       endif
      endif

C
C     Variable        NETCDF Long Name
C     numericWMOid  "numeric WMO identification"
C
      nf_status=NF_INQ_VARID(nf_fid,'numericWMOid',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for numericWMOid'
       print *,'Set numericWMOid to -99'
       numericWMOid = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,numericWMOid)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for numericWMOid'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip12hrICA "12-hr precip amount IC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip12hrICA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip12hrICA'
       print *,'Set precip12hrICA to -99'
       precip12hrICA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip12hrICA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip12hrICA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip12hrICR "12-hr precip amount IC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip12hrICR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip12hrICR'
       print *,'Set precip12hrICR to -99'
       precip12hrICR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip12hrICR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip12hrICR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip12hrQCA "12-hr precip amount QC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip12hrQCA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip12hrQCA'
       print *,'Set precip12hrQCA to -99'
       precip12hrQCA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip12hrQCA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip12hrQCA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip12hrQCR "12-hr precip amount QC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip12hrQCR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip12hrQCR'
       print *,'Set precip12hrQCR to -99'
       precip12hrQCR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip12hrQCR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip12hrQCR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip1hrICA  "1-hr precip amount IC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip1hrICA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip1hrICA'
       print *,'Set precip1hrICA to -99'
       precip1hrICA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip1hrICA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip1hrICA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip1hrICR  "1-hr precip amount IC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip1hrICR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip1hrICR'
       print *,'Set precip1hrICR to -99'
       precip1hrICR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip1hrICR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip1hrICR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip1hrQCA  "1-hr precip amount QC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip1hrQCA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip1hrQCA'
       print *,'Set precip1hrQCA to -99'
       precip1hrQCA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip1hrQCA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip1hrQCA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip1hrQCR  "1-hr precip amount QC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip1hrQCR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip1hrQCR'
       print *,'Set precip1hrQCR to -99'
       precip1hrQCR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip1hrQCR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip1hrQCR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip24hrICA "24-hr precip amount IC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip24hrICA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip24hrICA'
       print *,'Set precip24hrICA to -99'
       precip24hrICA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip24hrICA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip24hrICA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip24hrICR "24-hr precip amount IC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip24hrICR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip24hrICR'
       print *,'Set precip24hrICR to -99'
       precip24hrICR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip24hrICR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip24hrICR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip24hrQCA "24-hr precip amount QC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip24hrQCA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip24hrQCA'
       print *,'Set precip24hrQCA to -99'
       precip24hrQCA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip24hrQCA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip24hrQCA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip24hrQCR "24-hr precip amount QC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip24hrQCR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip24hrQCR'
       print *,'Set precip24hrQCR to -99'
       precip24hrQCR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip24hrQCR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip24hrQCR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip3hrICA  "3-hr precip amount IC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip3hrICA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip3hrICA'
       print *,'Set precip3hrICA to -99'
       precip3hrICA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip3hrICA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip3hrICA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip3hrICR  "3-hr precip amount IC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip3hrICR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip3hrICR'
       print *,'Set precip3hrICR to -99'
       precip3hrICR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip3hrICR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip3hrICR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip3hrQCA  "3-hr precip amount QC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip3hrQCA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip3hrQCA'
       print *,'Set precip3hrQCA to -99'
       precip3hrQCA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip3hrQCA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip3hrQCA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip3hrQCR  "3-hr precip amount QC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip3hrQCR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip3hrQCR'
       print *,'Set precip3hrQCR to -99'
       precip3hrQCR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip3hrQCR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip3hrQCR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip5minICA "5-min precip amount IC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip5minICA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip5minICA'
       print *,'Set precip5minICA to -99'
       precip5minICA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip5minICA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip5minICA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip5minICR "5-min precip amount IC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip5minICR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip5minICR'
       print *,'Set precip5minICR to -99'
       precip5minICR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip5minICR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip5minICR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip5minQCA "5-min precip amount QC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip5minQCA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip5minQCA'
       print *,'Set precip5minQCA to -99'
       precip5minQCA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip5minQCA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip5minQCA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip5minQCR "5-min precip amount QC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip5minQCR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip5minQCR'
       print *,'Set precip5minQCR to -99'
       precip5minQCR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip5minQCR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip5minQCR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip6hrICA  "6-hr precip amount IC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip6hrICA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip6hrICA'
       print *,'Set precip6hrICA to -99'
       precip6hrICA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip6hrICA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip6hrICA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip6hrICR  "6-hr precip amount IC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip6hrICR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip6hrICR'
       print *,'Set precip6hrICR to -99'
       precip6hrICR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip6hrICR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip6hrICR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip6hrQCA  "6-hr precip amount QC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip6hrQCA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip6hrQCA'
       print *,'Set precip6hrQCA to -99'
       precip6hrQCA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip6hrQCA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip6hrQCA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip6hrQCR  "6-hr precip amount QC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip6hrQCR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip6hrQCR'
       print *,'Set precip6hrQCR to -99'
       precip6hrQCR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precip6hrQCR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip6hrQCR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precipAccumICA"precip amount IC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precipAccumICA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precipAccumICA'
       print *,'Set precipAccumICA to -99'
       precipAccumICA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precipAccumICA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precipAccumICA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precipAccumICR"precip amount IC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precipAccumICR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precipAccumICR'
       print *,'Set precipAccumICR to -99'
       precipAccumICR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precipAccumICR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precipAccumICR'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precipAccumQCA"precip amount QC applied word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precipAccumQCA',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precipAccumQCA'
       print *,'Set precipAccumQCA to -99'
       precipAccumQCA = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precipAccumQCA)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precipAccumQCA'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precipAccumQCR"precip amount QC results word"
C
      nf_status=NF_INQ_VARID(nf_fid,'precipAccumQCR',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precipAccumQCR'
       print *,'Set precipAccumQCR to -99'
       precipAccumQCR = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,precipAccumQCR)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precipAccumQCR'
       endif
      endif

C
C     Variable        NETCDF Long Name
C     prevRecord
C
      nf_status=NF_INQ_VARID(nf_fid,'prevRecord',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for prevRecord'
       print *,'Set prevRecord to -99'
       prevRecord = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,prevRecord)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for prevRecord'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     secondsStage1_2
C
      nf_status=NF_INQ_VARID(nf_fid,'secondsStage1_2',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for secondsStage1_2'
       print *,'Set secondsStage1_2 to -99'
       secondsStage1_2 = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,secondsStage1_2)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for secondsStage1_2'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     secondsStage3
C
      nf_status=NF_INQ_VARID(nf_fid,'secondsStage3',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for secondsStage3'
       print *,'Set secondsStage3 to -99'
       secondsStage3 = -99
      else
       nf_status=NF_GET_VAR_INT(nf_fid,nf_vid,secondsStage3)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for secondsStage3'
       endif
      endif

C   Variables of type DOUBLE
C
C
C     Variable        NETCDF Long Name
C     observationTime"time of observation"
C
      nf_status=NF_INQ_VARID(nf_fid,'observationTime',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for observationTime'
       print *,'Set observationTime to badflag'
       observationTime = badflag
      else
       nf_status=NF_GET_VAR_DOUBLE(nf_fid,nf_vid,observationTime)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for observationTime'
       endif
       nf_status=NF_GET_ATT_DOUBLE(nf_fid,nf_vid,'_FillValue',dvalfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - observationTime'
       else
        call ck_array_dble(observationTime,recNum,dvalfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_DOUBLE(nf_fid,nf_vid,'missing_value'
     1                            ,dvalmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - observationTime'
       else
        call ck_array_dble(observationTime,recNum,dvalmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     receivedTime  "time data was received"
C
      nf_status=NF_INQ_VARID(nf_fid,'receivedTime',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for receivedTime'
       print *,'Set receivedTime to badflag'
       receivedTime = badflag
      else
       nf_status=NF_GET_VAR_DOUBLE(nf_fid,nf_vid,receivedTime)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for receivedTime'
       endif
       nf_status=NF_GET_ATT_DOUBLE(nf_fid,nf_vid,'_FillValue',dvalfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - receivedTime'
       else
        call ck_array_dble(receivedTime,recNum,dvalfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_DOUBLE(nf_fid,nf_vid,'missing_value'
     1                            ,dvalmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - receivedTime'
       else
        call ck_array_dble(receivedTime,recNum,dvalmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     reportTime    "time data was processed by the provider"
C
      nf_status=NF_INQ_VARID(nf_fid,'reportTime',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for reportTime'
       print *,'Set reportTime to badflag'
       reportTime = badflag
      else
       nf_status=NF_GET_VAR_DOUBLE(nf_fid,nf_vid,reportTime)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for reportTime'
       endif
       nf_status=NF_GET_ATT_DOUBLE(nf_fid,nf_vid,'_FillValue',dvalfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - reportTime'
       else
        call ck_array_dble(reportTime,recNum,dvalfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_DOUBLE(nf_fid,nf_vid,'missing_value'
     1                            ,dvalmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - reportTime'
       else
        call ck_array_dble(reportTime,recNum,dvalmis
     1                    ,badflag)
       endif
      endif
C
C     Variable        NETCDF Long Name
C     riverReportChangeTime"time of last new river stage/flow rpt"
C
      nf_status=NF_INQ_VARID(nf_fid,'riverReportChangeTime',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for riverReportChangeTime'
       print *,'Set riverReportChangeTime to badflag'
       riverReportChangeTime = badflag
      else
       nf_status=NF_GET_VAR_DOUBLE(nf_fid,nf_vid,riverReportChangeTime)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for riverReportChangeTime'
       endif
       nf_status=NF_GET_ATT_DOUBLE(nf_fid,nf_vid,'_FillValue',dvalfil)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for _FillValue - riverReportChangeTime'
       else
        call ck_array_dble(riverReportChangeTime,recNum,dvalfil
     1                    ,badflag)
       endif
       nf_status=NF_GET_ATT_DOUBLE(nf_fid,nf_vid,'missing_value'
     1                            ,dvalmis)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
     1         ,' for missing_value - riverReportChangeTime'
       else
        call ck_array_dble(riverReportChangeTime,recNum,dvalmis
     1                    ,badflag)
       endif
      endif

C   Variables of type CHAR
C
C
C     Variable        NETCDF Long Name
C     ICT           "list of possible IC checks"
C
      nf_status=NF_INQ_VARID(nf_fid,'ICT',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for ICT'
       print *,'Set ICT to " "'
       ICT = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,ICT)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for ICT'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     QCT           "list of possible QC checks"
C
      nf_status=NF_INQ_VARID(nf_fid,'QCT',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for QCT'
       print *,'Set QCT to " "'
       QCT = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,QCT)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for QCT'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     dataProvider  "LDAD data provider"
C
      nf_status=NF_INQ_VARID(nf_fid,'dataProvider',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for dataProvider'
       print *,'Set dataProvider to " "'
       dataProvider = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,dataProvider)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for dataProvider'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     handbook5Id   "handbook5 Id (AFOS or SHEF id)"
C
      nf_status=NF_INQ_VARID(nf_fid,'handbook5Id',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for handbook5Id'
       print *,'Set handbook5Id to " "'
       handbook5Id = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,handbook5Id)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for handbook5Id'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     homeWFO       "home WFO Id"
C
      nf_status=NF_INQ_VARID(nf_fid,'homeWFO',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for homeWFO'
       print *,'Set homeWFO to " "'
       homeWFO = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,homeWFO)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for homeWFO'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip12hrDD  "12-hr precip amount QC summary value"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip12hrDD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip12hrDD'
       print *,'Set precip12hrDD to " "'
       precip12hrDD = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,precip12hrDD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip12hrDD'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip1hrDD   "1-hr precip amount QC summary value"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip1hrDD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip1hrDD'
       print *,'Set precip1hrDD to " "'
       precip1hrDD = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,precip1hrDD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip1hrDD'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip24hrDD  "24-hr precip amount QC summary value"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip24hrDD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip24hrDD'
       print *,'Set precip24hrDD to " "'
       precip24hrDD = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,precip24hrDD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip24hrDD'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip3hrDD   "3-hr precip amount QC summary value"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip3hrDD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip3hrDD'
       print *,'Set precip3hrDD to " "'
       precip3hrDD = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,precip3hrDD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip3hrDD'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip5minDD  "5-min precip amount QC summary value"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip5minDD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip5minDD'
       print *,'Set precip5minDD to " "'
       precip5minDD = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,precip5minDD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip5minDD'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precip6hrDD   "6-hr precip amount QC summary value"
C
      nf_status=NF_INQ_VARID(nf_fid,'precip6hrDD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precip6hrDD'
       print *,'Set precip6hrDD to " "'
       precip6hrDD = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,precip6hrDD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precip6hrDD'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     precipAccumDD "precip amount QC summary value"
C
      nf_status=NF_INQ_VARID(nf_fid,'precipAccumDD',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for precipAccumDD'
       print *,'Set precipAccumDD to " "'
       precipAccumDD = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,precipAccumDD)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for precipAccumDD'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     providerId    "Data Provider station Id"
C
      nf_status=NF_INQ_VARID(nf_fid,'providerId',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for providerId'
       print *,'Set providerId to " "'
       providerId = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,providerId)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for providerId'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     rawMessage    "raw text LDAD hydro report"
C
      nf_status=NF_INQ_VARID(nf_fid,'rawMessage',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for rawMessage'
       print *,'Set rawMessage to " "'
       rawMessage = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,rawMessage)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for rawMessage'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     staticIds
C
      nf_status=NF_INQ_VARID(nf_fid,'staticIds',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for staticIds'
       print *,'Set staticIds to " "'
       staticIds = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,staticIds)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for staticIds'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     stationId     "alphanumeric station Id"
C
      nf_status=NF_INQ_VARID(nf_fid,'stationId',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for stationId'
       print *,'Set stationId to " "'
       stationId = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,stationId)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for stationId'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     stationName   "alphanumeric station name"
C
      nf_status=NF_INQ_VARID(nf_fid,'stationName',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for stationName'
       print *,'Set stationName to " "'
       stationName = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,stationName)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for stationName'
       endif
      endif
C
C     Variable        NETCDF Long Name
C     stationType   "LDAD station type"
C
      nf_status=NF_INQ_VARID(nf_fid,'stationType',nf_vid)
      if(nf_status.ne.NF_NOERR) then
       print *, NF_STRERROR(nf_status),' for stationType'
       print *,'Set stationType to " "'
       stationType = ' '
      else
       nf_status=NF_GET_VAR_TEXT(nf_fid,nf_vid,stationType)
       if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status),' for stationType'
       endif
      endif

      nf_status=nf_close(nf_fid)
      if(nf_status.ne.NF_NOERR) then
        print *, NF_STRERROR(nf_status)
        print *,'nf_close'
      endif

      return
      end

max_stars_repo_name: maxinye/laps-mirror

max_stars_repo_licenses: Intel Unlicense OLDAP-2.2.1 NetCDF

max_issues_repo_name: longwosion/laps-mirror

max_issues_repo_licenses: Intel NetCDF OLDAP-2.2.1 Unlicense

max_forks_repo_name: longwosion/laps-mirror

max_forks_repo_licenses: Intel NetCDF OLDAP-2.2.1 Unlicense


program main

!*****************************************************************************80
!
!! MAIN is the main program for FIRE_SERIAL.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    30 June 2013.
!
!  Author:
!
!    FORTRAN90 version by John Burkardt
!
  implicit none

  integer ( kind = 4 ), parameter :: forest_size = 20

  integer ( kind = 4 ) forest(forest_size,forest_size)
  logical forest_is_burning
  integer ( kind = 4 ) i
  integer ( kind = 4 ) i_ignite
  integer ( kind = 4 ) i4_uniform_ab
  integer ( kind = 4 ) j_ignite
  real ( kind = 8 ) percent
  real ( kind = 8 ), parameter :: prob_spread = 0.5D+00
  integer ( kind = 4 ) seed
  real ( kind = 8 ) u

  call timestamp ( )
  write ( *, '(a)' ) ''
  write ( *, '(a)' ) 'FIRE_SERIAL'
  write ( *, '(a)' ) '  FORTRAN90 version'
  write ( *, '(a)' ) '  A probabilistic simulation of a forest fire.'
  write ( *, '(a,g14.6)' ) '  The probability of tree-to-tree spread is ', prob_spread
!
!  Initialize the random number generator.
!
  call get_seed ( seed )
  write ( *, '(a,i12)' ) '  The random number generator is seeded by ', seed
!
!  Initialize the values in the forest.
!
  call forest_initialize ( forest_size, forest )
!
!  Choose a tree at random where the fire will start.
!
  i_ignite = i4_uniform_ab ( 1, forest_size, seed )
  j_ignite = i4_uniform_ab ( 1, forest_size, seed )
  call tree_ignite ( forest_size, forest, i_ignite, j_ignite )
  write ( *, '(a)' ) ''
  write ( *, '(a,i2,a,i2,a)' ) '  Fire starts at tree(', i_ignite, ',', j_ignite, ')'
!
!  Let time run until nothing is burning any more.
!
  do while ( forest_is_burning ( forest_size, forest ) )
    call forest_burns ( forest_size, forest, seed, prob_spread )
  end do
!
!  Display the final forest state.
!
  call forest_print ( forest_size, forest, i_ignite, j_ignite )
!
!  Report the percentage of forest burned.
!
  call get_percent_burned ( forest_size, forest, percent )

  write ( *, '(a)' ) ''
  write ( *, '(a,g14.6)' ) '  Percentage of forest burned = ', percent
!
!  Terminate.
!
  write ( *, '(a)' ) ''
  write ( *, '(a)' ) 'FIRE_SERIAL:'
  write ( *, '(a)' ) '  Normal end of execution.'
  write ( *, '(a)' ) ''
  call timestamp ( )

  stop
end
function fire_spreads ( seed, prob_spread )

!*****************************************************************************80
!
!! FIRE_SPREADS determines whether the fire spreads.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    30 June 2013
!
!  Author:
!
!    FORTRAN90 version by John Burkardt
!
!  Parameters:
!
!    Input/output, integer ( kind = 4 ) SEED, a seed for the random
!    number generator.
!
!    Input, real ( kind = 8 ) PROB_SPREAD, the probability of spreading.
!
!    Output, logical FIRE_SPREADS, is TRUE if the fire spreads.
!
  implicit none

  real ( kind = 8 ) prob_spread
  logical fire_spreads
  real ( kind = 8 ) r8_uniform_01
  integer ( kind = 4 ) seed
  real ( kind = 8 ) u

  u = r8_uniform_01 ( seed )

  if ( u < prob_spread ) then
    fire_spreads = .true.
  else
    fire_spreads = .false.
  end if

  return
end
subroutine forest_burns ( forest_size, forest, seed, prob_spread )

!*****************************************************************************80
!
!! FOREST_BURNS models a single time step of the burning forest.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    30 June 2013
!
!  Author:
!
!    FORTRAN90 version by John Burkardt
!
!  Parameters:
!
!    Input, integer ( kind = 4 ) FOREST_SIZE, the linear dimension of the forest.
!
!    Input/output, integer ( kind = 4 ) FOREST(FOREST_SIZE,FOREST_SIZE), an
!    array with an entry for each tree in the forest.
!
!    Input/output, integer ( kind = 4 ) SEED, a seed for the random
!    number generator.
!
!    Input, real ( kind = 8 ) PROB_SPREAD, the probability that the fire will
!    spread from a burning tree to an unburnt one.
!
  implicit none

  integer ( kind = 4 ) forest_size

  integer ( kind = 4 ), parameter :: BURNING = 2
  integer ( kind = 4 ), parameter :: BURNT = 3
  logical fire_spreads
  integer ( kind = 4 ) forest(forest_size,forest_size)
  integer ( kind = 4 ) i
  integer ( kind = 4 ) j
  real ( kind = 8 ) prob_spread
  integer ( kind = 4 ) seed
  integer ( kind = 4 ), parameter :: SMOLDERING = 1
  integer ( kind = 4 ), parameter :: UNBURNT = 0
!
!  Burning trees burn down;
!  Smoldering trees ignite;
!
  do j = 1, forest_size
    do i = 1, forest_size
      if ( forest(i,j) == BURNING ) then
        forest(i,j) = BURNT
      else if ( forest(i,j) == SMOLDERING ) then
        forest(i,j) = BURNING
      end if
    end do
  end do
!
!  Unburnt trees might catch fire.
!
  do j = 1, forest_size
    do i = 1, forest_size

      if ( forest(i,j) == BURNING ) then
!
!  North.
!
        if ( 1 < i ) then
          if ( fire_spreads ( seed, prob_spread ) .and. forest(i-1,j) == UNBURNT ) then
            forest(i-1,j) = SMOLDERING
          end if
        end if
!
!  South.
!
        if ( i < forest_size ) then
          if ( fire_spreads ( seed, prob_spread ) .and. forest(i+1,j) == UNBURNT ) then
            forest(i+1,j) = SMOLDERING
          end if
        end if
!
!  West.
!
        if ( 1 < j ) then
          if ( fire_spreads ( seed, prob_spread ) .and. forest(i,j-1) == UNBURNT ) then
            forest(i,j-1) = SMOLDERING
          end if
        end if
!
!  East.
!
        if ( j < forest_size ) then
          if ( fire_spreads ( seed, prob_spread ) .and. forest(i,j+1) == UNBURNT ) then
            forest(i,j+1) = SMOLDERING
          end if
        end if

      end if

    end do
  end do

  return
end
subroutine forest_initialize ( forest_size, forest )

!*****************************************************************************80
!
!! FOREST_INITIALIZE initializes the forest values.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    30 June 2013
!
!  Author:
!
!    FORTRAN90 version by John Burkardt
!
!  Parameters:
!
!    Input, integer ( kind = 4 ) FOREST_SIZE, the linear dimension of the forest.
!
!    Output, integer ( kind = 4 ) FOREST(FOREST_SIZE,FOREST_SIZE), an array
!    with an entry for each tree in the forest.
!
  implicit none

  integer ( kind = 4 ) forest_size

  integer ( kind = 4 ) forest(forest_size,forest_size)
  integer ( kind = 4 ), parameter :: UNBURNT = 0

  forest(1:forest_size,1:forest_size) = UNBURNT

  return
end
function forest_is_burning ( forest_size, forest )

!*****************************************************************************80
!
!! FOREST_IS_BURNING reports whether any trees in the forest are burning.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    30 June 2013
!
!  Author:
!
!    FORTRAN90 version by John Burkardt
!
!  Parameters:
!
!    Input, integer ( kind = 4 ) FOREST_SIZE, the linear dimension of the forest.
!
!    Input, integer ( kind = 4 ) FOREST(FOREST_SIZE,FOREST_SIZE), an array
!    with an entry for each tree in the forest.
!
!    Output, logical FOREST_IS_BURNING, is TRUE if any tree in the forest
!    is in the SMOLDERING or BURNING state.
!
  implicit none

  integer ( kind = 4 ) forest_size

  integer ( kind = 4 ), parameter :: BURNING = 2
  integer ( kind = 4 ) forest(forest_size,forest_size)
  logical forest_is_burning
  integer ( kind = 4 ) i
  integer ( kind = 4 ) j
  integer ( kind = 4 ), parameter :: SMOLDERING = 1
  logical value

  value = .false.

  do j = 1, forest_size
    do i = 1, forest_size
      if ( forest(i,j) == SMOLDERING .or. forest(i,j) == BURNING ) then
        value = .true.
      end if
    end do
  end do

  forest_is_burning = value

  return
end
subroutine forest_print ( forest_size, forest, i_ignite, j_ignite )

!*****************************************************************************80
!
!! FOREST_PRINT prints the state of the trees in the forest.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    30 June 2013
!
!  Author:
!
!    FORTRAN90 version by John Burkardt
!
!  Parameters:
!
!    Input, integer ( kind = 4 ) FOREST_SIZE, the linear dimension of the forest.
!
!    Input, integer ( kind = 4 ) FOREST(FOREST_SIZE,FOREST_SIZE), an array
!    with an entry for each tree in the forest.
!
!    Input, integer ( kind = 4 ) I_IGNITE, J_IGNITE, the location of the start
!    of the fire.
!
  implicit none

  integer ( kind = 4 ) forest_size

  integer ( kind = 4 ), parameter :: BURNT = 3
  integer ( kind = 4 ) forest(forest_size,forest_size)
  integer ( kind = 4 ) i
  integer ( kind = 4 ) i_ignite
  integer ( kind = 4 ) j
  integer ( kind = 4 ) j_ignite

  write ( *, '(a)' ) ''
  write ( *, '(a)' ) '  Map of fire damage.'
  write ( *, '(a)' ) '  Fire started at "*".'
  write ( *, '(a)' ) '  Burned trees are indicated by ".".'
  write ( *, '(a)' ) '  Unburned trees are indicated by "X".'
  write ( *, '(a)' ) ''

  do i = 1, forest_size
    write ( *, '(a)', ADVANCE='NO' ) '  '
    do j = 1, forest_size
      if ( i == i_ignite .and. j == j_ignite ) then
        write ( *, '(a)', ADVANCE='NO' ) '*'
      else if ( forest(i,j) == BURNT ) then
        write ( *, '(a)', ADVANCE='NO' ) '.'
      else
        write ( *, '(a)', ADVANCE='NO' ) 'X'
      end if
    end do
    write ( *, '(a)' ) ''
  end do

  return
end
subroutine get_percent_burned ( forest_size, forest, percent )

!*****************************************************************************80
!
!! GET_PERCENT_BURNED computes the percentage of the forest that burned.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    30 June 2013
!
!  Author:
!
!    FORTRAN90 version by John Burkardt
!
!  Parameters:
!
!    Input, integer ( kind = 4 ) FOREST_SIZE, the linear dimension of the forest.
!
!   Input, integer ( kind = 4 ) FOREST(FOREST_SIZE,FOREST_SIZE), an array
!    with an entry for each tree in the forest.
!
!    Output, real ( kind = 8 ) PERCENT, the percentage of the forest
!    that burned.
!
  implicit none

  integer ( kind = 4 ) forest_size

  integer ( kind = 4 ), parameter :: BURNT = 3
  integer ( kind = 4 ) forest(forest_size,forest_size)
  integer ( kind = 4 ) i
  integer ( kind = 4 ) j
  real ( kind = 8 ) percent
  integer ( kind = 4 ) total

  total = 0
  do j = 1, forest_size
    do i = 1, forest_size
      if ( forest(i,j) == BURNT ) then
        total = total + 1
      end if
    end do
  end do

  percent = real ( total, kind = 8 ) &
    / real ( forest_size * forest_size, kind = 8 )

  return
end
subroutine get_seed ( seed )

!*****************************************************************************80
!
!! GET_SEED returns a seed for the random number generator.
!
!  Discussion:
!
!    The seed depends on the current time, and ought to be (slightly)
!    different every millisecond.  Once the seed is obtained, a random
!    number generator should be called a few times to further process
!    the seed.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    02 August 2004
!
!  Author:
!
!    John Burkardt
!
!  Parameters:
!
!    Output, integer ( kind = 4 ) SEED, a pseudorandom seed value.
!
  implicit none

  integer ( kind = 4 ), parameter :: i4_huge = 2147483647
  integer ( kind = 4 ) seed
  real ( kind = 8 ) temp
  character ( len = 10 ) time
  character ( len = 8 ) today
  integer ( kind = 4 ) values(8)
  character ( len = 5 ) zone

  call date_and_time ( today, time, zone, values )

  temp = 0.0D+00

  temp = temp + real ( values(2) - 1, kind = 8 ) /  11.0D+00
  temp = temp + real ( values(3) - 1, kind = 8 ) /  30.0D+00
  temp = temp + real ( values(5),     kind = 8 ) /  23.0D+00
  temp = temp + real ( values(6),     kind = 8 ) /  59.0D+00
  temp = temp + real ( values(7),     kind = 8 ) /  59.0D+00
  temp = temp + real ( values(8),     kind = 8 ) / 999.0D+00
  temp = temp                                    /   6.0D+00

  do while ( temp <= 0.0D+00 )
    temp = temp + 1.0D+00
  end do

  do while ( 1.0D+00 < temp )
    temp = temp - 1.0D+00
  end do

  seed = int ( real ( i4_huge, kind = 8 ) * temp )
!
!  Never use a seed of 0 or maximum integer.
!
  if ( seed == 0 ) then
    seed = 1
  end if

  if ( seed == i4_huge ) then
    seed = seed - 1
  end if

  return
end
function i4_uniform_ab ( a, b, seed )

!*****************************************************************************80
!
!! I4_UNIFORM_AB returns a scaled pseudorandom I4 between A and B.
!
!  Discussion:
!
!    An I4 is an integer ( kind = 4 ) value.
!
!    The pseudorandom number will be scaled to be uniformly distributed
!    between A and B.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    02 October 2012
!
!  Author:
!
!    John Burkardt
!
!  Reference:
!
!    Paul Bratley, Bennett Fox, Linus Schrage,
!    A Guide to Simulation,
!    Second Edition,
!    Springer, 1987,
!    ISBN: 0387964673,
!    LC: QA76.9.C65.B73.
!
!    Bennett Fox,
!    Algorithm 647:
!    Implementation and Relative Efficiency of Quasirandom
!    Sequence Generators,
!    ACM Transactions on Mathematical Software,
!    Volume 12, Number 4, December 1986, pages 362-376.
!
!    Pierre L'Ecuyer,
!    Random Number Generation,
!    in Handbook of Simulation,
!    edited by Jerry Banks,
!    Wiley, 1998,
!    ISBN: 0471134031,
!    LC: T57.62.H37.
!
!    Peter Lewis, Allen Goodman, James Miller,
!    A Pseudo-Random Number Generator for the System/360,
!    IBM Systems Journal,
!    Volume 8, Number 2, 1969, pages 136-143.
!
!  Parameters:
!
!    Input, integer ( kind = 4 ) A, B, the limits of the interval.
!
!    Input/output, integer ( kind = 4 ) SEED, the "seed" value, which
!    should NOT be 0.  On output, SEED has been updated.
!
!    Output, integer ( kind = 4 ) I4_UNIFORM_AB, a number between A and B.
!
  implicit none

  integer ( kind = 4 ) a
  integer ( kind = 4 ) b
  integer ( kind = 4 ), parameter :: i4_huge = 2147483647
  integer ( kind = 4 ) i4_uniform_ab
  integer ( kind = 4 ) k
  real ( kind = 4 ) r
  integer ( kind = 4 ) seed
  integer ( kind = 4 ) value

  if ( seed == 0 ) then
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'I4_UNIFORM_AB - Fatal error!'
    write ( *, '(a)' ) '  Input value of SEED = 0.'
    stop
  end if

  k = seed / 127773

  seed = 16807 * ( seed - k * 127773 ) - k * 2836

  if ( seed < 0 ) then
    seed = seed + i4_huge
  end if

  r = real ( seed, kind = 4 ) * 4.656612875E-10
!
!  Scale R to lie between A-0.5 and B+0.5.
!
  r = ( 1.0E+00 - r ) * ( real ( min ( a, b ), kind = 4 ) - 0.5E+00 ) &
    +             r   * ( real ( max ( a, b ), kind = 4 ) + 0.5E+00 )
!
!  Use rounding to convert R to an integer between A and B.
!
  value = nint ( r, kind = 4 )

  value = max ( value, min ( a, b ) )
  value = min ( value, max ( a, b ) )

  i4_uniform_ab = value

  return
end
function r8_uniform_01 ( seed )

!*****************************************************************************80
!
!! R8_UNIFORM_01 returns a unit pseudorandom R8.
!
!  Discussion:
!
!    An R8 is a real ( kind = 8 ) value.
!
!    For now, the input quantity SEED is an integer variable.
!
!    This routine implements the recursion
!
!      seed = 16807 * seed mod ( 2^31 - 1 )
!      r8_uniform_01 = seed / ( 2^31 - 1 )
!
!    The integer arithmetic never requires more than 32 bits,
!    including a sign bit.
!
!    If the initial seed is 12345, then the first three computations are
!
!      Input     Output      R8_UNIFORM_01
!      SEED      SEED
!
!         12345   207482415  0.096616
!     207482415  1790989824  0.833995
!    1790989824  2035175616  0.947702
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    05 July 2006
!
!  Author:
!
!    John Burkardt
!
!  Reference:
!
!    Paul Bratley, Bennett Fox, Linus Schrage,
!    A Guide to Simulation,
!    Springer Verlag, pages 201-202, 1983.
!
!    Pierre L'Ecuyer,
!    Random Number Generation,
!    in Handbook of Simulation,
!    edited by Jerry Banks,
!    Wiley Interscience, page 95, 1998.
!
!    Bennett Fox,
!    Algorithm 647:
!    Implementation and Relative Efficiency of Quasirandom
!    Sequence Generators,
!    ACM Transactions on Mathematical Software,
!    Volume 12, Number 4, pages 362-376, 1986.
!
!    Peter Lewis, Allen Goodman, James Miller
!    A Pseudo-Random Number Generator for the System/360,
!    IBM Systems Journal,
!    Volume 8, pages 136-143, 1969.
!
!  Parameters:
!
!    Input/output, integer ( kind = 4 ) SEED, the "seed" value, which should
!    NOT be 0. On output, SEED has been updated.
!
!    Output, real ( kind = 8 ) R8_UNIFORM_01, a new pseudorandom variate,
!    strictly between 0 and 1.
!
  implicit none

  integer ( kind = 4 ), parameter :: i4_huge = 2147483647
  integer ( kind = 4 ) k
  real ( kind = 8 ) r8_uniform_01
  integer ( kind = 4 ) seed

  if ( seed == 0 ) then
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'R8_UNIFORM_01 - Fatal error!'
    write ( *, '(a)' ) '  Input value of SEED = 0.'
    stop
  end if

  k = seed / 127773

  seed = 16807 * ( seed - k * 127773 ) - k * 2836

  if ( seed < 0 ) then
    seed = seed + i4_huge
  end if

  r8_uniform_01 = real ( seed, kind = 8 ) * 4.656612875D-10

  return
end
subroutine timestamp ( )

!*****************************************************************************80
!
!! TIMESTAMP prints the current YMDHMS date as a time stamp.
!
!  Example:
!
!    31 May 2001   9:45:54.872 AM
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    18 May 2013
!
!  Author:
!
!    John Burkardt
!
!  Parameters:
!
!    None
!
  implicit none

  character ( len = 8 ) ampm
  integer ( kind = 4 ) d
  integer ( kind = 4 ) h
  integer ( kind = 4 ) m
  integer ( kind = 4 ) mm
  character ( len = 9 ), parameter, dimension(12) :: month = (/ &
    'January  ', 'February ', 'March    ', 'April    ', &
    'May      ', 'June     ', 'July     ', 'August   ', &
    'September', 'October  ', 'November ', 'December ' /)
  integer ( kind = 4 ) n
  integer ( kind = 4 ) s
  integer ( kind = 4 ) values(8)
  integer ( kind = 4 ) y

  call date_and_time ( values = values )

  y = values(1)
  m = values(2)
  d = values(3)
  h = values(5)
  n = values(6)
  s = values(7)
  mm = values(8)

  if ( h < 12 ) then
    ampm = 'AM'
  else if ( h == 12 ) then
    if ( n == 0 .and. s == 0 ) then
      ampm = 'Noon'
    else
      ampm = 'PM'
    end if
  else
    h = h - 12
    if ( h < 12 ) then
      ampm = 'PM'
    else if ( h == 12 ) then
      if ( n == 0 .and. s == 0 ) then
        ampm = 'Midnight'
      else
        ampm = 'AM'
      end if
    end if
  end if

  write ( *, '(i2,1x,a,1x,i4,2x,i2,a1,i2.2,a1,i2.2,a1,i3.3,1x,a)' ) &
    d, trim ( month(m) ), y, h, ':', n, ':', s, '.', mm, trim ( ampm )

  return
end
subroutine tree_ignite ( forest_size, forest, i_ignite, j_ignite )

!*****************************************************************************80
!
!! TREE_IGNITE sets a given tree to the SMOLDERING state.
!
!  Licensing:
!
!    This code is distributed under the GNU LGPL license.
!
!  Modified:
!
!    30 June 2013
!
!  Author:
!
!    FORTRAN90 version by John Burkardt
!
!  Parameters:
!
!    Input, integer ( kind = 4 ) FOREST_SIZE, the linear dimension of
!    the forest.
!
!    Input, integer ( kind = 4 ) FOREST(FOREST_SIZE,FOREST_SIZE), an array
!    with an entry for each tree in the forest.
!
!    Input, integer ( kind = 4 ) I_IGNITE, J_IGNITE, the coordinates of the
!    tree which is to be set to SMOLDERING.
!
  implicit none

  integer ( kind = 4 ) forest_size

  integer ( kind = 4 ) forest(forest_size,forest_size)
  integer ( kind = 4 ) i_ignite
  integer ( kind = 4 ) j_ignite
  integer ( kind = 4 ), parameter :: SMOLDERING = 1

  forest(i_ignite,j_ignite) = SMOLDERING

  return
end


text:
*----------------------------------------------------------------------*
!>     wrapper for set_user_op
!>
!>     set up user-provided operator
!>     irestr is chosen appropriately
!>     @param[inout] op the operator struct
!>     @param[in] name name of the operator
!>     @param[in] occ_def
!>     @param[in] ndef
!>     @param[in] njoined number if joined vertices
!>     @param[in] occ_def definition of the ca stings
!>     @param[in] freeze ???
!>     @param[in] min_formal lower end of the formal blocks
!>     @param[in] orb_info information about the orbital spaces
*----------------------------------------------------------------------*
      subroutine set_uop2(op,name,
     &     occ_def,ndef,njoined,freeze,min_formal,orb_info)
*----------------------------------------------------------------------*
      implicit none
      include 'opdim.h'
      include 'def_operator.h'
      include 'def_orbinf.h'

      integer, parameter ::
     &     ntest = 00

      type(operator), intent(inout) ::
     &     op
      character, intent(in) ::
     &     name*(*)
      integer, intent(in) ::
     &     occ_def(ngastp,2,ndef*njoined), ndef, njoined, min_formal
      integer, intent(in) ::
     &     freeze(2,njoined)

      type(orbinf) ::
     &     orb_info
      integer ::
     &     ncadiff,
     &     irestr(2,orb_info%ngas,2,2)

      integer ::
     &     ndef_loc
      integer, pointer ::
     &     occ_def_loc(:,:,:)

      ndef_loc = ndef
      allocate(occ_def_loc(ngastp,2,ndef*njoined))
      occ_def_loc = occ_def

      call remove_inactive_occ(occ_def_loc,ndef_loc,freeze,
     &                                             njoined,orb_info)

      ncadiff = 0
      call set_restr_for_uop()

      call set_user_op2(op,name,optyp_operator,
     &     occ_def_loc,ndef_loc,njoined,irestr,freeze,
     &                              min_formal,orb_info)

      deallocate(occ_def_loc)
      return

      contains

*----------------------------------------------------------------------*
      subroutine set_restr_for_uop()
*----------------------------------------------------------------------*

      implicit none

      integer ::
     &     ica, igastp, igas, max_rank

      integer, external ::
     &     ifndmax

      max_rank = ifndmax(occ_def,1,ngastp*2*ndef*njoined,1)
      irestr(1:2,1:orb_info%ngas,1:2,1:2) = 0
      do ica = 1, 2
        do igas = 1, orb_info%ngas
          irestr(1,igas,ica,1) = 0
          irestr(2,igas,ica,1) = max_rank
        end do
      end do

      return
      end subroutine set_restr_for_uop

      end

max_stars_repo_name: ak-ustutt/GeCCo-public

max_issues_repo_name: ak-ustutt/GeCCo-public

max_forks_repo_name: ak-ustutt/GeCCo-public