Skip to content

Commit 3c4e9fe

Browse files
Merge pull request #36 from gregory-halverson/main
entry point `BESS_JPL`, fixing visible and NIR albedo, default elevation
2 parents de42ad2 + a6ad25a commit 3c4e9fe

7 files changed

+1014
-9121
lines changed

BESS_JPL/BESS.py

Lines changed: 0 additions & 468 deletions
This file was deleted.

BESS_JPL/BESS_JPL.py

Lines changed: 511 additions & 14 deletions
Large diffs are not rendered by default.

BESS_JPL/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.6.1
1+
1.7.0

Processing BESS with rasters with default parameters.ipynb

Lines changed: 334 additions & 0 deletions
Large diffs are not rendered by default.

Processing BESS with rasters.ipynb

Lines changed: 61 additions & 8635 deletions
Large diffs are not rendered by default.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# %% [markdown]
2+
# # Running BESS for an ECOSTRESS Scene
3+
#
4+
# This is an example of running the artificial neural network emulator of the Breathing Earth Systems Simulator (BESS) corresponding to an ECOsystem Spaceborne Thermal Radiometer Experiment on Space Station (ECOSTRESS) scene.
5+
6+
# %%
7+
from dateutil import parser
8+
from matplotlib.colors import LinearSegmentedColormap
9+
from solar_apparent_time import UTC_to_solar
10+
import rasters as rt
11+
from BESS_JPL import BESS_JPL
12+
import logging
13+
14+
15+
# %% [markdown]
16+
# Here's an example ECOSTRESS surface temperature scene.
17+
18+
# %%
19+
ST_filename = "ECOv002_L2T_LSTE_34366_004_11SPS_20240728T204025_0712_01_LST.tif"
20+
ST_cmap = "bwr"
21+
ST_C = rt.Raster.open(ST_filename, cmap=ST_cmap) - 273.15
22+
ST_C
23+
24+
# %% [markdown]
25+
# Let's get the acquisition time of the scene.
26+
27+
# %%
28+
time_UTC = parser.parse(ST_filename.split("_")[6])
29+
geometry = ST_C.geometry
30+
longitude = geometry.centroid_latlon.x
31+
latitude = geometry.centroid_latlon.y
32+
time_solar = UTC_to_solar(time_UTC, longitude)
33+
doy_solar = time_solar.timetuple().tm_yday
34+
hour_of_day_solar = time_solar.hour + time_solar.minute / 60 + time_solar.second / 3600
35+
print(f"{time_UTC:%Y-%m-%d %H:%M:%S} UTC")
36+
print(f"{time_solar:%Y-%m-%d %H:%M:%S} solar apparent time at longitude {longitude}")
37+
print(f"day of year {doy_solar} at longitude {longitude}")
38+
print(f"hour of day {hour_of_day_solar} at longitude {longitude}")
39+
40+
# %%
41+
albedo_filename = "ECOv002_L2T_STARS_11SPS_20240728_0712_01_albedo.tif"
42+
albedo_cmap = LinearSegmentedColormap.from_list(name="albedo", colors=["black", "white"])
43+
albedo = rt.Raster.open(albedo_filename, cmap=albedo_cmap)
44+
albedo
45+
46+
# %%
47+
NDVI_filename = "ECOv002_L2T_STARS_11SPS_20240728_0712_01_NDVI.tif"
48+
NDVI = rt. Raster.open(NDVI_filename)
49+
50+
NDVI_COLORMAP_ABSOLUTE = LinearSegmentedColormap.from_list(
51+
name="NDVI",
52+
colors=[
53+
(0, "#0000ff"),
54+
(0.4, "#000000"),
55+
(0.5, "#745d1a"),
56+
(0.6, "#e1dea2"),
57+
(0.8, "#45ff01"),
58+
(1, "#325e32")
59+
]
60+
)
61+
62+
NDVI.cmap = NDVI_COLORMAP_ABSOLUTE
63+
NDVI
64+
65+
# %%
66+
Ta_filename = "ECOv002_L3T_MET_34366_004_11SPS_20240728T204025_0712_01_Ta.tif"
67+
Ta_C = rt.Raster.open(Ta_filename)
68+
Ta_C.cmap = "bwr"
69+
Ta_C
70+
71+
# %%
72+
RH_filename = "ECOv002_L3T_MET_34366_004_11SPS_20240728T204025_0712_01_RH.tif"
73+
RH = rt.Raster.open(RH_filename)
74+
RH.cmap = "bwr_r"
75+
RH
76+
77+
# %%
78+
BESS_results = BESS_JPL(
79+
hour_of_day=hour_of_day_solar,
80+
day_of_year=doy_solar,
81+
geometry=geometry,
82+
time_UTC=time_UTC,
83+
ST_C=ST_C,
84+
NDVI=NDVI,
85+
albedo=albedo,
86+
Ta_C=Ta_C,
87+
RH=RH
88+
)
89+
90+
# %%
91+
BESS_results["GPP"]
92+
93+
# %%
94+
BESS_results["Rn"]
95+
96+
# %%
97+
BESS_results["LE"]
98+
99+
# %%
100+
101+
102+

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools>=60", "setuptools-scm>=8.0", "wheel"]
33

44
[project]
55
name = "BESS-JPL"
6-
version = "1.6.1"
6+
version = "1.7.0"
77
description = "Breathing Earth System Simulator (BESS) Gross Primary Production (GPP) and Evapotranspiration (ET) Model Python"
88
readme = "README.md"
99
authors = [
@@ -15,13 +15,15 @@ classifiers = [
1515
]
1616
dependencies = [
1717
"check-distribution",
18-
"FLiESANN>=1.4.1",
18+
"FLiESANN>=1.4.2",
1919
"gedi-canopy-height>=1.1.0",
2020
"GEOS5FP>=1.1.1",
2121
"koppengeiger>=1.0.4",
2222
"MODISCI>=1.3.0",
23+
"NASADEM",
2324
"numpy",
24-
"rasters"
25+
"rasters",
26+
"solar-apparent-time>=1.3.2"
2527
]
2628

2729
requires-python = ">=3.10"

0 commit comments

Comments
 (0)