Skip to content

Commit 6bc338f

Browse files
Merge pull request #14 from gregory-halverson-jpl/main
fixing hour of day and day of year
2 parents 123c9fd + 78bc200 commit 6bc338f

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

daylight_evapotranspiration/daylight_evapotranspiration.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import rasters as rt
1919
from rasters import Raster, SpatialGeometry, wrap_geometry
2020
from sun_angles import SHA_deg_from_DOY_lat, daylight_from_SHA, sunrise_from_SHA, calculate_daylight, calculate_sunrise
21+
from solar_apparent_time import calculate_solar_hour_of_day, calculate_solar_day_of_year
2122
from verma_net_radiation import daylight_Rn_integration_verma
2223

2324
# Latent heat of vaporization for water at 20°C in Joules per kilogram
@@ -254,7 +255,12 @@ def daylight_ET_from_instantaneous_LE(
254255
# Use geometry latitude if lat not provided
255256
if lat is None and geometry is not None:
256257
lat = geometry.lat
257-
258+
259+
if geometry is not None:
260+
lon = geometry.lon
261+
else:
262+
lon = None
263+
258264
# Calculate evaporative fraction (EF)
259265
EF = calculate_evaporative_fraction(
260266
LE=LE_instantaneous_Wm2,
@@ -280,6 +286,23 @@ def daylight_ET_from_instantaneous_LE(
280286
geometry=geometry
281287
)
282288

289+
if hour_of_day is None:
290+
hour_of_day = calculate_solar_hour_of_day(
291+
time_UTC=time_UTC,
292+
geometry=geometry,
293+
lat=lat,
294+
lon=lon
295+
)
296+
297+
if day_of_year is None:
298+
day_of_year = calculate_solar_day_of_year(
299+
time_UTC=time_UTC,
300+
geometry=geometry,
301+
lat=lat,
302+
lon=lon
303+
)
304+
305+
283306
# Integrate net radiation over daylight period
284307
Rn_daylight_Wm2 = daylight_Rn_integration_verma(
285308
Rn_Wm2=Rn_instantaneous_Wm2,

pyproject.toml

Lines changed: 1 addition & 1 deletion
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 = "daylight-evapotranspiration"
6-
version = "1.3.3"
6+
version = "1.3.4"
77
description = "Instantaneous/Daily Evapotranspiration Utilities Python Package"
88
readme = "README.md"
99
authors = [

0 commit comments

Comments
 (0)