scale_real_int Function

private pure function scale_real_int(real_array, a, b) result(int_scaled_array)

Scale the input real array to the integer RGB range [a, b]

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), dimension(:) :: real_array
integer, intent(in) :: a
integer, intent(in) :: b

Return Value integer, dimension(size(real_array))


Calls

proc~~scale_real_int~~CallsGraph proc~scale_real_int scale_real_int proc~scale_real_real scale_real_real proc~scale_real_int->proc~scale_real_real

Called by

proc~~scale_real_int~~CalledByGraph proc~scale_real_int scale_real_int proc~extract Colormap%extract proc~extract->proc~scale_real_int program~extract extract program~extract->proc~extract

Source Code

    pure function scale_real_int(real_array,a,b) result(int_scaled_array)
        real(wp), dimension(:), intent(in) :: real_array
        integer, intent(in) :: a, b
        real(wp), dimension(size(real_array)) :: normalizedArray
        integer, dimension(size(real_array)) :: int_scaled_array

        ! Normalize the real array elements to the range [0, 1]
        normalizedArray = scale_real_real(real_array, 0.0_wp, 1.0_wp)

        ! Scale the real array elements between a and b
        int_scaled_array = a + nint((b - a) * normalizedArray)
    end function scale_real_int