This function returns a new lookup table from regularly spaced data
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | x_min(2) |
Minimum coordinate |
||
| real(kind=dp), | intent(in) | :: | x_max(2) |
Maximum coordinate |
||
| real(kind=dp), | intent(in) | :: | spaced_data(:,:,:) |
Input data of shape (nx, ny, n_cols) |
function LT2_create_from_data(x_min, x_max, spaced_data) result(my_lt) real(dp), intent(in) :: x_min(2) !< Minimum coordinate real(dp), intent(in) :: x_max(2) !< Maximum coordinate real(dp), intent(in) :: spaced_data(:, :, :) !< Input data of shape (nx, ny, n_cols) integer :: n_points(2), n_cols type(LT2_t) :: my_lt n_points(1) = size(spaced_data, 1) n_points(2) = size(spaced_data, 2) n_cols = size(spaced_data, 3) if (any(x_max <= x_min)) stop "LT2_create error: x_max <= x_min" if (any(n_points <= 1)) stop "LT2_create error: n_points <= 1" my_lt%n_cols = n_cols my_lt%n_points = n_points my_lt%x_min = x_min my_lt%dx = (x_max - x_min) / (n_points - 1) my_lt%inv_dx = 1 / my_lt%dx my_lt%rows_cols = spaced_data end function LT2_create_from_data