weather
weather
#
Multi-dimensional difference between two weather forecasts.
Each sigma_<field> keyword opts one of cg.Weather's numeric fields into
the metric, and the enabled fields combine as a Euclidean norm.
NUMERIC_FIELDS = tuple(name for name, annotation in (cg.Weather.__annotations__.items()) if annotation in (float, float | None))
module-attribute
#
The cg.Weather fields a weather distance can measure.
SIGMA_PREFIX = 'sigma_'
module-attribute
#
What a weather keyword prefixes onto the cg.Weather field it scales.
weather(**sigmas)
#
Create a distance function over the enabled weather dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**sigmas
|
float
|
One |
{}
|
Returns:
| Type | Description |
|---|---|
CombinedDistance
|
A distance function |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no dimension is given, or a keyword does not name a
numeric |
Example
import capturegraph.scheduling as cgsh
# Only care about cloud cover for time-lapse (lighting changes).
dist_fn = cgsh.distance.weather(sigma_cloud_cover_ratio=0.3)
# Care about temperature and humidity for outdoor comfort.
dist_fn = cgsh.distance.weather(
sigma_temperature_celsius=5.0,
sigma_humidity_ratio=0.2,
)