Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image order bug #35

Merged
merged 1 commit into from Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions sankee/sampling.py
Expand Up @@ -57,6 +57,10 @@ def extract_values_at_point(pt):
" image overlaps the sampling region."
)

# EE data gets sorted alpha, so re-sort columns to the image order. Run this after the column
# check because this can add columns that were missing.
data = data.reindex(image_labels, axis=1)

if include is not None:
data = data[data.isin(include).all(axis=1)]

Expand Down
3 changes: 2 additions & 1 deletion tests/data.py
Expand Up @@ -8,7 +8,8 @@
TEST_DATASET.get_year(1985),
TEST_DATASET.get_year(2010),
]
TEST_IMAGE_LABELS = ["1985", "2010"]
# Use labels that don't sort alpha to ensure order stays correct
TEST_IMAGE_LABELS = ["Start (1985)", "End (2010)"]
TEST_REGION = ee.Geometry.Point([-122.192688, 46.25917]).buffer(1000)

TEST_DATA = pd.DataFrame(
Expand Down