Skip to content

Commit 4f54b78

Browse files
andrewwinters5000github-actions[bot]JoshuaLampert
authored
Rename helper function to not mention bicubic (#75)
* rename helper function to not mention bicubic * add a deprecated function version * fix formatting * adjust the deprecated function to work properly * add NEWS entry about the deprecation * Update ext/TrixiBottomTopographyMakieExt.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update NEWS.md Co-authored-by: Joshua Lampert <[email protected]> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joshua Lampert <[email protected]>
1 parent 334fc2e commit 4f54b78

File tree

7 files changed

+24
-12
lines changed

7 files changed

+24
-12
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ for human readability.
1818

1919
#### Deprecated
2020

21+
- Helper function `evaluate_bicubicspline_interpolant` renamed to be `evaluate_two_dimensional_interpolant` [#75]
22+
2123
#### Removed

docs/src/function.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ y_int_pts = Vector(LinRange(spline_struct.y[1], spline_struct.y[end], n))
116116

117117
To fill a matrix `z_int_pts`, which contains the corresponding `z` values
118118
for `x_int_pts` and `y_int_pts`, we use the helper function
119-
`evaluate_bicubicspline_interpolant`.
119+
`evaluate_two_dimensional_interpolant`.
120120

121121
```@example 2d
122122
# Get interpolated matrix
123-
z_int_pts = evaluate_bicubicspline_interpolant(spline_func, x_int_pts, y_int_pts)
123+
z_int_pts = evaluate_two_dimensional_interpolant(spline_func, x_int_pts, y_int_pts)
124124
```
125125

126126
Plotting the interpolated values gives the representation directly below the
@@ -142,7 +142,7 @@ with the interpolation knots as follows
142142
# Get the original interpolation knots
143143
x_knots = spline_struct.x
144144
y_knots = spline_struct.y
145-
z_knots = evaluate_bicubicspline_interpolant(spline_func, x_knots, y_knots)
145+
z_knots = evaluate_two_dimensional_interpolant(spline_func, x_knots, y_knots)
146146
147147
plot_topography_with_interpolation_knots(x_int_pts, y_int_pts, z_int_pts,
148148
x_knots, y_knots, z_knots;

examples/rhine_data_bicubic-free.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ if isdefined(Main, :Makie)
2424
y_int_pts = Vector(LinRange(spline_struct.y[1], spline_struct.y[end], n))
2525

2626
# Get interpolated matrix
27-
z_int_pts = evaluate_bicubicspline_interpolant(spline_func, x_int_pts, y_int_pts)
27+
z_int_pts = evaluate_two_dimensional_interpolant(spline_func, x_int_pts, y_int_pts)
2828

2929
# Get the original interpolation knots
3030
x_knots = spline_struct.x
3131
y_knots = spline_struct.y
32-
z_knots = evaluate_bicubicspline_interpolant(spline_func, x_knots, y_knots)
32+
z_knots = evaluate_two_dimensional_interpolant(spline_func, x_knots, y_knots)
3333

3434
plot_topography_with_interpolation_knots(x_int_pts, y_int_pts, z_int_pts,
3535
x_knots, y_knots, z_knots;

examples/rhine_data_bicubic-nak.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if isdefined(Main, :Makie)
2424
y_int_pts = Vector(LinRange(spline_struct.y[1], spline_struct.y[end], n))
2525

2626
# Get interpolated matrix
27-
z_int_pts = evaluate_bicubicspline_interpolant(spline_func, x_int_pts, y_int_pts)
27+
z_int_pts = evaluate_two_dimensional_interpolant(spline_func, x_int_pts, y_int_pts)
2828

2929
plot_topography(x_int_pts, y_int_pts, z_int_pts;
3030
xlabel = "ETRS89\n East",

examples/rhine_data_bilinear.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if isdefined(Main, :Makie)
2323
y_int_pts = Vector(LinRange(spline_struct.y[1], spline_struct.y[end], n))
2424

2525
# Get interpolated matrix
26-
z_int_pts = evaluate_bicubicspline_interpolant(spline_func, x_int_pts, y_int_pts)
26+
z_int_pts = evaluate_two_dimensional_interpolant(spline_func, x_int_pts, y_int_pts)
2727

2828
plot_topography(x_int_pts, y_int_pts, z_int_pts;
2929
xlabel = "E", ylabel = "N", zlabel = "H")

ext/TrixiBottomTopographyMakieExt.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,26 @@ using Makie: Makie
88
using TrixiBottomTopography
99

1010
# Import functions such that they can be extended with new methods
11-
import TrixiBottomTopography: evaluate_bicubicspline_interpolant, plot_topography,
11+
import TrixiBottomTopography: evaluate_two_dimensional_interpolant, plot_topography,
1212
plot_topography_with_interpolation_knots
1313

14+
# To keep functionality we allow for the old function name `evaluate_bicubicspline_interpolant` to be used.
15+
# From a front end perspective nothing changes; however, if one starts Julia with `--depwarn=yes`
16+
# a warning would be thrown when one uses the deprecated function name.
17+
function TrixiBottomTopography.evaluate_bicubicspline_interpolant(spline, x, y)
18+
Base.depwarn("evaluate_bicubicspline_interpolant is deprecated. Use evaluate_two_dimensional_interpolant instead.",
19+
:evaluate_bicubicspline_interpolant)
20+
return evaluate_two_dimensional_interpolant(spline, x, y)
21+
end
22+
1423
"""
15-
evaluate_bicubicspline_interpolant(spline, x, y)
24+
evaluate_two_dimensional_interpolant(spline, x, y)
1625
1726
Helper function to sample the bicubic spline function `spline`
1827
at the interpolation nodes `x` (with size `n`) and `y` (with size `m`)
1928
and return the values in an array `z` of size `m` by `n`.
2029
"""
21-
function evaluate_bicubicspline_interpolant(spline, x, y)
30+
function evaluate_two_dimensional_interpolant(spline, x, y)
2231

2332
# Get dimensions for solution matrix
2433
n = length(x)

src/TrixiBottomTopography.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ export convert_dgm_1d, convert_dgm_2d
3737
# Note, Empty routines for visualization are included and exported. They are extended
3838
# in `ext/TrixiBottomTopographyMakieExt.jl` where their implementations are found.
3939
function evaluate_bicubicspline_interpolant end
40+
function evaluate_two_dimensional_interpolant end
4041
function plot_topography end
4142
function plot_topography_with_interpolation_knots end
42-
export evaluate_bicubicspline_interpolant, plot_topography,
43-
plot_topography_with_interpolation_knots
43+
export evaluate_bicubicspline_interpolant, evaluate_two_dimensional_interpolant,
44+
plot_topography, plot_topography_with_interpolation_knots
4445

4546
end

0 commit comments

Comments
 (0)