input_nc_check_missing Subroutine

public subroutine input_nc_check_missing(mb)

Uses

    • netcdf
  • proc~~input_nc_check_missing~~UsesGraph proc~input_nc_check_missing input_nc_check_missing netcdf netcdf proc~input_nc_check_missing->netcdf

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: mb

Calls

proc~~input_nc_check_missing~~CallsGraph proc~input_nc_check_missing input_nc_check_missing proc~log_error log_error proc~input_nc_check_missing->proc~log_error proc~log_debug log_debug proc~input_nc_check_missing->proc~log_debug nf90_get_var nf90_get_var proc~input_nc_check_missing->nf90_get_var proc~log_warn log_warn proc~input_nc_check_missing->proc~log_warn proc~input_nc_check_error input_nc_check_error proc~input_nc_check_missing->proc~input_nc_check_error proc~log_message log_message proc~log_error->proc~log_message proc~log_debug->proc~log_message proc~log_warn->proc~log_message proc~input_nc_check_error->proc~log_error nf90_strerror nf90_strerror proc~input_nc_check_error->nf90_strerror proc~log_write log_write proc~log_message->proc~log_write proc~log_format_message log_format_message proc~log_message->proc~log_format_message proc~to_string to_string proc~log_write->proc~to_string proc~date_time_str date_time_str proc~log_format_message->proc~date_time_str proc~colourise colourise proc~log_format_message->proc~colourise proc~string_index string_index proc~colourise->proc~string_index

Called by

proc~~input_nc_check_missing~~CalledByGraph proc~input_nc_check_missing input_nc_check_missing proc~input_nc_initialise input_nc_initialise proc~input_nc_initialise->proc~input_nc_check_missing proc~initialise initialise proc~initialise->proc~input_nc_initialise program~swim swim program~swim->proc~initialise

Contents


Source Code

  subroutine input_nc_check_missing(mb)
    use netcdf, only : nf90_get_var
    integer, intent(in) :: mb
    integer :: sb, i, ii, nmissing
    real(dp) :: v

    call log_debug("input_nc_check_missing", 'Checking for missing values...')
    nmissing = 0
    do i = 1, 6
      ! read one day/record
      call input_nc_check_error( nf90_get_var(nc_ids(i), nc_var_ids(i), nc_var_in, (/ nc_xmin, nc_ymin, nc_nday /), (/ nc_nx, nc_ny, 1 /)) )
      ! loop over nc_var_in again and check for missing or fill values
      do sb = 1, mb
        do ii = 1, nc_ncells_sb(sb)
          v = nc_var_in(nc_x_sb(sb, ii), nc_y_sb(sb, ii))
          if (v == nc_attr_vals(i, 3) .or. v == nc_attr_vals(i, 4)) then
            call log_warn("input_nc_check_missing", trim(NC_FNAMES(i))//' ('// &
              trim(NC_VNAMES(i))//') missing in (subbasin):', i1=sb, &
              reals=(/nc_lon_sb(sb, ii), nc_lat_sb(sb, ii)/))
            nmissing = nmissing + 1
          endif
        enddo
      enddo
    enddo
    if (nmissing > 0) then
      call log_error("input_nc_check_missing", 'Encountered N missing values:', &
        int=nmissing)
    endif
  endsubroutine input_nc_check_missing