Weather Generator 1.1.0
Daily weather for any place and date from climate normals for C++23
Loading...
Searching...
No Matches
weathergen.hpp File Reference

Weather Generator library — daily weather for any place and date from climate normals for C++23. More...

#include "core.hpp"
#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <format>
#include <limits>
#include <numbers>
#include <optional>
#include <ostream>
#include <span>
#include <stdexcept>
#include <string>
#include <string_view>
#include <system_error>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  dasmig::weather_request
 What a weather call asks for. More...
 
struct  dasmig::weather_hour
 One hour of a day's weather (weather::hours, when the request asks for them). More...
 
struct  dasmig::climate_normals
 The monthly climate normals of a place (climate_at()). More...
 
class  dasmig::weather
 One day's weather at one place. More...
 
class  dasmig::wtg
 Weather Generator: daily weather drawn around monthly climate normals. More...
 

Enumerations

enum class  dasmig::precipitation_type : std::uint8_t { none , rain , sleet , snow }
 The form precipitation falls in. More...
 
enum class  dasmig::weather_condition : std::uint8_t {
  clear , partly_cloudy , mostly_cloudy , overcast ,
  light_rain , rain , heavy_rain , thunderstorm ,
  sleet , light_snow , snow , heavy_snow
}
 The day's weather in one word or two. More...
 
enum class  dasmig::unit_system : std::uint8_t { metric , imperial }
 The units of a result's weather values. More...
 

Functions

constexpr std::string_view dasmig::to_string (precipitation_type t) noexcept
 The key of a precipitation type (none, rain, sleet, snow).
 
constexpr std::string_view dasmig::to_string (weather_condition c) noexcept
 The key of a condition (clear, partly_cloudy, ..., heavy_snow).
 
constexpr std::string_view dasmig::label (weather_condition c) noexcept
 The English label of a condition (clear, partly cloudy, ...).
 
constexpr std::string_view dasmig::to_string (unit_system u) noexcept
 The key of a unit system (metric, imperial).
 

Detailed Description

Weather Generator library — daily weather for any place and date from climate normals for C++23.

Author
Diego Dasso Migotto (diegomigotto at hotmail dot com)
See also
See doc/usage.md for the narrative tutorial and doc/data.md for the data and the model.

Definition in file weathergen.hpp.

Enumeration Type Documentation

◆ precipitation_type

enum class dasmig::precipitation_type : std::uint8_t
strong

The form precipitation falls in.

Enumerator
none 

A dry day.

rain 

Rain.

sleet 

Rain and snow mixed.

snow 

Snow.

Definition at line 45 of file weathergen.hpp.

◆ unit_system

enum class dasmig::unit_system : std::uint8_t
strong

The units of a result's weather values.

Enumerator
metric 

°C, mm of precipitation, cm of snow, m/s.

imperial 

°F, inches of precipitation and of snow, mph.

Definition at line 133 of file weathergen.hpp.

◆ weather_condition

enum class dasmig::weather_condition : std::uint8_t
strong

The day's weather in one word or two.

Enumerator
clear 

Dry, cloud cover below 20%.

partly_cloudy 

Dry, cloud cover 20% to 50%.

mostly_cloudy 

Dry, cloud cover 50% to 85%.

overcast 

Dry, cloud cover 85% or more.

light_rain 

Rain below 2.5 mm.

rain 

Rain from 2.5 mm to 10 mm.

heavy_rain 

Rain of 10 mm or more (a heavy precipitation day).

thunderstorm 

Rain or sleet with thunder.

sleet 

Rain and snow mixed.

light_snow 

Snow below 1 mm of water (about 1 cm).

snow 

Snow from 1 mm to 10 mm of water.

heavy_snow 

Snow of 10 mm of water (about 10 cm) or more.

Definition at line 54 of file weathergen.hpp.

Function Documentation

◆ label()

constexpr std::string_view dasmig::label ( weather_condition  c)
constexprnoexcept

The English label of a condition (clear, partly cloudy, ...).

Parameters
cThe condition.
Returns
The label.

Definition at line 112 of file weathergen.hpp.

◆ to_string() [1/3]

constexpr std::string_view dasmig::to_string ( precipitation_type  t)
constexprnoexcept

The key of a precipitation type (none, rain, sleet, snow).

Parameters
tThe type.
Returns
The key.

Definition at line 73 of file weathergen.hpp.

◆ to_string() [2/3]

constexpr std::string_view dasmig::to_string ( unit_system  u)
constexprnoexcept

The key of a unit system (metric, imperial).

Parameters
uThe unit system.
Returns
The key.

Definition at line 142 of file weathergen.hpp.

◆ to_string() [3/3]

constexpr std::string_view dasmig::to_string ( weather_condition  c)
constexprnoexcept

The key of a condition (clear, partly_cloudy, ..., heavy_snow).

Parameters
cThe condition.
Returns
The key.

Definition at line 89 of file weathergen.hpp.