Weather Management¶
The greenflux.weather package normalizes external weather files into a
small greenhouse-facing data model.
Supported Sources¶
- EPW through
pvlib.iotools.read_epw - TMY3 through
pvlib.iotools.read_tmy3 - downloaded GreenLight raw weather through
forcing_source="greenlight:HPS"or"greenlight:LED" - downloaded Autonomous Greenhouse Challenge weather through
forcing_source="agc_2019:Reference"or another team name
pvlib is optional and installed through the solar extra:
or:
API¶
from greenflux.weather import load_epw, load_tmy3
epw = load_epw("weather/site.epw", coerce_year=2020)
tmy = load_tmy3("weather/site_tmy3.csv", coerce_year=2020)
record = epw.records[0]
inputs = record.to_greenhouse_unit_inputs(
roof_opening=0.1,
screen_closure=0.0,
)
The normalized model is:
WeatherSiteMetadataWeatherRecordWeatherDataset
WeatherRecord.to_greenhouse_unit_inputs() converts outdoor temperature,
relative humidity, wind speed and global horizontal irradiance into
GreenhouseUnitInputs.
Project Integration¶
Projects can now reference a weather file at the site level:
from greenflux.projects.schema import SiteDefinition, WeatherFileDefinition
site = SiteDefinition(
name="WUR Bleiswijk",
latitude_deg=52.03,
longitude_deg=4.53,
timezone="Europe/Amsterdam",
weather_file=WeatherFileDefinition(
path="weather/bleiswijk.epw",
file_type="epw",
coerce_year=2020,
),
)
Project cases can also resolve measured datasets through forcing_source.
The project runner uses real weather records with hold-previous sampling:
from greenflux.projects.builder import resolve_project_weather, simulate_project_greenhouse_unit
weather = resolve_project_weather(project, case_name="winter_day")
result = simulate_project_greenhouse_unit(
project,
case_name="winter_day",
weather=weather,
)
Supported measured forcing sources:
greenlight:HPSgreenlight:LEDagc_2019:Referenceagc_2019:AICUagc_2019:Automatoesagc_2019:Digilogagc_2019:IUACAASagc_2019:TheAutomators
For measured CSV datasets, records without required outdoor temperature or
relative humidity are skipped. Radiation and wind are allowed to be missing and
fall back to zero in WeatherRecord.to_greenhouse_unit_inputs().
Notes¶
The pvlib documentation says read_epw returns a pandas dataframe and metadata
dictionary, and supports optional coerce_year. EPW files are local-standard
time weather files used widely by building simulation tools. The loader maps
pvlib EPW columns such as temp_air, relative_humidity,
atmospheric_pressure, ghi, dni, dhi, wind_speed and wind_direction.
TMY3 files are mapped using both pvlib-normalized names and original-style
aliases such as DryBulb, RHum, Pressure, GHI, DNI, DHI, Wspd and
Wdir.