Replace all occurrences of a value in a real column
Uses tolerance-based comparison for real values
@param[in,out] df The data frame instance @param[in] col_index Index of the column @param[in] old_value Value to replace @param[in] new_value Replacement value
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(data_frame), | intent(inout) | :: | df | |||
integer, | intent(in) | :: | col_index | |||
real(kind=rk), | intent(in) | :: | old_value | |||
real(kind=rk), | intent(in) | :: | new_value |
subroutine df_replace_value_real(df, col_index, old_value, new_value) type(data_frame), intent(inout) :: df integer, intent(in) :: col_index real(rk), intent(in) :: old_value, new_value real(rk), dimension(:), allocatable :: col integer :: i real(rk), parameter :: tol = 1.0e-10_rk col = df_get_col_real(df, col_index) do i = 1, size(col) if (abs(col(i) - old_value) < tol) then col(i) = new_value end if end do call df_set_col_real(df, col_index, col) end subroutine df_replace_value_real