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