Skip to content

calculate_daylight#11

Merged
gregory-halverson-jpl merged 4 commits intoJPL-Evapotranspiration-Algorithms:mainfrom
gregory-halverson-jpl:main
Jul 31, 2025
Merged

calculate_daylight#11
gregory-halverson-jpl merged 4 commits intoJPL-Evapotranspiration-Algorithms:mainfrom
gregory-halverson-jpl:main

Conversation

@gregory-halverson-jpl
Copy link
Member

Calculate the number of daylight hours for a given day and location.

This function is flexible in its inputs:
- If SHA_deg (sunrise hour angle in degrees) is provided, it is used directly.
- Otherwise, SHA_deg is computed from the day of year (DOY) and latitude (lat).
- If lat is not provided but a geometry object is, latitude is extracted from geometry.
- If DOY is not provided but a datetime_UTC is, DOY is computed from the datetime.

Parameters
----------
DOY : Union[Raster, np.ndarray, int], optional
    Day of year (1-366). Can be a Raster, numpy array, or integer.
lat : Union[Raster, np.ndarray, float], optional
    Latitude in degrees. Can be a Raster, numpy array, or float.
SHA_deg : Union[Raster, np.ndarray, float], optional
    Sunrise hour angle in degrees. If not provided, it will be calculated.
datetime_UTC : datetime, optional
    Datetime in UTC. Used to determine DOY if DOY is not provided.
geometry : SpatialGeometry, optional
    Geometry object containing latitude information.

Returns
-------
Union[Raster, np.ndarray]
    Daylight hours for the given inputs.

@gregory-halverson-jpl gregory-halverson-jpl merged commit b9787e1 into JPL-Evapotranspiration-Algorithms:main Jul 31, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant