Check if real values are in a given list
@param df The data frame @param col_index Column index to check @param values Array of values to check for membership @return Logical array indicating membership
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(data_frame), | intent(in) | :: | df | |||
integer, | intent(in) | :: | col_index | |||
real(kind=rk), | intent(in), | dimension(:) | :: | values |
function df_isin_real(df, col_index, values) result(mask) type(data_frame), intent(in) :: df integer, intent(in) :: col_index real(rk), dimension(:), intent(in) :: values logical, dimension(:), allocatable :: mask real(rk), dimension(:), allocatable :: col_data integer :: i, j if (col_index < 1 .or. col_index > df % ncols()) error stop "column index out of range" if (df % dtype(col_index) /= REAL_NUM) error stop "column is not real type" col_data = df_get_col_real(df, col_index) allocate (mask(size(col_data))) mask = .false. do i = 1, size(col_data) do j = 1, size(values) if (abs(col_data(i) - values(j)) < 1.0e-10_rk) then mask(i) = .true. exit end if end do end do deallocate (col_data) end function df_isin_real