{"id":19399916,"url":"https://github.com/worldbank/gee_zonal","last_synced_at":"2025-04-24T06:32:40.502Z","repository":{"id":48677614,"uuid":"344141876","full_name":"worldbank/GEE_Zonal","owner":"worldbank","description":"Collection of python tools for running zonal stats on Google Earth Engine layers","archived":false,"fork":false,"pushed_at":"2025-04-11T00:26:06.000Z","size":10014,"stargazers_count":20,"open_issues_count":0,"forks_count":6,"subscribers_count":26,"default_branch":"main","last_synced_at":"2025-04-11T00:26:32.602Z","etag":null,"topics":["google-earth-engine","zonal-statistics"],"latest_commit_sha":null,"homepage":"https://worldbank.github.io/GEE_Zonal/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/worldbank.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-03-03T13:47:50.000Z","updated_at":"2025-04-11T00:25:42.000Z","dependencies_parsed_at":"2023-02-15T23:16:01.596Z","dependency_job_id":"3e332509-59fd-42cd-a88f-1cc2b1bf610b","html_url":"https://github.com/worldbank/GEE_Zonal","commit_stats":{"total_commits":94,"total_committers":8,"mean_commits":11.75,"dds":0.6170212765957447,"last_synced_commit":"0a4262986d2a48277643c05f53f98211ce936d81"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":"worldbank/template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2FGEE_Zonal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2FGEE_Zonal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2FGEE_Zonal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2FGEE_Zonal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/worldbank","download_url":"https://codeload.github.com/worldbank/GEE_Zonal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250578754,"owners_count":21453352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-earth-engine","zonal-statistics"],"created_at":"2024-11-10T11:12:11.116Z","updated_at":"2025-04-24T06:32:40.486Z","avatar_url":"https://github.com/worldbank.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GEE Zonal\n\n[![PyPI version](https://badge.fury.io/py/gee-zonal.svg)](https://badge.fury.io/py/gee-zonal)\n![GitHub issues](https://img.shields.io/github/issues/worldbank/GEE_Zonal?style=plastic)\n![GitHub stars](https://img.shields.io/github/stars/worldbank/GEE_Zonal?style=social)\n\nThis python package provides a wrapper function to request temporal and zonal statistics from Google Earth Engine (GEE) datasets.\n\n## Summary\n\nA zonal statistics function was created to ease the process of working with the GEE API. The function can work with any raster data loaded to EE (`ee.ImageCollections` or `ee.Image`) and vector features (`geopandas.GeoDataFrame` or `ee.FeatureCollection`), and returns tabular data.\n\nStatistics can be requested at various temporal resolutions (`original` frequency, `monthly`, or `annual`). The workflow conducts pixel-by-pixel temporal aggregations, before summarizing statistics over target features.\n\nAdditionally, the package provides functionality to quickly search the GEE Catalog.\n\n#### [Documentation Pages](https://worldbank.github.io/GEE_Zonal/)\n\n## Installation\n\nThe required dependencies are *earthengine-api*, *geopandas*, *geojson*, and *notebook*. The package (and dependencies) can be installed via pip:\n\n```sh\npip install gee_zonal\n```\n\n## Setup\n\nThe Earth Engine Python API needs to be authenticated with a Google account. First, sign up to Google Earth Engine [here](https://earthengine.google.com/signup/).\n\nLaunch a jupyter notebook, and authenticate your account with the ee library.\n\n```python\nimport ee\nee.Authenticate()\n```\n\nYou can check that this worked by running `ee.Initialize()`, then import and run the library:\n\n```python\nfrom gee_zonal import ZonalStats, Catalog\n```\n\nIf the pip installation is not working, you can recreate the environment before and install the package from source:\n\n```sh\nconda create -n ee\nconda activate ee\nconda install -c conda-forge earthengine-api geopandas notebook ipykernel​\ngit clone https://github.com/worldbank/GEE_Zonal.git\npython setup.py build\npython setup.py install\npython -m ipykernel install --user --name ee --display-name \"Earth Engine\"\n```\n\n## Usage\n\n### ZonalStats()\n\nMain class to calculate temporal and zonal statistics using the GEE backend. The object can be initialized with parameters specifying data inputs and the type of aggregation.\n\n```python\nimport ee\nfrom gee_zonal import ZonalStats\nAOIs = ee.FeatureCollection('\u003cid of ee.FeatureCollection\u003e')\nAOIs = '\u003cpath to shapefile\u003e'\nzs = ZonalStats(\n  collection_id = 'LANDSAT/LC08/C01/T1_8DAY_NDVI',\n  target_features = AOIs,\n  statistic_type = \"all\", # all includes min, max, mean, and stddev\n  frequency = \"annual\",\n  temporal_stat = \"mean\"\n)\n```\n\nSee docstring for more details on the input parameters for `ZonalStats()` and the [example notebook](.docs/examples/zonal_statistics_example.ipynb).\n\nThe output statistics can be retrieved directly in the notebook (as a `DataFrame`):\n\n```python\nres = zs.runZonalStats()\n```\n\nOr retrieved from Google Drive as a csv table if an `output_name` and `output_dir` were specified.\n\n### Catalog()\n\nInventory of Earth Engine datasets with some functions to search catalog by tags, title, and year / time period\n\n```python\nfrom gee_zonal import Catalog\ncat = Catalog()\n```\n\nThe catalog object contains a `datasets` variable, a `DataFrame` containing a copy of the Earth Engine data catalog, retrieved from [Earth-Engine-Datasets-List](https://github.com/samapriya/Earth-Engine-Datasets-List).\n\n```python\ncat.datasets\n```\n\n#### Search functions\n\n```python\nresults = cat.search_tags(\"ndvi\")\nresults = results.search_by_period(1985, 2021)\nresults = results.search_title(\"landsat\")\nprint(results)\n```\n\n## Additional Resources\n\n- [geemap](https://geemap.org/): Python library with more functionality to work with GEE.\n- [awesome-gee-community-catalog](https://gee-community-catalog.org/): Extended catalog of EE datasets.\n\n## License\n\n[**World Bank Master Community License Agreement**](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldbank%2Fgee_zonal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworldbank%2Fgee_zonal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldbank%2Fgee_zonal/lists"}