ActualObservations Subroutine

public subroutine ActualObservations(network, count, activeNetwork)

count number of observations different from missing data Can optionally return network containing actual measurements.

Arguments

Type IntentOptional Attributes Name
type(ObservationalNetwork), intent(in) :: network
integer(kind=short), intent(out) :: count
type(ObservationalNetwork), intent(out), optional :: activeNetwork

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: i

Source Code

SUBROUTINE ActualObservations &
!
(network, count, activeNetwork)

IMPLICIT NONE

!Arguments with intent (in):
TYPE (ObservationalNetwork), INTENT(IN) :: network

!Arguments with intent (out):
TYPE (ObservationalNetwork), OPTIONAL, INTENT(OUT) :: activeNetwork
INTEGER (KIND = short), INTENT (OUT) :: count

!local declarations
INTEGER (KIND = short) :: i
!--------------------------end of declarations---------------------------------
count = 0
DO i = 1, network % countObs
  IF (network % obs (i) % value /= network % nodata) THEN
    count = count + 1
  END IF
END DO

!active network
IF (PRESENT (activeNetwork)) THEN

    activeNetwork % countObs = count

    IF (activeNetwork % countObs == 0) THEN
      CALL Catch ('error', 'ObservationalNetworks', &
           'no available values to build active network' )   
    END IF

    activeNetwork % nodata = network % nodata 
    activeNetwork % timeIncrement = network % timeIncrement 
    activeNetwork % time = network % time 
    activeNetwork % dataType = network % dataType 
    activeNetwork % description = network % description 
    activeNetwork % unit = network % unit
    activeNetwork % offsetZ = network % offsetZ 
    activeNetwork % mapping = network % mapping

    ALLOCATE (activeNetwork % obs (count))

    !copy active values
    count = 0
    DO i = 1, network % countObs
      IF (network % obs (i) % value /= network % nodata) THEN
         count = count + 1
         activeNetwork % obs (count) % name = network % obs (i) % name
         activeNetwork % obs (count) % value = network % obs (i) % value
         activeNetwork % obs (count) % id = network % obs (i) % id
         activeNetwork % obs (count) % xyz = network % obs (i) % xyz
         activeNetwork % obs (count) % z = network % obs (i) % z
      END IF
    END DO		
END IF


END SUBROUTINE ActualObservations