Weather Data Classes
frads.WeaMetaData
Bases: NamedTuple
Weather related meta data object.
Attributes:
Name | Type | Description |
---|---|---|
city |
str
|
City. |
country |
str
|
Country. |
latitude |
float
|
Latitude. |
longitude |
float
|
Longitude. |
timezone |
int
|
Timezone as standard meridian. |
elevation |
float
|
Site elevation (m). |
frads.WeaData
Bases: NamedTuple
Weather related data object.
Attributes:
Name | Type | Description |
---|---|---|
month |
Month. |
|
day |
Day. |
|
hour |
Hour. |
|
minute |
Minutes. |
|
second |
Seconds. |
|
hours |
Times with minutes as fraction. |
|
dni |
float
|
Direct normal irradiance (W/m2) or illuminance (lux). |
dhi |
float
|
Diffuse horizontal irradiance (W/m2) or illuminance (lux). |
aod |
float
|
Aeroal Optical Depth (default = 0). |
cc |
float
|
Cloud cover (default = 0). |
year |
float
|
default = 2000. |
Weather File Parsing
frads.parse_epw
Parse epw file and return wea header and data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
epw_str
|
str
|
String containing epw file. |
required |
Returns:
Type | Description |
---|---|
tuple
|
Tuple of meta data and wea data. |
frads.parse_wea
Parse a WEA weather file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wea_str
|
str
|
String containing the complete WEA file content. |
required |
Returns:
Type | Description |
---|---|
tuple[WeaMetaData, list[WeaData]]
|
A tuple containing: - WeaMetaData: Location and site information - list[WeaData]: List of weather data entries for each time step |
Examples:
Sky Generation
frads.gen_perez_sky
gen_perez_sky(dt, latitude, longitude, timezone, year=None, dirnorm=None, diffhor=None, dirhor=None, dirnorm_illum=None, diffhor_illum=None, solar=False, grefl=None, rotate=None)
Generate a Perez sky model using the gendaylit Radiance command.
Creates a realistic sky luminance distribution based on the Perez all-weather sky model, which accounts for varying sky conditions from clear to overcast.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dt
|
datetime
|
Date and time for the sky calculation. |
required |
latitude
|
float
|
Site latitude in degrees (positive North, negative South). |
required |
longitude
|
float
|
Site longitude in degrees (positive East, negative West). |
required |
timezone
|
int
|
Standard meridian for timezone in degrees. |
required |
year
|
None | int
|
Year for the calculation (optional, uses dt.year if None). |
None
|
dirnorm
|
None | float
|
Direct normal irradiance in W/m² (optional). |
None
|
diffhor
|
None | float
|
Diffuse horizontal irradiance in W/m² (optional). |
None
|
dirhor
|
None | float
|
Direct horizontal irradiance in W/m² (optional). |
None
|
dirnorm_illum
|
None | float
|
Direct normal illuminance in lux (optional). |
None
|
diffhor_illum
|
None | float
|
Diffuse horizontal illuminance in lux (optional). |
None
|
solar
|
bool
|
If True, include solar disk in the sky model. |
False
|
grefl
|
None | float
|
Ground reflectance (0.0-1.0, default varies by season). |
None
|
rotate
|
None | float
|
Sky rotation angle in degrees (optional). |
None
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
the sky primitive. |
frads.genskymtx
genskymtx(data=None, meta=None, wpath=None, onesun=False, header=True, average=False, sun_only=False, sky_only=False, sun_file=None, sun_mods=None, daylight_hours_only=False, sky_color=None, ground_color=None, rotate=None, outform=None, solar_radiance=False, mfactor=1)
Call gendaymtx to generate a sky/sun matrix Write results to out. It takes either a .wea file path or wea data and metadata (defined in frads.types). If both are provided, .wea file path will be used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
None | Sequence[WeaData]
|
A list of WeaData objects. |
None
|
meta
|
None | WeaMetaData
|
A WeaMetaData object. |
None
|
wpath
|
None | str | Path
|
A .wea file path. |
None
|
onesun
|
bool
|
If True, only one sun will be generated. |
False
|
header
|
bool
|
If True, a header will be included in the output. |
True
|
average
|
bool
|
If True, the output will be averaged. |
False
|
sun_only
|
bool
|
If True, only sun will be generated. |
False
|
sky_only
|
bool
|
If True, only sky will be generated. |
False
|
sun_file
|
None | str
|
A sun file path. |
None
|
sun_mods
|
None | str
|
A sun modifier. |
None
|
daylight_hours_only
|
bool
|
If True, only daylight hours will be generated. |
False
|
sky_color
|
None | list[float]
|
A list of sky color values. |
None
|
ground_color
|
None | list[float]
|
A list of ground color values. |
None
|
rotate
|
None | float
|
A rotation value. |
None
|
outform
|
None | str
|
An output format. |
None
|
solar_radiance
|
bool
|
If True, solar radiance will be generated. |
False
|
mfactor
|
int
|
An mfactor value. |
1
|
Returns:
Type | Description |
---|---|
bytes
|
A bytes object containing the output. |
Raises:
Type | Description |
---|---|
ValueError
|
An error occurs if neither a .wea path nor wea data is provided. |