|
Weather Generator 1.1.0
Daily weather for any place and date from climate normals for C++23
|
One day's weather at one place. More...
#include <weathergen.hpp>
Public Member Functions | |
| std::uint64_t | seed () const |
| Retrieve the random seed used to generate this weather. | |
| const core::seed_signature & | signature () const |
| The seed and the data this weather was generated from. | |
| std::string | date_string () const |
| ISO 8601 date string (YYYY-MM-DD). | |
| std::string | to_string () const |
| Human-readable summary string. | |
| void | to_json (core::json_writer &w) const |
| Write this weather as a JSON object. | |
| std::string | to_json () const |
| This weather as a JSON document. | |
| operator std::string () const | |
| Implicit conversion to std::string. | |
Static Public Member Functions | |
| static std::string | time_string (std::chrono::sys_time< std::chrono::minutes > t) |
An instant as ISO 8601 UTC to the minute (2024-01-15T07:42Z). | |
Public Attributes | |
| std::chrono::year_month_day | date {} |
| The day. | |
| std::string | cell |
| Key of the climate cell drawn from. | |
| double | latitude {} |
| Degrees north: the requested point, or the drawn cell's. | |
| double | longitude {} |
| Degrees east: the requested point, or the drawn cell's. | |
| double | elevation {} |
| Metres: the requested elevation, or the cell's. | |
| double | distance_km {} |
| Distance from the point to land, km (0 on land; at most 100). | |
| double | tmin {} |
| Lowest temperature, °C (°F). | |
| double | tmean {} |
| Mean temperature, °C (°F): halfway between tmin and tmax. | |
| double | tmax {} |
| Highest temperature, °C (°F). | |
| bool | frost {} |
| tmin below 0 °C (32 °F). | |
| double | precipitation {} |
| Precipitation, mm (in) of water (0 on a dry day). | |
| double | snowfall {} |
| Fresh snow, cm (in): 10 cm per 10 mm of water. | |
| precipitation_type | type {precipitation_type::none} |
| The form it falls in. | |
| bool | thunder {} |
| Thunder heard (on rain or sleet days only). | |
| double | cloud_cover {} |
| Mean cloud cover, 0 to 1. | |
| double | humidity {} |
| Mean relative humidity, %. | |
| double | wind {} |
| Mean wind speed at 10 m, m/s (mph). | |
| double | daylight_hours {} |
| Time from sunrise to sunset, hours (0 in polar night, 24 in polar day). | |
| double | sunshine_hours {} |
| std::optional< std::chrono::sys_time< std::chrono::minutes > > | sunrise {} |
| Sunrise, UTC (unset in polar day and polar night). It can fall on the date before in UTC, far east of Greenwich. | |
| std::optional< std::chrono::sys_time< std::chrono::minutes > > | sunset {} |
| Sunset, UTC (unset in polar day and polar night). | |
| weather_condition | condition {weather_condition::clear} |
| The day in a word. | |
| unit_system | units {unit_system::metric} |
| std::vector< weather_hour > | hours |
The day's 24 hours, when the request set hourly (empty otherwise). | |
Friends | |
| class | wtg |
| std::ostream & | operator<< (std::ostream &os, const weather &v) |
| Stream the summary to an output stream. | |
One day's weather at one place.
Values are rounded for output: temperatures, precipitation, snowfall and wind to 0.1 (inches of precipitation to 0.01), cloud cover to 0.01, humidity to whole percent. The units are metric unless the request asked for imperial ones. Supports implicit conversion to std::string (a one-line summary), streaming via operator<< and JSON output via to_json().
Definition at line 323 of file weathergen.hpp.
|
inline |
|
inline |
Implicit conversion to std::string.
Definition at line 461 of file weathergen.hpp.
|
inline |
Retrieve the random seed used to generate this weather.
Definition at line 359 of file weathergen.hpp.
|
inline |
The seed and the data this weather was generated from.
data is wtg::data_hash() at the time of generation. Definition at line 364 of file weathergen.hpp.
|
inlinestatic |
An instant as ISO 8601 UTC to the minute (2024-01-15T07:42Z).
| t | The instant. |
Definition at line 377 of file weathergen.hpp.
|
inline |
This weather as a JSON document.
{"date":"2023-07-01","place":{...}, "condition":"light_rain","tmin":14.2,...,"signature":{...}}. Definition at line 452 of file weathergen.hpp.
|
inline |
Write this weather as a JSON object.
| w | Writer positioned where a value is allowed. |
Definition at line 403 of file weathergen.hpp.
|
inline |
Human-readable summary string.
2023-07-01: light rain, 14.2 to 21.9 °C, 1.3 mm (57.6 to 71.4 °F, 0.05 in in imperial units). Definition at line 385 of file weathergen.hpp.
|
friend |
Stream the summary to an output stream.
| os | Output stream. |
| v | The weather to stream. |
Definition at line 470 of file weathergen.hpp.
|
friend |
Definition at line 478 of file weathergen.hpp.
| std::string dasmig::weather::cell |
Key of the climate cell drawn from.
Definition at line 327 of file weathergen.hpp.
| double dasmig::weather::cloud_cover {} |
Mean cloud cover, 0 to 1.
Definition at line 340 of file weathergen.hpp.
| weather_condition dasmig::weather::condition {weather_condition::clear} |
The day in a word.
Definition at line 350 of file weathergen.hpp.
| std::chrono::year_month_day dasmig::weather::date {} |
The day.
Definition at line 326 of file weathergen.hpp.
| double dasmig::weather::daylight_hours {} |
Time from sunrise to sunset, hours (0 in polar night, 24 in polar day).
Definition at line 343 of file weathergen.hpp.
| double dasmig::weather::distance_km {} |
Distance from the point to land, km (0 on land; at most 100).
Definition at line 331 of file weathergen.hpp.
| double dasmig::weather::elevation {} |
Metres: the requested elevation, or the cell's.
Definition at line 330 of file weathergen.hpp.
| bool dasmig::weather::frost {} |
tmin below 0 °C (32 °F).
Definition at line 335 of file weathergen.hpp.
| std::vector<weather_hour> dasmig::weather::hours |
The day's 24 hours, when the request set hourly (empty otherwise).
Definition at line 354 of file weathergen.hpp.
| double dasmig::weather::humidity {} |
Mean relative humidity, %.
Definition at line 341 of file weathergen.hpp.
| double dasmig::weather::latitude {} |
Degrees north: the requested point, or the drawn cell's.
Definition at line 328 of file weathergen.hpp.
| double dasmig::weather::longitude {} |
Degrees east: the requested point, or the drawn cell's.
Definition at line 329 of file weathergen.hpp.
| double dasmig::weather::precipitation {} |
Precipitation, mm (in) of water (0 on a dry day).
Definition at line 336 of file weathergen.hpp.
| double dasmig::weather::snowfall {} |
Fresh snow, cm (in): 10 cm per 10 mm of water.
Definition at line 337 of file weathergen.hpp.
| std::optional<std::chrono::sys_time<std::chrono::minutes> > dasmig::weather::sunrise {} |
Sunrise, UTC (unset in polar day and polar night). It can fall on the date before in UTC, far east of Greenwich.
Definition at line 347 of file weathergen.hpp.
| std::optional<std::chrono::sys_time<std::chrono::minutes> > dasmig::weather::sunset {} |
Sunset, UTC (unset in polar day and polar night).
Definition at line 349 of file weathergen.hpp.
| double dasmig::weather::sunshine_hours {} |
Bright sunshine, hours: the daylight not covered by cloud.
Definition at line 344 of file weathergen.hpp.
| bool dasmig::weather::thunder {} |
Thunder heard (on rain or sleet days only).
Definition at line 339 of file weathergen.hpp.
| double dasmig::weather::tmax {} |
Highest temperature, °C (°F).
Definition at line 334 of file weathergen.hpp.
| double dasmig::weather::tmean {} |
Mean temperature, °C (°F): halfway between tmin and tmax.
Definition at line 333 of file weathergen.hpp.
| double dasmig::weather::tmin {} |
Lowest temperature, °C (°F).
Definition at line 332 of file weathergen.hpp.
| precipitation_type dasmig::weather::type {precipitation_type::none} |
The form it falls in.
Definition at line 338 of file weathergen.hpp.
| unit_system dasmig::weather::units {unit_system::metric} |
The units of the values above.
Definition at line 351 of file weathergen.hpp.
| double dasmig::weather::wind {} |
Mean wind speed at 10 m, m/s (mph).
Definition at line 342 of file weathergen.hpp.