thinkingmachines / geowrangler

🌏 A python package for wrangling geospatial datasets
https://geowrangler.thinkingmachin.es/
MIT License
47 stars 14 forks source link

Addressed warnings, fixed raster zonal stats tests, and general cleanup #247

Closed joshuacortez closed 4 weeks ago

joshuacortez commented 4 weeks ago

I made some edits throughout the scripts and notebooks to minimize the warnings when running pytest. This can help future-proof the repo against upcoming deprecations

Pandas Related

  1. Address pandas' SettingWithCopyWarning warning by creating a copy when applicable
  2. Replacing instances of using pandas operations that use inplace to use instead use standard assignment for consistency since some instances of using inplace are deprecated
  3. Replaced usage of np.array_split on a dataframe to be a straightforward list comprehension due to a pandas/geopandas warning

Raster Zonal Stats Related

  1. Added a CRS check for both the rasterstats and exactextract implementations of raster zonal stats
  2. Made new tests and fixed existing tests in test_raster_zonal_stats.py

Overall cleanup

  1. Used nbdev_clean to remove metadata from notebooks (that's why so many notebooks are affected lol)
  2. Slight edits for readability (e.g. .format to f-string etc.)

How to check for reviewers

  1. As for the scripts, you only need to check test_raster_zonal_stats.py and test_raster_process.py
  2. For the notebooks, use ReviewNB to review so it's easier since it skips notebooks with only metadata edits from nbdev_clean
review-notebook-app[bot] commented 4 weeks ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

butchtm commented 4 weeks ago

lgtm!