From 589a07e323fad95336af4d38e70982db94cb5da2 Mon Sep 17 00:00:00 2001 From: Alex Merose Date: Mon, 24 Jun 2024 11:31:57 +0200 Subject: [PATCH] Added badges, updated README. (#10) Also added a tiny contributing section. --- README.md | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7bc718c..127f375 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,21 @@ # dask-ee -Google Earth Engine `FeatureCollection`s via Dask DataFrames +_Google Earth Engine Feature Collections via Dask DataFrames._ + +[![ci](https://github.com/alxmrs/dask-ee/actions/workflows/ci-build.yml/badge.svg)](https://github.com/alxmrs/dask-ee/actions/workflows/ci-build.yml) +[![PyPi Version](https://img.shields.io/pypi/v/dask-ee.svg)](https://pypi.python.org/pypi/dask-ee) +[![Downloads](https://static.pepy.tech/badge/dask-ee)](https://pepy.tech/project/dask-ee) ## How to use Install with pip: ```shell -pip install --upgrade dask-ee +pip install dask-ee ``` Then, authenticate Earth Engine: ```shell -earthengine authenticate --quiet +earthengine authenticate ``` In your Python environment, you may now import the library: @@ -28,8 +32,8 @@ ee.Initialize() From here, you can read Earth Engine FeatureCollections like they are DataFrames: ```python -ddf = dask_ee.read_ee("WRI/GPPD/power_plants") -ddf.head() +df = dask_ee.read_ee("WRI/GPPD/power_plants") +df.head() ``` These work like Pandas DataFrames, but they are lazily evaluated via [Dask](https://dask.org/). @@ -37,7 +41,7 @@ Feel free to do any analysis you wish. For example: ```python # Thanks @aazuspan, https://www.aazuspan.dev/blog/dask_featurecollection ( - ddf[ddf.comm_year.gt(1940) & ddf.country.eq("USA") & ddf.fuel1.isin(["Coal", "Wind"])] + df[df.comm_year.gt(1940) & df.country.eq("USA") & df.fuel1.isin(["Coal", "Wind"])] .astype({"comm_year": int}) .drop(columns=["geo"]) .groupby(["comm_year", "fuel1"]) @@ -57,23 +61,26 @@ For one, you may pass in a pre-processed `ee.FeatureCollection`. This allows ful of the Earth Engine API. ```python -import dask_ee - fc = ( ee.FeatureCollection("WRI/GPPD/power_plants") .filter(ee.Filter.gt("comm_year", 1940)) .filter(ee.Filter.eq("country", "USA")) ) -ddf = dask_ee.read_ee(fc) +df = dask_ee.read_ee(fc) ``` In addition, you may change the `chunksize`, which controls how many rows are included in each Dask partition. ```python -ddf = dask_ee.read_ee("WRI/GPPD/power_plants", chunksize=7_000) -ddf.head() +df = dask_ee.read_ee("WRI/GPPD/power_plants", chunksize=7_000) +df.head() ``` +## Contributing + +Contributions are welcome. A good way to start is to check out open [issues](https://github.com/alxmrs/dask-ee/issues) +or file a new one. We're happy to review pull requests, too. + ## License ``` Copyright 2024 Alexander S Merose