Skip to content

Commit

Permalink
fixed test and added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jdegerickx committed Nov 26, 2024
1 parent 5d2fc4e commit 7fcd5fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/worldcereal/rdm_api/rdm_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def download_samples(
-------
gpd.GeoDataFrame
A GeoDataFrame containing the extracted samples.
For each sample, the collection ID is automatically included.
"""

# Determine which collections need to be queried if they are not specified
Expand Down
10 changes: 8 additions & 2 deletions tests/worldcerealtests/test_rdm_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_download_samples(
}
),
]
mock_get_download_urls.return_value = [file_path]
mock_get_download_urls.return_value = [str(file_path)]

interaction = RdmInteraction()
result_gdf = interaction.download_samples(
Expand All @@ -112,7 +112,13 @@ def test_download_samples(
)

# Check that col3 and valid_time indeed not included
assert result_gdf.columns.tolist() == ["col1", "col2", "geometry"]
# collection_id is automatically added
assert result_gdf.columns.tolist() == [
"col1",
"col2",
"collection_id",
"geometry",
]

# Check that the third up till last geometry are not included
# third and fourth are outside the spatiotemporal extent
Expand Down

0 comments on commit 7fcd5fc

Please sign in to comment.