Skip to content
2 changes: 1 addition & 1 deletion dataretrieval/waterdata/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ def get_stats_data(
headers=headers,
)
body = resp.json()
all_dfs.append(_handle_stats_nesting(body, geopd=False))
all_dfs.append(_handle_stats_nesting(body, geopd=GEOPANDAS))
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already covered: test_get_stats_data_preserves_geometry_across_pages (added in this PR) explicitly mocks two pages with point geometries, runs them through get_stats_data with GEOPANDAS=True, and asserts the result is a gpd.GeoDataFrame with df.geometry.notna().all() across all 2 sites. Also verified against the live API: with state=US:42, parameter=00060, page_size=1, the buggy code leaves 0/1890 page-2 rows with geometry while the fix preserves 1890/1890.

next_token = body["next"]
except Exception: # noqa: BLE001
error_text = _error_body(resp)
Expand Down
Loading