Package: restee
resteePython package to call process EE objects via the REST API to local dataresteeis a package that aims to make plugging Earth Engine (EE) computations into downstream Python processing easier. The EE REST API allows user to interface with EE using REST API calls that allow for . There are many more features to the EE REST API, however,resteeaims to simply provide a user-friendly means to access computed server-side objects (like image data) from thePythonearthengine-apiAPI to a local Python enviroment (client-side).It should be noted thatresteerelies on fairly new and advanced EE features that may not be suitable for all users (seewarning from the EE team). If you are new to Earth Engine, please get started with theJavaScript guide.Installationresteerelies heavily on the geospatial Python ecosystem to manage different geospatial data formats and execute geospatial processes. It is recommended to usecondato handle the package dependencies and create a virtual environment. To do this run the following command:condacreate-nrestee-cconda-forge-y\python>=3.6\numpy\scipy\pandas\xarray\rasterio\geopandas\pyproj\requests\backoff\earthengine-api\tqdmOnce all of the dependencies are installed, theresteepackage can be installed usingpip:pipinstallresteeIt is strongly recommended to read theInstallation documentationGetting StartedThis section is meant purely as a demonstration of what is possible, please see theInstallation pagefor how to install package and setup the authentication then theUsage pagefor in depth information.importeeee.Initialize()importresteeasree# get an authenticated session with GCP for REST API callssession=ree.EESession("<CLOUD-PROJECT>","<PATH-TO-SECRET-KEY>")# use ee to get a featurecollection for USAcountries=ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")camerica=countries.filter(ee.Filter.eq("wld_rgn","Central America"))# define the domain imagery will be requested for# in this case it is the computed USA featurecollectiondomain=ree.Domain.from_ee_geometry(session,camerica,resolution=0.01)# define some computations# here we calculate median NDVI for the summer months over the USAmodis=(ee.ImageCollection("MODIS/006/MOD09GA").filterDate("2020-06-01","2020-09-01").map(lambdax:x.normalizedDifference(["sur_refl_b02","sur_refl_b01"])).median().rename("NDVI"))# request the ee.Image pixels as a xarray datasetndvi_ds=ree.img_to_xarray(session,domain,modis,no_data_value=0)# inspect the local xarray Dataset objectndvi_ds# output# <xarray.Dataset># Dimensions:  (lat: 1130, lon: 1509)# Coordinates:#   * lon      (lon) float64 -92.23 -92.22 -92.21 -92.2 ... -77.17 -77.16 -77.15#   * lat      (lat) float64 18.48 18.47 18.46 18.45 ... 7.225 7.215 7.205 7.195# Data variables:#     NDVI     (lat, lon) float32 nan nan nan nan nan nan ... nan nan nan nan nanFrom this point on the computed data is local to your system so you can do with it what you want. This allows the data to be plotted, persisted, or fed into another downstream process. For the sake of example, here we will plot the result.ndvi_ds.NDVI.plot(robust=True,cmap="viridis")Again, this quick example was to highlight how a user may define an EE computation using theearthengine-apiand request the data into a local data structure. One may useresteeto get zonal statitics calculated for feature collections or even explore collection metadata, any format on EE can be requested locally. For more details, please see theUsage page.Get in touchPlease report any bugs, ask questions, or suggest new features onGitHub.ContributeContributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.Licenseresteeis available under the open sourceMIT License.