Skip to content

stratify gives strange results if heights run in opposite directions #50

@nhsavage

Description

@nhsavage
z_targ = np.array([0.0, 1.0, 2.0, 3.0, 4.0])

z_source = np.array([0., 0.5, 1.5, 2.5, 3.5, 4.5])
data_source = z_source.copy()
out  = stratify.interpolate(z_targ, z_source, data_source)
print(out)

#  now flip data to be interpolated
z_source = np.flip(z_source)
data_source = np.flip(data_source)
out  = stratify.interpolate(z_targ, z_source, data_source)
print(out)

Gives:

[0. 1. 2. 3. 4.]
[ 0. nan nan nan nan]

Either the reversed heights should raise a ValuError or (better) the input heights should be flipped internally before doing the interpolation

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions