Do not round 1d LithosphericTemp profile to nearest km (fixes extrapolation error) #174
+8
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change is driven by the fact that, by default, the
interp_linear_T
function created bylinear_interpolation
throws when asked to extrapolate without being given an extrapolation method.The need for extrapolation is due the 1d temperature profile being constructed by rounding min/max depth to the nearest km, sometimes resulting in a slightly smaller depth range than the actual layers in the model.
I think I understand the original impetus for rounding to the nearest km: it is highly likely that the user has input lithosphere thicknesses as a whole-km number, but finite grid spacing means that interfaces get shifted a bit.
However, I think it is more accurate to forego rounding here. Whether my lithosphere ends up being 100km or 99.3km, I want the base and surface of it to initially be certain temperatures in the model.
Removing the rounding removes the possibility of extrapolation and results in a T profile that will be interpolated onto the model slightly more accurately.
Also renamed some of the internal variables for clarity.