Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README and minor code improvement #7

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dev
env
env
*.pyc
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,27 @@ Inputs to geeet models can be given as [numpy arrays](https://numpy.org/doc/stab

## Introduction

*geeet* is a Python package providing a common set of building blocks for estimating evapotranspiration (ET) from remote sensing observations. It also features complete ET models such as [PT-JPL](https://doi.org/10.1016/j.rse.2007.06.025) and [TSEB](https://doi.org/10.1016/0168-1923(95)02265-Y). All modules in *geeet* are designed to work with the input data provided in two formats: (1) as [numpy ndarrays](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html) and (2) as [Google Earth Engine](https://earthengine.google.com/) (GEE) [images](https://developers.google.com/earth-engine/apidocs/ee-image). GEE is a cloud-based platform dedicated to Earth observation research that offers a [multi-petabyte catalogue](https://developers.google.com/earth-engine/datasets/) of geospatial data. Importantly, GEE offers cloud computing capabilities, which means that a user can interact with this geospatial data directly without having to download or process any data on premises. Access to these cloud-based services requires [signing up for a GEE account](https://earthengine.google.com/signup/). The *geeet* Python package was created to offer ET modeling tools that work for any user, whether they have a GEE account or not. For this reason, numpy is the only requirement for *geeet*.
*geeet* is a Python package providing a common set of building blocks for estimating evapotranspiration (ET) from remote sensing observations. It also features complete ET models such as [PT-JPL](https://doi.org/10.1016/j.rse.2007.06.025) and [TSEB](https://doi.org/10.1016/0168-1923(95)02265-Y). All modules in *geeet* are designed to work with the input data provided in two formats: (1) as [numpy ndarrays](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html) and (2) as [Google Earth Engine](https://earthengine.google.com/) (GEE) [images](https://developers.google.com/earth-engine/apidocs/ee-image). GEE is a cloud-based platform dedicated to Earth observation research that offers a [multi-petabyte catalogue](https://developers.google.com/earth-engine/datasets/) of geospatial data. Importantly, GEE offers cloud computing capabilities, which means that a user can interact with this geospatial data directly without having to download or process any data on premises. Access to these cloud-based services requires [signing up for a GEE account](https://earthengine.google.com/signup/). The *geeet* Python package was created to offer ET modeling tools that work for any user, whether they have a GEE account or not. For this reason, numpy is the only requirement for *geeet*.

> Integration of geeet with xarray and especially lazy evaluation using dask is currently under development, with the goal of estimating ET using cloud-based assets (e.g., Cloud Optimized Geotiffs through a Spatio Temporal Asset Catalog (STAC)).

## Installation

*geeet* is available on the [Python Package Index (pip)](https://pypi.org/project/geeet/). To install *geeet* using pip, run this command:

```
```bash
pip install geeet
```

If you want to install the latest development version hosted on github, run this command:

```
```bash
pip install git+https://github.com/kaust-halo/geeet
```

*geeet* is alsao available on [conda-forge](https://anaconda.org/conda-forge/geeet). To install *geeet* using conda, run this command:

```
```bash
conda install -c conda-forge geeet
```

Expand Down
10 changes: 5 additions & 5 deletions geeet/MOST.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ def PsiM_unstable(z_g):
y = -z_g
y = np.minimum(y, b**-3) # max y is ~14.56 (i.e. z lowest value is ~-14.56 --> PsiM max is ~1.8)
x = (y/a)**(1/3)
psim = np.log(a+y)\
- 3*b*(y**(1/3))\
+ (b/2)*(a**(1/3))*np.log((1+x)**2 / (1-x+x**2))\
+ (3**(1/2))*b*(a**(1/3))*np.arctan((2*x-1)/(3**(1/2)))\
+ Psi_0
psim = (np.log(a+y)
- 3*b*(y**(1/3))
+ (b/2)*(a**(1/3))*np.log((1+x)**2 / (1-x+x**2))
+ (3**(1/2))*b*(a**(1/3))*np.arctan((2*x-1)/(3**(1/2)))
+ Psi_0)
return psim


Expand Down
12 changes: 4 additions & 8 deletions geeet/ptjpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
geeet.ptjpl.cite_all() - all references used for this module
"""

import sys
import numpy as np
from geeet.common import is_img
from geeet.meteo import compute_met_params, relative_humidity
from geeet.vegetation import compute_ftheta
try:
import ee
except Exception:
Expand Down Expand Up @@ -117,11 +113,11 @@ def ptjpl_arid(img=None, # ee.Image with inputs as bands (takes precedence over
- Rn: the net radiation.
'''
import numpy as np
from geeet.vegetation import compute_Rns, compute_lai, compute_fwet, \
compute_fg, compute_ft_arid, compute_fapar, compute_fm, \
compute_fsm
from geeet.vegetation import (compute_Rns, compute_lai, compute_fwet,
compute_fg, compute_ft_arid, compute_fapar, compute_fm,
compute_fsm, compute_ftheta)
from geeet.solar import compute_g, compute_Rn
from geeet.meteo import relative_humidity
from geeet.meteo import relative_humidity, compute_met_params

if is_img(img):
band_names = img.bandNames()
Expand Down
29 changes: 15 additions & 14 deletions geeet/tseb.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ def tseb_series(img=None, # ee.Image with inputs as bands (takes precedence o
H = Hc.add(Hs)

# Prepare an initial image containing all the variables that need to be updated iteratively:
initialImg = Tc.addBands(Ts).addBands(Tac).addBands(Hc).addBands(Hs).addBands(LEc).addBands(LEs)\
.addBands(ra).addBands(rs).addBands(rx).addBands(ustar).addBands(Image(AlphaPT)).addBands(Image(0))
initialImg = initialImg.rename('Tc','Ts','Tac','Hc','Hs','LEc','LEs','Ra','Rs','Rx',\
'Ustar','alphaPT','iteration')
initialImg = (ee.Image([Tc, Ts, Tac, Hc, Hs, LEc, LEs,
ra, rs, rx, ustar, Image(AlphaPT), Image(0)])
.rename(['Tc','Ts','Tac','Hc','Hs','LEc','LEs',
'Ra','Rs','Rx', 'Ustar', 'alphaPT', 'iteration']))
iterStart = ee.List([initialImg]) # Initial list only contains the initialImg

# Prepare a dummy image collection for the iterative procedure:
Expand Down Expand Up @@ -442,13 +442,11 @@ def tseb_series_iteration(img, list):
# containing all the updated values. However, note that we will
# not necessarilly use the updated values everywhere -
# only where LEs<0 in the previous iteration.
updatedImg = Tcu.addBands(Tsu).addBands(Tacu)\
.addBands(Hcu).addBands(Hsu).addBands(LEcu).addBands(LEsu)\
.addBands(rau).addBands(rsu).addBands(rxu)\
.addBands(ustaru).addBands(AlphaPTu).addBands(iterationu)
updatedImg = updatedImg.rename('Tc','Ts','Tac','Hc','Hs',\
'LEc','LEs','Ra','Rs','Rx','Ustar','alphaPT','iteration')

updatedImg = (ee.Image([Tcu, Tsu, Tacu, Hcu, Hsu, LEcu, LEsu,
rau, rsu, rxu, ustaru, AlphaPTu, iterationu])
.rename(['Tc','Ts','Tac','Hc','Hs','LEc','LEs',
'Ra','Rs','Rx', 'Ustar', 'alphaPT', 'iteration']))

# Finally, we select the values we will keep
# (we only update pixels where LEs was previously negative)
# These values will be the "old" Img in the next iteration
Expand All @@ -470,9 +468,12 @@ def tseb_series_iteration(img, list):
resultImage = resultImage.addBands(LE).addBands(H)

# Also return other fluxes:
resultImage = resultImage.addBands(G.rename('G')).addBands(Rn.rename('Rn'))\
.addBands(Rns.rename('Rns')).addBands(Rnc.rename('Rnc'))

resultImage = resultImage.addBands(ee.Image([
G.rename('G'),
Rn.rename('Rn'),
Rns.rename('Rns'),
Rnc.rename('Rnc')
]))
return img.addBands(resultImage)
else:
# Retrieve parameters from hybrid functions:
Expand Down