{"id":21539445,"url":"https://github.com/bluegreen-labs/gee_subset","last_synced_at":"2025-04-10T03:26:31.793Z","repository":{"id":54131208,"uuid":"97874563","full_name":"bluegreen-labs/gee_subset","owner":"bluegreen-labs","description":"Google Earth Engine subset script \u0026 library","archived":false,"fork":false,"pushed_at":"2022-12-05T11:23:58.000Z","size":136,"stargazers_count":49,"open_issues_count":2,"forks_count":32,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-24T04:43:38.840Z","etag":null,"topics":["data-retrieval","google-earth-engine","python"],"latest_commit_sha":null,"homepage":"https://bluegreen-labs.github.io/gee_subset/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluegreen-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-20T20:13:23.000Z","updated_at":"2024-02-26T09:01:42.000Z","dependencies_parsed_at":"2023-01-24T04:31:58.944Z","dependency_job_id":null,"html_url":"https://github.com/bluegreen-labs/gee_subset","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluegreen-labs%2Fgee_subset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluegreen-labs%2Fgee_subset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluegreen-labs%2Fgee_subset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluegreen-labs%2Fgee_subset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluegreen-labs","download_url":"https://codeload.github.com/bluegreen-labs/gee_subset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248150038,"owners_count":21055849,"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":["data-retrieval","google-earth-engine","python"],"created_at":"2024-11-24T04:15:21.916Z","updated_at":"2025-04-10T03:26:31.766Z","avatar_url":"https://github.com/bluegreen-labs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![DOI](https://zenodo.org/badge/97874563.svg)](https://zenodo.org/badge/latestdoi/97874563)\n\n# Google Earth Engine subset script \u0026 library\n\nThis is a small python script to subset GEE gridded data products into time series for a given location or list of locations. This script should make it easier to subset remote sensing time series for processing external to GEE.  If this code made your life easier please refer to it using the Zenodo citation as:\n\n\u003e Hufkens K. (2017) A Google Earth Engine time series subset script \u0026 library. DOI: 10.5281/zenodo.833789.\n\n## Installation\n\nMake sure you have a working Google Earth Engine python API setup. The installation instructions can be found on the [GEE developer site](https://developers.google.com/earth-engine/python_install).\n\nAfter this you can either install by cloning the repository: \n\n```bash\ngit clone https://github.com/khufkens/google_earth_engine_subsets.git\n```\nor, when integrating the script in other python code by using pypi:\n\n```bash\npip install gee-subset\n```\n\n## Use\n\n### command line\n\nBelow you find an example call to the scrip which downloads MODIS MYD09Q1 (-p, --product) reflectance data for bands 1 and 2 (-b, --band) for a number of sites as listed in selected_sites.csv and saves the results on the users desktop (-d, --directory).\n\n```bash\n./gee_subset.py -p \"MODIS/MYD09Q1\" \\\n                -b \"sur_refl_b01\" \"sur_refl_b02\" \\\n                -f \"~/Desktop/selected_sites.csv\" \\\n                -d \"/Users/foo/Desktop/\"\n```\n\n``` bash\n# prints output to console\n./gee_subset.py -p \"LANDSAT/LC08/C01/T1\" \\\n                -b \"B1\" \"B2\" \\\n                -s \"2015-01-01\" \\\n                -e \"2015-12-31\" \\\n                -l 44.064665 -71.287575\n```\n\nSites can be listed as a latitude longitude tuple using the -loc parameter, or by providing the before mentioned csv file (-f, --file parameter). Either one should be provided.\n\nThe csv file is a comma delimited file of the format:\n\n\tsite, latitude, longitude.\n\nA padding value can be provided (-pd, --pad) so one can download a rectangular window of data padded x km in either direction around a particular location. This option is limited by the maximum pixels which GEE can export. For normal use (i.e. 1 to 2 km padding) this should not present a problem for most products.\n\nGeneral help can be queried by calling:\n```bash\n./gee_subset.py -h\n```\n\n### python module\n\nIn addition the script can be loaded as a library in a python script module by calling:\n\n```python\nimport gee_subset\n\n# or for the module itself\nfrom gee_subset import gee_subset\n\n```\nThe function is called gee_subset(). Consult the script for correct parameter naming conventions. Currently minimum error trapping is provided.\n\nWhen using the python module remember that the module does not support lazy loading of dependencies. You will need the start your code with:\n\n```python\n# load required modules\n# these are required and the module\n# will fail without them!\nimport os, re\nimport pandas as pd\nfrom datetime import datetime\nimport ee\nfrom gee_subset import gee_subset\n\n# Initialize earth engine\nee.Initialize()\n\n# your call (below a MODIS example)\ndf = gee_subset(product = \"MODIS/MYD09Q1\", bands = [\"sur_refl_b01\", \"sur_refl_b02\"], start_date = \"2015-01-01\", end_date = \"2015-12-31\", latitude = 44, longitude = -72, scale = 30)\n\nprint(df)\n```\n\n## Data format\n\nThe output of the script is [tidy data](https://cran.r-project.org/web/packages/tidyr/vignettes/tidy-data.html) in which each row is an observation. Multiple observations can be returned in case a padding value is specified. Multiple bands can be called at once by providing multiple valid bands as an argument. Multiple bands will be returned as columns in the tidy data format. When datasets overlap, such as is the case of sidelapped tiles in Landsat 8 data multiple values are returned for a given location or date. In this case the `id` column will inform you on the source of the data.\n\n## Demo code\n\nAn example query, calling the python script from R, downloads two years (~100 data points) of Landsat 8 Tier 1 data for two bands (red, NIR) in ~8 seconds flat. Querying for a larger footprint (1x1 km footprint) only creates a small overhead (13 sec. query). The resulting figure for the point location with the derived NDVI values is shown below. The demo script to recreate this figure is included in the examples folder of the github repository.\n\n![](examples/demo_vis.png?raw=true)\n\n## References\n\nHufkens K. (2017) A Google Earth Engine time series subset script \u0026 library. DOI: 10.5281/zenodo.833789.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluegreen-labs%2Fgee_subset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluegreen-labs%2Fgee_subset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluegreen-labs%2Fgee_subset/lists"}