This function returns a new lookup table from regularly spaced data
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | x_min(3) |
Minimum coordinate |
||
| real(kind=dp), | intent(in) | :: | x_max(3) |
Maximum coordinate |
||
| real(kind=dp), | intent(in) | :: | spaced_data(:,:,:,:) |
Input data of shape (nx, ny, nz, n_cols) |
function LT3_create_from_data(x_min, x_max, spaced_data) result(my_lt) real(dp), intent(in) :: x_min(3) !< Minimum coordinate real(dp), intent(in) :: x_max(3) !< Maximum coordinate real(dp), intent(in) :: spaced_data(:, :, :, :) !< Input data of shape (nx, ny, nz, n_cols) integer :: n_points(3), n_cols type(LT3_t) :: my_lt n_points(1) = size(spaced_data, 1) n_points(2) = size(spaced_data, 2) n_points(3) = size(spaced_data, 3) n_cols = size(spaced_data, 4) if (any(x_max <= x_min)) stop "LT3_create error: x_max <= x_min" if (any(n_points <= 1)) stop "LT3_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 !TODO modified so that it does not rely on automatic allocation allocate(my_lt%rows_cols(n_points(1), n_points(2), n_points(3), n_cols)) my_lt%rows_cols = spaced_data end function LT3_create_from_data