module models

The database models involved

class app.models.ATM41DataRaw(**kwargs)[source]
air_temperature: Mapped[Decimal]

air temperature in °C

atmospheric_pressure: Mapped[Decimal]

atmospheric pressure in kPa

battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

lightning_average_distance: Mapped[Decimal]

distance of lightning strikes in km

lightning_strike_count: Mapped[Decimal]

number of lightning strikes

maximum_wind_speed: Mapped[Decimal]

maximum wind speed in m/s (gusts)

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

precipitation_sum: Mapped[Decimal]

precipitation sum in mm

protocol_version: Mapped[int]

The protocol version the data was sent with

relative_humidity: Mapped[Decimal]

relative humidity in %

sensor: Mapped[Sensor]

The sensor the data was measured with

sensor_id: Mapped[str]

id of the sensor e.g. DEC1234

sensor_temperature_internal: Mapped[Decimal]

internal temperature of the sensor in °C

solar_radiation: Mapped[Decimal]

solar radiation in W/m2

u_wind: Mapped[Decimal]

u wind component in m/s

v_wind: Mapped[Decimal]

v wind component in m/s

vapor_pressure: Mapped[Decimal]

vapor pressure in kPa

wind_direction: Mapped[Decimal]

wind direction in °

wind_speed: Mapped[Decimal]

wind speed in m/s

x_orientation_angle: Mapped[Decimal]

x-tilt angle of the sensor in °

y_orientation_angle: Mapped[Decimal]

y-tilt angle of the sensor in °

class app.models.BLGDataRaw(**kwargs)[source]
battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

black_globe_temperature: Mapped[Decimal]

black globe temperature in °C

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

protocol_version: Mapped[int]

The protocol version the data was sent with

sensor: Mapped[Sensor]

The sensor the data was measured with

sensor_id: Mapped[str]

id of the sensor e.g. DEC1234

thermistor_resistance: Mapped[Decimal]

thermistor resistance in Ohms

voltage_ratio: Mapped[Decimal]

voltage ratio of the sensor

class app.models.BiometData(**kwargs)[source]
absolute_humidity: Mapped[Decimal]

absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

air_temperature: Mapped[Decimal]

air temperature in °C

air_temperature_qc_persistence_check: Mapped[bool]

persistence check QC flag for air temperature. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function.Configuration is stored in app.qc.COLUMNS.

air_temperature_qc_range_check: Mapped[bool]

range check QC flag for air temperature. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

air_temperature_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for air temperature. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function.Configuration is stored in app.qc.COLUMNS.

atmospheric_pressure: Mapped[Decimal]

atmospheric pressure in kPa

atmospheric_pressure_qc_persistence_check: Mapped[bool]

persistence check QC flag for atmospheric pressure. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

atmospheric_pressure_qc_range_check: Mapped[bool]

range check QC flag for atmospheric pressure. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

atmospheric_pressure_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for atmospheric pressure. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

atmospheric_pressure_reduced: Mapped[Decimal]

atmospheric pressure reduced to sea level in hPa calculated using app.tasks.reduce_pressure()

battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

black_globe_temperature: Mapped[Decimal]

black globe temperature in °C

black_globe_temperature_qc_persistence_check: Mapped[bool]

persistence check QC flag for black globe temperature. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

black_globe_temperature_qc_range_check: Mapped[bool]

range check QC flag for black globe temperature. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

black_globe_temperature_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for black globe temperature. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

blg_battery_voltage: Mapped[Decimal]

battery voltage of the black globe sensor in Volts

blg_sensor: Mapped[Sensor | None]

The black globe sensor the data was measured with

blg_sensor_id: Mapped[str | None]

id of the BLG sensor these measurements were taken with

blg_time_offset: Mapped[Decimal]

time offset of the Blackglobe sensor to the corresponding ATM41 sensor in seconds

deployments: Mapped[list[SensorDeployment]]

list of deployments that were involved in the measurement of this data

dew_point: Mapped[Decimal]

dew point temperature in °C calculated using thermal_comfort.dew_point()

heat_index: Mapped[Decimal]

heat index in °C calculated using thermal_comfort.heat_index_extended()

lightning_average_distance: Mapped[Decimal]

distance of lightning strikes in km

lightning_average_distance_qc_persistence_check: Mapped[bool]

persistence check QC flag for lightning average distance. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

lightning_average_distance_qc_range_check: Mapped[bool]

range check QC flag for lightning average distance. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

lightning_strike_count: Mapped[Decimal]

number of lightning strikes

lightning_strike_count_qc_persistence_check: Mapped[bool]

persistence check QC flag for lightning strike count. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

lightning_strike_count_qc_range_check: Mapped[bool]

range check QC flag for lightning strike count. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

maximum_wind_speed: Mapped[Decimal]

maximum wind speed in m/s (gusts)

maximum_wind_speed_qc_persistence_check: Mapped[bool]

persistence check QC flag for maximum wind speed. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

maximum_wind_speed_qc_range_check: Mapped[bool]

range check QC flag for maximum wind speed. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

mrt: Mapped[Decimal]

mean radiant temperature in °C calculated using thermal_comfort.mean_radiant_temp()

pet: Mapped[Decimal]

physiological equivalent temperature in °C calculated using thermal_comfort.pet_static()

pet_category: Mapped[HeatStressCategories]

physiological equivalent temperature category derived from PET_STRESS_CATEGORIES and applied using app.tasks.category_mapping()

precipitation_sum: Mapped[Decimal]

precipitation sum in mm

precipitation_sum_qc_persistence_check: Mapped[bool]

persistence check QC flag for precipitation sum. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

precipitation_sum_qc_range_check: Mapped[bool]

range check QC flag for precipitation sum. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

precipitation_sum_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for precipitation sum. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

protocol_version: Mapped[int]

The protocol version the data was sent with

qc_flagged: Mapped[bool]

If True, at least one QC check has flagged the data as bad or is missing

relative_humidity: Mapped[Decimal]

relative humidity in %

relative_humidity_qc_persistence_check: Mapped[bool]

persistence check QC flag for relative humidity. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function.Configuration is stored in app.qc.COLUMNS.

relative_humidity_qc_range_check: Mapped[bool]

range check QC flag for relative humidity. If True, the data is flagged as bad. Uses the app.qc.range_check() function.Configuration is stored in app.qc.COLUMNS.

relative_humidity_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for relative humidity. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function.Configuration is stored in app.qc.COLUMNS.

sensor: Mapped[Sensor]

The sensor the data was measured with

sensor_id: Mapped[str]

id of the ATM41 sensor these measurements were taken with

sensor_temperature_internal: Mapped[Decimal]

internal temperature of the sensor in °C

solar_radiation: Mapped[Decimal]

solar radiation in W/m2

solar_radiation_qc_persistence_check: Mapped[bool]

persistence check QC flag for solar radiation. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

solar_radiation_qc_range_check: Mapped[bool]

range check QC flag for solar radiation. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

solar_radiation_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for solar radiation. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

specific_humidity: Mapped[Decimal]

specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

station: Mapped[Station]

The station the data was measured at

station_id: Mapped[str]

id of the station these measurements were taken at

thermistor_resistance: Mapped[Decimal]

thermistor resistance in Ohms

u_wind: Mapped[Decimal]

u wind component in m/s

u_wind_qc_persistence_check: Mapped[bool]

persistence check QC flag for u wind component. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

u_wind_qc_range_check: Mapped[bool]

range check QC flag for u wind component. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

u_wind_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for u wind component. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

utci: Mapped[Decimal]

universal thermal climate index in °C calculated using thermal_comfort.utci_approx()

utci_category: Mapped[HeatStressCategories]

universal thermal climate index category derived from UTCI_STRESS_CATEGORIES and applied using app.tasks.category_mapping()

v_wind: Mapped[Decimal]

v wind component in m/s

v_wind_qc_persistence_check: Mapped[bool]

persistence check QC flag for v wind component. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

v_wind_qc_range_check: Mapped[bool]

range check QC flag for v wind component. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

v_wind_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for v wind component. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

vapor_pressure: Mapped[Decimal]

vapor pressure in kPa

voltage_ratio: Mapped[Decimal]

voltage ratio of the sensor

wet_bulb_temperature: Mapped[Decimal]

wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wind_direction: Mapped[Decimal]

wind direction in °

wind_direction_qc_persistence_check: Mapped[bool]

persistence check QC flag for wind direction. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

wind_direction_qc_range_check: Mapped[bool]

range check QC flag for wind direction. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

wind_speed: Mapped[Decimal]

wind speed in m/s

wind_speed_qc_persistence_check: Mapped[bool]

persistence check QC flag for wind speed. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

wind_speed_qc_range_check: Mapped[bool]

range check QC flag for wind speed. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

wind_speed_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for wind speed. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

x_orientation_angle: Mapped[Decimal]

x-tilt angle of the sensor in °

x_orientation_angle_qc_range_check: Mapped[bool]

range check QC flag for x orientation angle. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

x_orientation_angle_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for x orientation angle. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

y_orientation_angle: Mapped[Decimal]

y-tilt angle of the sensor in °

y_orientation_angle_qc_range_check: Mapped[bool]

range check QC flag for y orientation angle. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

y_orientation_angle_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for y orientation angle. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

class app.models.BiometDataDaily(**kwargs)[source]

This is not an actual table, but a materialized view. We simply trick sqlalchemy into thinking this was a table. Querying a materialized view does not differ from querying a proper table.

absolute_humidity: Mapped[Decimal]

absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

absolute_humidity_max: Mapped[Decimal]

maximum of absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

absolute_humidity_min: Mapped[Decimal]

minimum of absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

air_temperature: Mapped[Decimal]

air temperature in °C

air_temperature_max: Mapped[Decimal]

maximum of air temperature in °C

air_temperature_min: Mapped[Decimal]

minimum of air temperature in °C

atmospheric_pressure: Mapped[Decimal]

atmospheric pressure in kPa

atmospheric_pressure_max: Mapped[Decimal]

maximum of atmospheric pressure in kPa

atmospheric_pressure_min: Mapped[Decimal]

minimum of atmospheric pressure in kPa

atmospheric_pressure_reduced: Mapped[Decimal]

atmospheric pressure reduced to sea level in hPa calculated using app.tasks.reduce_pressure()

atmospheric_pressure_reduced_max: Mapped[Decimal]

maximum of atmospheric pressure reduced to sea level in hPa calculated using app.tasks.reduce_pressure()

atmospheric_pressure_reduced_min: Mapped[Decimal]

minimum of atmospheric pressure reduced to sea level in hPa calculated using app.tasks.reduce_pressure()

battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

battery_voltage_max: Mapped[Decimal]

maximum of The battery voltage of the sensor in Volts

battery_voltage_min: Mapped[Decimal]

minimum of The battery voltage of the sensor in Volts

black_globe_temperature: Mapped[Decimal]

black globe temperature in °C

black_globe_temperature_max: Mapped[Decimal]

maximum of black globe temperature in °C

black_globe_temperature_min: Mapped[Decimal]

minimum of black globe temperature in °C

blg_battery_voltage: Mapped[Decimal]

battery voltage of the black globe sensor in Volts

blg_battery_voltage_max: Mapped[Decimal]

maximum of battery voltage of the black globe sensor in Volts

blg_battery_voltage_min: Mapped[Decimal]

minimum of battery voltage of the black globe sensor in Volts

blg_time_offset: Mapped[Decimal]

time offset of the Blackglobe sensor to the corresponding ATM41 sensor in seconds

blg_time_offset_max: Mapped[Decimal]

maximum of time offset of the Blackglobe sensor to the corresponding ATM41 sensor in seconds

blg_time_offset_min: Mapped[Decimal]

minimum of time offset of the Blackglobe sensor to the corresponding ATM41 sensor in seconds

dew_point: Mapped[Decimal]

dew point temperature in °C calculated using thermal_comfort.dew_point()

dew_point_max: Mapped[Decimal]

maximum of dew point temperature in °C calculated using thermal_comfort.dew_point()

dew_point_min: Mapped[Decimal]

minimum of dew point temperature in °C calculated using thermal_comfort.dew_point()

heat_index: Mapped[Decimal]

heat index in °C calculated using thermal_comfort.heat_index_extended()

heat_index_max: Mapped[Decimal]

maximum of heat index in °C calculated using thermal_comfort.heat_index_extended()

heat_index_min: Mapped[Decimal]

minimum of heat index in °C calculated using thermal_comfort.heat_index_extended()

lightning_average_distance: Mapped[Decimal]

distance of lightning strikes in km

lightning_average_distance_max: Mapped[Decimal]

maximum of distance of lightning strikes in km

lightning_average_distance_min: Mapped[Decimal]

minimum of distance of lightning strikes in km

lightning_strike_count: Mapped[Decimal]

number of lightning strikes

maximum_wind_speed: Mapped[Decimal]

maximum wind speed in m/s (gusts)

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

mrt: Mapped[Decimal]

mean radiant temperature in °C calculated using thermal_comfort.mean_radiant_temp()

mrt_max: Mapped[Decimal]

maximum of mean radiant temperature in °C calculated using thermal_comfort.mean_radiant_temp()

mrt_min: Mapped[Decimal]

minimum of mean radiant temperature in °C calculated using thermal_comfort.mean_radiant_temp()

pet: Mapped[Decimal]

physiological equivalent temperature in °C calculated using thermal_comfort.pet_static()

pet_category: Mapped[HeatStressCategories]

physiological equivalent temperature category derived from PET_STRESS_CATEGORIES and applied using app.tasks.category_mapping()

pet_max: Mapped[Decimal]

maximum of physiological equivalent temperature in °C calculated using thermal_comfort.pet_static()

pet_min: Mapped[Decimal]

minimum of physiological equivalent temperature in °C calculated using thermal_comfort.pet_static()

precipitation_sum: Mapped[Decimal]

precipitation sum in mm

protocol_version: Mapped[int]

The protocol version the data was sent with

relative_humidity: Mapped[Decimal]

relative humidity in %

relative_humidity_max: Mapped[Decimal]

maximum of relative humidity in %

relative_humidity_min: Mapped[Decimal]

minimum of relative humidity in %

sensor_temperature_internal: Mapped[Decimal]

internal temperature of the sensor in °C

sensor_temperature_internal_max: Mapped[Decimal]

maximum of internal temperature of the sensor in °C

sensor_temperature_internal_min: Mapped[Decimal]

minimum of internal temperature of the sensor in °C

solar_radiation: Mapped[Decimal]

solar radiation in W/m2

solar_radiation_max: Mapped[Decimal]

maximum of solar radiation in W/m2

solar_radiation_min: Mapped[Decimal]

minimum of solar radiation in W/m2

specific_humidity: Mapped[Decimal]

specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

specific_humidity_max: Mapped[Decimal]

maximum of specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

specific_humidity_min: Mapped[Decimal]

minimum of specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

station: Mapped[Station]

The station the data was measured at

station_id: Mapped[str]

id of the station these measurements were taken at

thermistor_resistance: Mapped[Decimal]

thermistor resistance in Ohms

thermistor_resistance_max: Mapped[Decimal]

maximum of thermistor resistance in Ohms

thermistor_resistance_min: Mapped[Decimal]

minimum of thermistor resistance in Ohms

u_wind: Mapped[Decimal]

u wind component in m/s

u_wind_max: Mapped[Decimal]

maximum of u wind component in m/s

u_wind_min: Mapped[Decimal]

minimum of u wind component in m/s

utci: Mapped[Decimal]

universal thermal climate index in °C calculated using thermal_comfort.utci_approx()

utci_category: Mapped[HeatStressCategories]

universal thermal climate index category derived from UTCI_STRESS_CATEGORIES and applied using app.tasks.category_mapping()

utci_max: Mapped[Decimal]

maximum of universal thermal climate index in °C calculated using thermal_comfort.utci_approx()

utci_min: Mapped[Decimal]

minimum of universal thermal climate index in °C calculated using thermal_comfort.utci_approx()

v_wind: Mapped[Decimal]

v wind component in m/s

v_wind_max: Mapped[Decimal]

maximum of v wind component in m/s

v_wind_min: Mapped[Decimal]

minimum of v wind component in m/s

vapor_pressure: Mapped[Decimal]

vapor pressure in kPa

vapor_pressure_max: Mapped[Decimal]

maximum of vapor pressure in kPa

vapor_pressure_min: Mapped[Decimal]

minimum of vapor pressure in kPa

voltage_ratio: Mapped[Decimal]

voltage ratio of the sensor

voltage_ratio_max: Mapped[Decimal]

maximum of voltage ratio of the sensor

voltage_ratio_min: Mapped[Decimal]

minimum of voltage ratio of the sensor

wet_bulb_temperature: Mapped[Decimal]

wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wet_bulb_temperature_max: Mapped[Decimal]

maximum of wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wet_bulb_temperature_min: Mapped[Decimal]

minimum of wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wind_direction: Mapped[Decimal]

wind direction in °

wind_speed: Mapped[Decimal]

wind speed in m/s

wind_speed_max: Mapped[Decimal]

maximum of wind speed in m/s

wind_speed_min: Mapped[Decimal]

minimum of wind speed in m/s

x_orientation_angle: Mapped[Decimal]

x-tilt angle of the sensor in °

x_orientation_angle_max: Mapped[Decimal]

maximum of x-tilt angle of the sensor in °

x_orientation_angle_min: Mapped[Decimal]

minimum of x-tilt angle of the sensor in °

y_orientation_angle: Mapped[Decimal]

y-tilt angle of the sensor in °

y_orientation_angle_max: Mapped[Decimal]

maximum of y-tilt angle of the sensor in °

y_orientation_angle_min: Mapped[Decimal]

minimum of y-tilt angle of the sensor in °

class app.models.BiometDataHourly(**kwargs)[source]

This is not an actual table, but a materialized view. We simply trick sqlalchemy into thinking this was a table. Querying a materialized view does not differ from querying a proper table.

absolute_humidity: Mapped[Decimal]

absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

absolute_humidity_max: Mapped[Decimal]

maximum of absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

absolute_humidity_min: Mapped[Decimal]

minimum of absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

air_temperature: Mapped[Decimal]

air temperature in °C

air_temperature_max: Mapped[Decimal]

maximum of air temperature in °C

air_temperature_min: Mapped[Decimal]

minimum of air temperature in °C

atmospheric_pressure: Mapped[Decimal]

atmospheric pressure in kPa

atmospheric_pressure_max: Mapped[Decimal]

maximum of atmospheric pressure in kPa

atmospheric_pressure_min: Mapped[Decimal]

minimum of atmospheric pressure in kPa

atmospheric_pressure_reduced: Mapped[Decimal]

atmospheric pressure reduced to sea level in hPa calculated using app.tasks.reduce_pressure()

atmospheric_pressure_reduced_max: Mapped[Decimal]

maximum of atmospheric pressure reduced to sea level in hPa calculated using app.tasks.reduce_pressure()

atmospheric_pressure_reduced_min: Mapped[Decimal]

minimum of atmospheric pressure reduced to sea level in hPa calculated using app.tasks.reduce_pressure()

battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

battery_voltage_max: Mapped[Decimal]

maximum of The battery voltage of the sensor in Volts

battery_voltage_min: Mapped[Decimal]

minimum of The battery voltage of the sensor in Volts

black_globe_temperature: Mapped[Decimal]

black globe temperature in °C

black_globe_temperature_max: Mapped[Decimal]

maximum of black globe temperature in °C

black_globe_temperature_min: Mapped[Decimal]

minimum of black globe temperature in °C

blg_battery_voltage: Mapped[Decimal]

battery voltage of the black globe sensor in Volts

blg_battery_voltage_max: Mapped[Decimal]

maximum of battery voltage of the black globe sensor in Volts

blg_battery_voltage_min: Mapped[Decimal]

minimum of battery voltage of the black globe sensor in Volts

blg_time_offset: Mapped[Decimal]

time offset of the Blackglobe sensor to the corresponding ATM41 sensor in seconds

blg_time_offset_max: Mapped[Decimal]

maximum of time offset of the Blackglobe sensor to the corresponding ATM41 sensor in seconds

blg_time_offset_min: Mapped[Decimal]

minimum of time offset of the Blackglobe sensor to the corresponding ATM41 sensor in seconds

dew_point: Mapped[Decimal]

dew point temperature in °C calculated using thermal_comfort.dew_point()

dew_point_max: Mapped[Decimal]

maximum of dew point temperature in °C calculated using thermal_comfort.dew_point()

dew_point_min: Mapped[Decimal]

minimum of dew point temperature in °C calculated using thermal_comfort.dew_point()

heat_index: Mapped[Decimal]

heat index in °C calculated using thermal_comfort.heat_index_extended()

heat_index_max: Mapped[Decimal]

maximum of heat index in °C calculated using thermal_comfort.heat_index_extended()

heat_index_min: Mapped[Decimal]

minimum of heat index in °C calculated using thermal_comfort.heat_index_extended()

lightning_average_distance: Mapped[Decimal]

distance of lightning strikes in km

lightning_average_distance_max: Mapped[Decimal]

maximum of distance of lightning strikes in km

lightning_average_distance_min: Mapped[Decimal]

minimum of distance of lightning strikes in km

lightning_strike_count: Mapped[Decimal]

number of lightning strikes

maximum_wind_speed: Mapped[Decimal]

maximum wind speed in m/s (gusts)

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

mrt: Mapped[Decimal]

mean radiant temperature in °C calculated using thermal_comfort.mean_radiant_temp()

mrt_max: Mapped[Decimal]

maximum of mean radiant temperature in °C calculated using thermal_comfort.mean_radiant_temp()

mrt_min: Mapped[Decimal]

minimum of mean radiant temperature in °C calculated using thermal_comfort.mean_radiant_temp()

pet: Mapped[Decimal]

physiological equivalent temperature in °C calculated using thermal_comfort.pet_static()

pet_category: Mapped[HeatStressCategories]

physiological equivalent temperature category derived from PET_STRESS_CATEGORIES and applied using app.tasks.category_mapping()

pet_max: Mapped[Decimal]

maximum of physiological equivalent temperature in °C calculated using thermal_comfort.pet_static()

pet_min: Mapped[Decimal]

minimum of physiological equivalent temperature in °C calculated using thermal_comfort.pet_static()

precipitation_sum: Mapped[Decimal]

precipitation sum in mm

protocol_version: Mapped[int]

The protocol version the data was sent with

relative_humidity: Mapped[Decimal]

relative humidity in %

relative_humidity_max: Mapped[Decimal]

maximum of relative humidity in %

relative_humidity_min: Mapped[Decimal]

minimum of relative humidity in %

sensor_temperature_internal: Mapped[Decimal]

internal temperature of the sensor in °C

sensor_temperature_internal_max: Mapped[Decimal]

maximum of internal temperature of the sensor in °C

sensor_temperature_internal_min: Mapped[Decimal]

minimum of internal temperature of the sensor in °C

solar_radiation: Mapped[Decimal]

solar radiation in W/m2

solar_radiation_max: Mapped[Decimal]

maximum of solar radiation in W/m2

solar_radiation_min: Mapped[Decimal]

minimum of solar radiation in W/m2

specific_humidity: Mapped[Decimal]

specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

specific_humidity_max: Mapped[Decimal]

maximum of specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

specific_humidity_min: Mapped[Decimal]

minimum of specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

station: Mapped[Station]

The station the data was measured at

station_id: Mapped[str]

id of the station these measurements were taken at

thermistor_resistance: Mapped[Decimal]

thermistor resistance in Ohms

thermistor_resistance_max: Mapped[Decimal]

maximum of thermistor resistance in Ohms

thermistor_resistance_min: Mapped[Decimal]

minimum of thermistor resistance in Ohms

u_wind: Mapped[Decimal]

u wind component in m/s

u_wind_max: Mapped[Decimal]

maximum of u wind component in m/s

u_wind_min: Mapped[Decimal]

minimum of u wind component in m/s

utci: Mapped[Decimal]

universal thermal climate index in °C calculated using thermal_comfort.utci_approx()

utci_category: Mapped[HeatStressCategories]

universal thermal climate index category derived from UTCI_STRESS_CATEGORIES and applied using app.tasks.category_mapping()

utci_max: Mapped[Decimal]

maximum of universal thermal climate index in °C calculated using thermal_comfort.utci_approx()

utci_min: Mapped[Decimal]

minimum of universal thermal climate index in °C calculated using thermal_comfort.utci_approx()

v_wind: Mapped[Decimal]

v wind component in m/s

v_wind_max: Mapped[Decimal]

maximum of v wind component in m/s

v_wind_min: Mapped[Decimal]

minimum of v wind component in m/s

vapor_pressure: Mapped[Decimal]

vapor pressure in kPa

vapor_pressure_max: Mapped[Decimal]

maximum of vapor pressure in kPa

vapor_pressure_min: Mapped[Decimal]

minimum of vapor pressure in kPa

voltage_ratio: Mapped[Decimal]

voltage ratio of the sensor

voltage_ratio_max: Mapped[Decimal]

maximum of voltage ratio of the sensor

voltage_ratio_min: Mapped[Decimal]

minimum of voltage ratio of the sensor

wet_bulb_temperature: Mapped[Decimal]

wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wet_bulb_temperature_max: Mapped[Decimal]

maximum of wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wet_bulb_temperature_min: Mapped[Decimal]

minimum of wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wind_direction: Mapped[Decimal]

wind direction in °

wind_speed: Mapped[Decimal]

wind speed in m/s

wind_speed_max: Mapped[Decimal]

maximum of wind speed in m/s

wind_speed_min: Mapped[Decimal]

minimum of wind speed in m/s

x_orientation_angle: Mapped[Decimal]

x-tilt angle of the sensor in °

x_orientation_angle_max: Mapped[Decimal]

maximum of x-tilt angle of the sensor in °

x_orientation_angle_min: Mapped[Decimal]

minimum of x-tilt angle of the sensor in °

y_orientation_angle: Mapped[Decimal]

y-tilt angle of the sensor in °

y_orientation_angle_max: Mapped[Decimal]

maximum of y-tilt angle of the sensor in °

y_orientation_angle_min: Mapped[Decimal]

minimum of y-tilt angle of the sensor in °

class app.models.BuddyCheckQc(**kwargs)[source]

The quality control flags returned by the buddy check for a station.

air_temperature_qc_buddy_check: Mapped[bool]

quality control for the air temperature using a buddy check

air_temperature_qc_isolated_check: Mapped[bool]

quality control for the air temperature using an isolation check

atmospheric_pressure_qc_buddy_check: Mapped[bool]

quality control for the atmospheric pressure using a buddy check

atmospheric_pressure_qc_isolated_check: Mapped[bool]

quality control for the atmospheric pressure using an isolation check

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

qc_score: Mapped[Decimal]

Quality control score of the data. This is calculated by weighting the different QC checks according to their severity

relative_humidity_qc_buddy_check: Mapped[bool]

quality control for the relative humidity using a buddy check

relative_humidity_qc_isolated_check: Mapped[bool]

quality control for the relative humidity using an isolation check

station_id: Mapped[str]

id of the station these measurements were taken at

class app.models.HeatStressCategories(*values)[source]

Enum for the different heat stress categories as defined by PET or UTCI.

extreme_cold_stress = 'extreme cold stress'
extreme_heat_stress = 'extreme heat stress'
moderate_cold_stress = 'moderate cold stress'
moderate_heat_stress = 'moderate heat stress'
no_thermal_stress = 'no thermal stress'
slight_cold_stress = 'slight cold stress'
slight_heat_stress = 'slight heat stress'
strong_cold_stress = 'strong cold stress'
strong_heat_stress = 'strong heat stress'
unknown = 'unknown'
very_strong_cold_stress = 'very strong cold stress'
very_strong_heat_stress = 'very strong heat stress'
class app.models.LatestData(**kwargs)[source]

This is not an actual table, but a materialized view. We simply trick sqlalchemy into thinking this was a table. Querying a materialized view does not differ from querying a proper table.

The query for creating this materialized view is saved above.

absolute_humidity: Mapped[Decimal]

absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

air_temperature: Mapped[Decimal]

air temperature in °C

air_temperature_qc_buddy_check: Mapped[bool]

quality control for the air temperature using a buddy check

air_temperature_qc_isolated_check: Mapped[bool]

quality control for the air temperature using an isolation check

air_temperature_qc_persistence_check: Mapped[bool]

persistence check QC flag for air temperature. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function.Configuration is stored in app.qc.COLUMNS.

air_temperature_qc_range_check: Mapped[bool]

range check QC flag for air temperature. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

air_temperature_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for air temperature. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function.Configuration is stored in app.qc.COLUMNS.

altitude: Mapped[float]

altitude of the station in m a.s.l.

atmospheric_pressure: Mapped[Decimal]

atmospheric pressure in kPa

atmospheric_pressure_qc_buddy_check: Mapped[bool]

quality control for the atmospheric pressure using a buddy check

atmospheric_pressure_qc_isolated_check: Mapped[bool]

quality control for the atmospheric pressure using an isolation check

atmospheric_pressure_qc_persistence_check: Mapped[bool]

persistence check QC flag for atmospheric pressure. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

atmospheric_pressure_qc_range_check: Mapped[bool]

range check QC flag for atmospheric pressure. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

atmospheric_pressure_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for atmospheric pressure. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

atmospheric_pressure_reduced: Mapped[Decimal]

atmospheric pressure reduced to sea level in hPa calculated using app.tasks.reduce_pressure()

battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

black_globe_temperature: Mapped[Decimal]

black globe temperature in °C

black_globe_temperature_qc_persistence_check: Mapped[bool]

persistence check QC flag for black globe temperature. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

black_globe_temperature_qc_range_check: Mapped[bool]

range check QC flag for black globe temperature. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

black_globe_temperature_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for black globe temperature. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

dew_point: Mapped[Decimal]

dew point temperature in °C calculated using thermal_comfort.dew_point()

district: Mapped[str]

name of the district the station is located in

heat_index: Mapped[Decimal]

heat index in °C calculated using thermal_comfort.heat_index_extended()

latitude: Mapped[float]

latitude of the station in decimal degrees

lcz: Mapped[str]

local climate zone of the station

lightning_average_distance: Mapped[Decimal]

distance of lightning strikes in km

lightning_average_distance_qc_persistence_check: Mapped[bool]

persistence check QC flag for lightning average distance. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

lightning_average_distance_qc_range_check: Mapped[bool]

range check QC flag for lightning average distance. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

lightning_strike_count: Mapped[Decimal]

number of lightning strikes

lightning_strike_count_qc_persistence_check: Mapped[bool]

persistence check QC flag for lightning strike count. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

lightning_strike_count_qc_range_check: Mapped[bool]

range check QC flag for lightning strike count. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

long_name: Mapped[str]

long name of the station e.g. Nordmarkt

longitude: Mapped[float]

longitude of the station in decimal degrees

maximum_wind_speed: Mapped[Decimal]

maximum wind speed in m/s (gusts)

maximum_wind_speed_qc_persistence_check: Mapped[bool]

persistence check QC flag for maximum wind speed. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

maximum_wind_speed_qc_range_check: Mapped[bool]

range check QC flag for maximum wind speed. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

mrt: Mapped[Decimal]

mean radiant temperature in °C calculated using thermal_comfort.mean_radiant_temp()

pet: Mapped[Decimal]

physiological equivalent temperature in °C calculated using thermal_comfort.pet_static()

pet_category: Mapped[HeatStressCategories]

physiological equivalent temperature category derived from PET_STRESS_CATEGORIES and applied using app.tasks.category_mapping()

precipitation_sum: Mapped[Decimal]

precipitation sum in mm

precipitation_sum_qc_persistence_check: Mapped[bool]

persistence check QC flag for precipitation sum. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

precipitation_sum_qc_range_check: Mapped[bool]

range check QC flag for precipitation sum. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

precipitation_sum_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for precipitation sum. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

protocol_version: Mapped[int]

The protocol version the data was sent with

qc_flagged: Mapped[bool]

If True, at least one QC check has flagged the data as bad or is missing

qc_score: Mapped[Decimal]

Quality control score of the data. This is calculated by weighting the different QC checks according to their severity

async classmethod refresh(*, concurrently=True, **kwargs) None[source]

Refresh a materialized view.

Parameters:

concurrently (bool) – Whether to refresh the view concurrently. Refreshing concurrently is slower, however, no exclusive lock is acquired. This way reads to the view can still be performed. (default: True)

Return type:

None

relative_humidity: Mapped[Decimal]

relative humidity in %

relative_humidity_qc_buddy_check: Mapped[bool]

quality control for the relative humidity using a buddy check

relative_humidity_qc_isolated_check: Mapped[bool]

quality control for the relative humidity using an isolation check

relative_humidity_qc_persistence_check: Mapped[bool]

persistence check QC flag for relative humidity. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function.Configuration is stored in app.qc.COLUMNS.

relative_humidity_qc_range_check: Mapped[bool]

range check QC flag for relative humidity. If True, the data is flagged as bad. Uses the app.qc.range_check() function.Configuration is stored in app.qc.COLUMNS.

relative_humidity_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for relative humidity. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function.Configuration is stored in app.qc.COLUMNS.

sensor_temperature_internal: Mapped[Decimal]

internal temperature of the sensor in °C

solar_radiation: Mapped[Decimal]

solar radiation in W/m2

solar_radiation_qc_persistence_check: Mapped[bool]

persistence check QC flag for solar radiation. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

solar_radiation_qc_range_check: Mapped[bool]

range check QC flag for solar radiation. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

solar_radiation_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for solar radiation. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

specific_humidity: Mapped[Decimal]

specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

station: Mapped[Station]

The station the data was measured at

station_id: Mapped[str]

id of the station e.g. DOBNOM

station_type: Mapped[StationType]

type of the station e.g. temprh

thermistor_resistance: Mapped[Decimal]

thermistor resistance in Ohms

u_wind: Mapped[Decimal]

u wind component in m/s

u_wind_qc_persistence_check: Mapped[bool]

persistence check QC flag for u wind component. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

u_wind_qc_range_check: Mapped[bool]

range check QC flag for u wind component. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

u_wind_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for u wind component. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

utci: Mapped[Decimal]

universal thermal climate index in °C calculated using thermal_comfort.utci_approx()

utci_category: Mapped[HeatStressCategories]

universal thermal climate index category derived from UTCI_STRESS_CATEGORIES and applied using app.tasks.category_mapping()

v_wind: Mapped[Decimal]

v wind component in m/s

v_wind_qc_persistence_check: Mapped[bool]

persistence check QC flag for v wind component. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

v_wind_qc_range_check: Mapped[bool]

range check QC flag for v wind component. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

v_wind_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for v wind component. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

vapor_pressure: Mapped[Decimal]

vapor pressure in kPa

voltage_ratio: Mapped[Decimal]

voltage ratio of the sensor

wet_bulb_temperature: Mapped[Decimal]

wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wind_direction: Mapped[Decimal]

wind direction in °

wind_direction_qc_persistence_check: Mapped[bool]

persistence check QC flag for wind direction. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

wind_direction_qc_range_check: Mapped[bool]

range check QC flag for wind direction. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

wind_speed: Mapped[Decimal]

wind speed in m/s

wind_speed_qc_persistence_check: Mapped[bool]

persistence check QC flag for wind speed. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function. Configuration is stored in app.qc.COLUMNS.

wind_speed_qc_range_check: Mapped[bool]

range check QC flag for wind speed. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

wind_speed_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for wind speed. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

x_orientation_angle: Mapped[Decimal]

x-tilt angle of the sensor in °

x_orientation_angle_qc_range_check: Mapped[bool]

range check QC flag for x orientation angle. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

x_orientation_angle_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for x orientation angle. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

y_orientation_angle: Mapped[Decimal]

y-tilt angle of the sensor in °

y_orientation_angle_qc_range_check: Mapped[bool]

range check QC flag for y orientation angle. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

y_orientation_angle_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for y orientation angle. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function. Configuration is stored in app.qc.COLUMNS.

class app.models.MaterializedView(**kwargs) None[source]

Baseclass for a materialized view. The view is faked as a table, so that sqlalchemy can handle it like a table and so we can incrementally refresh it.

async classmethod get_view_state() datetime | None[source]

Get the latest timestamp present in the materialized view.

Return type:

Optional[datetime]

is_continuous_aggregate = False
async classmethod refresh(*, concurrently=True, window_start=None, window_end=None) None[source]

Refresh the materialized view.

This takes into account whether the view is a continuous aggregate or a vanilla postgres materialized view. This needs to be done outside of a transaction.

Parameters:
  • concurrently (bool) – Whether to refresh the view concurrently. Refreshing concurrently is slower, however, no exclusive lock is acquired. This way reads to the view can still be performed. This only applies to vanilla postgres materialized views. (default: True)

  • window_start (Optional[datetime]) – The start of the window that will be refreshed. This only applies to continuous aggregates. This is not inclusive. (default: None)

  • window_end (Optional[datetime]) – The end of the window that will be refreshed. This only applies to continuous aggregates. This is inclusive. (default: None)

Return type:

None

station_id: Mapped[str] = <sqlalchemy.orm.properties.MappedColumn object>
class app.models.SHT35DataRaw(**kwargs)[source]
air_temperature: Mapped[Decimal]

air temperature in °C

battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

protocol_version: Mapped[int]

The protocol version the data was sent with

relative_humidity: Mapped[Decimal]

relative humidity in %

sensor: Mapped[Sensor]

The sensor the data was measured with

sensor_id: Mapped[str]

id of the sensor e.g. DEC1234

class app.models.Sensor(**kwargs)[source]

Pool of sensors that can be installed at a station

current_station: Mapped[Station | None]

the station the sensor is currently deployed at

deployments: Mapped[list[SensorDeployment]]

list of all deployments of the sensor

device_id: Mapped[int]

device id of the sensor e.g. 1234567890

former_stations: Mapped[list[Station]]

list of stations the sensor was previously deployed at

relhum_calib_offset: Mapped[Decimal]

relative humidity calibration offset in %. This is the offset that is applied to the relative humidity value before it is stored in the database

sensor_id: Mapped[str]

id of the sensor e.g. DEC1234

sensor_type: Mapped[SensorType]

type of the sensor e.g. biomet

temp_calib_offset: Mapped[Decimal]

temperature calibration offset in °C. This is the offset that is applied to the temperature value before it is stored in the database

class app.models.SensorDeployment(**kwargs)[source]

Deployment of a sensor at a station

deployment_id: Mapped[int]

unique id of the deployment

sensor: Mapped[Sensor]

link to the sensor that is/was deployed

sensor_id: Mapped[str]

id of the sensor e.g. DEC1234

setup_date: Mapped[datetime]

date when the sensor was set up at the station

station: Mapped[Station]

link to the station where the sensor is/was deployed

station_id: Mapped[str]

id of the station the sensor is/was deployed at e.g. DOBNOM

teardown_date: Mapped[datetime | None]

date when the sensor was taken down from the station

class app.models.SensorType(*values)[source]

Enum differentiating between the different types of sensors:

  • atm41: ATM41 sensor with many parameters

  • blg: BLG sensor with black globe temperature

  • sht35: SHT35 sensor with temperature and relative humidity

atm41 = 'atm41'
blg = 'blg'
sht35 = 'sht35'
class app.models.Station(**kwargs)[source]

Representation of a station which has a physical location and sensor(s) attached to it.

active_deployments: Mapped[list[SensorDeployment]]

list of deployments that are currently active at the station

active_sensors: Mapped[list[Sensor]]

list of sensors that are currently deployed at the station

altitude: Mapped[float]

altitude of the station in m a.s.l.

atm41_sensor_orientation: Mapped[Decimal | None]

the orientation (-angle) of the arm of the ATM41 sensor of the station from the mounting structure

blg_sensor_orientation: Mapped[Decimal | None]

the orientation (-angle) of the arm of the black globe sensor of the station from the mounting structure

city: Mapped[str]

name of the city the station is located in

comment: Mapped[str | None]

a text describing the station

country: Mapped[str]

name of the country the station is located in

deployments: Mapped[list[SensorDeployment]]

list of all deployments at the station

district: Mapped[str]

name of the district the station is located in

dominant_land_use: Mapped[str | None]

dominant land use at the station

former_deployments: Mapped[list[SensorDeployment]]

list of deployments that were previously active at the station

former_sensors: Mapped[list[Sensor]]

list of sensors that were previously deployed at the station

property full_address: str

Returns the full address of the station as a string.

latitude: Mapped[float]

latitude of the station in decimal degrees

lcz: Mapped[str | None]

local climate zone of the station

leuchtennummer: Mapped[int | None]

the number of the streetlight the sensor is mounted to

long_name: Mapped[str]

long name of the station e.g. Nordmarkt

longitude: Mapped[float]

longitude of the station in decimal degrees

maintenance_notes: Mapped[str | None]

notes regarding maintenance activities at the station

metadata_collection_date: Mapped[datetime | None]

the date when the metadata was collected in the field

mounting_structure_color: Mapped[str | None]

color of the mounting structure e.g. black, white, …

mounting_type: Mapped[str | None]

the structure the sensor is mounted to e.g. black mast, building, …

number: Mapped[str | None]

if possible, the number of the closest building

orographic_setting: Mapped[str | None]

orographic setting of the station e.g. flat, hilly, …

plz: Mapped[int]

postal code of the station

sensor_distance_from_mounting_structure: Mapped[Decimal | None]

the distance of the main component of the station (ATM41 or SHT35) from the mounting structure

sensor_height_agl: Mapped[Decimal | None]

the mounting height of the main component of the station (ATM41 or SHT35)

sht35_sensor_orientation: Mapped[Decimal | None]

the orientation (-angle) of the arm of the SHT35 sensor of the station from the mounting structure

station_id: Mapped[str]

id of the station e.g. DOBNOM

station_type: Mapped[StationType]

type of the station e.g. temprh

street: Mapped[str]

name of the street the station is located at

surface_below_sensor: Mapped[str | None]

surface type directly below the sensor e.g. asphalt, grass, …

surrounding_land_cover_description: Mapped[str | None]

a text describing the surrounding land cover

svf: Mapped[Decimal]

sky view factor of the station

urban_atlas_class_name: Mapped[str | None]

urban atlas class name of the station

urban_atlas_class_nr: Mapped[int | None]

urban atlas class number of the station

class app.models.StationType(*values)[source]

Enum differentiating between the different types of stations:

  • temprh: station with a SHT35 sensor

  • biomet: station with an ATM41 and a BLG sensor

  • double: station with an ATM41, SHT35, and a BLG sensor

biomet = 'biomet'
double = 'double'
temprh = 'temprh'
class app.models.TempRHData(**kwargs)[source]
absolute_humidity: Mapped[Decimal]

absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

air_temperature: Mapped[Decimal]

air temperature in °C

air_temperature_qc_persistence_check: Mapped[bool]

persistence check QC flag for air temperature. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function.Configuration is stored in app.qc.COLUMNS.

air_temperature_qc_range_check: Mapped[bool]

range check QC flag for air temperature. If True, the data is flagged as bad. Uses the app.qc.range_check() function. Configuration is stored in app.qc.COLUMNS.

air_temperature_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for air temperature. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function.Configuration is stored in app.qc.COLUMNS.

air_temperature_raw: Mapped[Decimal]

raw air temperature in °C with no calibration applied

battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

deployment: Mapped[SensorDeployment]

the deployment that made the measurement of this data

dew_point: Mapped[Decimal]

dew point temperature in °C calculated using thermal_comfort.dew_point()

heat_index: Mapped[Decimal]

heat index in °C calculated using thermal_comfort.heat_index_extended()

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

protocol_version: Mapped[int]

The protocol version the data was sent with

qc_flagged: Mapped[bool]

If True, at least one QC check has flagged the data as bad or is missing

relative_humidity: Mapped[Decimal]

relative humidity in %

relative_humidity_qc_persistence_check: Mapped[bool]

persistence check QC flag for relative humidity. If True, the data is flagged as bad. Uses the app.qc.persistence_check() function.Configuration is stored in app.qc.COLUMNS.

relative_humidity_qc_range_check: Mapped[bool]

range check QC flag for relative humidity. If True, the data is flagged as bad. Uses the app.qc.range_check() function.Configuration is stored in app.qc.COLUMNS.

relative_humidity_qc_spike_dip_check: Mapped[bool]

spike/dip check QC flag for relative humidity. If True, the data is flagged as bad. Uses the app.qc.spike_dip_check() function.Configuration is stored in app.qc.COLUMNS.

relative_humidity_raw: Mapped[Decimal]

raw relative humidity in % with no calibration applied

sensor: Mapped[Sensor]

The sensor the data was measured with

sensor_id: Mapped[str]

id of the SHT35 sensor these measurements were taken with

specific_humidity: Mapped[Decimal]

specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

station: Mapped[Station]

The station the data was measured at

station_id: Mapped[str]

id of the station these measurements were taken at

wet_bulb_temperature: Mapped[Decimal]

wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

class app.models.TempRHDataDaily(**kwargs)[source]

This is not an actual table, but a materialized view. We simply trick sqlalchemy into thinking this was a table. Querying a materialized view does not differ from querying a proper table.

absolute_humidity: Mapped[Decimal]

absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

absolute_humidity_max: Mapped[Decimal]

maximum of absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

absolute_humidity_min: Mapped[Decimal]

minimum of absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

air_temperature: Mapped[Decimal]

air temperature in °C

air_temperature_max: Mapped[Decimal]

maximum of air temperature in °C

air_temperature_min: Mapped[Decimal]

minimum of air temperature in °C

air_temperature_raw: Mapped[Decimal]

raw air temperature in °C with no calibration applied

air_temperature_raw_max: Mapped[Decimal]

maximum of raw air temperature in °C with no calibration applied

air_temperature_raw_min: Mapped[Decimal]

minimum of raw air temperature in °C with no calibration applied

battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

battery_voltage_max: Mapped[Decimal]

maximum of The battery voltage of the sensor in Volts

battery_voltage_min: Mapped[Decimal]

minimum of The battery voltage of the sensor in Volts

dew_point: Mapped[Decimal]

dew point temperature in °C calculated using thermal_comfort.dew_point()

dew_point_max: Mapped[Decimal]

maximum of dew point temperature in °C calculated using thermal_comfort.dew_point()

dew_point_min: Mapped[Decimal]

minimum of dew point temperature in °C calculated using thermal_comfort.dew_point()

heat_index: Mapped[Decimal]

heat index in °C calculated using thermal_comfort.heat_index_extended()

heat_index_max: Mapped[Decimal]

maximum of heat index in °C calculated using thermal_comfort.heat_index_extended()

heat_index_min: Mapped[Decimal]

minimum of heat index in °C calculated using thermal_comfort.heat_index_extended()

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

protocol_version: Mapped[int]

The protocol version the data was sent with

relative_humidity: Mapped[Decimal]

relative humidity in %

relative_humidity_max: Mapped[Decimal]

maximum of relative humidity in %

relative_humidity_min: Mapped[Decimal]

minimum of relative humidity in %

relative_humidity_raw: Mapped[Decimal]

raw relative humidity in % with no calibration applied

relative_humidity_raw_max: Mapped[Decimal]

maximum of raw relative humidity in % with no calibration applied

relative_humidity_raw_min: Mapped[Decimal]

minimum of raw relative humidity in % with no calibration applied

specific_humidity: Mapped[Decimal]

specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

specific_humidity_max: Mapped[Decimal]

maximum of specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

specific_humidity_min: Mapped[Decimal]

minimum of specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

station: Mapped[Station]

The station the data was measured at

station_id: Mapped[str]

id of the station these measurements were taken at

wet_bulb_temperature: Mapped[Decimal]

wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wet_bulb_temperature_max: Mapped[Decimal]

maximum of wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wet_bulb_temperature_min: Mapped[Decimal]

minimum of wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

class app.models.TempRHDataHourly(**kwargs)[source]

This is not an actual table, but a materialized view. We simply trick sqlalchemy into thinking this was a table. Querying a materialized view does not differ from querying a proper table.

absolute_humidity: Mapped[Decimal]

absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

absolute_humidity_max: Mapped[Decimal]

maximum of absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

absolute_humidity_min: Mapped[Decimal]

minimum of absolute humidity in g/m3 calculated using thermal_comfort.absolute_humidity()

air_temperature: Mapped[Decimal]

air temperature in °C

air_temperature_max: Mapped[Decimal]

maximum of air temperature in °C

air_temperature_min: Mapped[Decimal]

minimum of air temperature in °C

air_temperature_raw: Mapped[Decimal]

raw air temperature in °C with no calibration applied

air_temperature_raw_max: Mapped[Decimal]

maximum of raw air temperature in °C with no calibration applied

air_temperature_raw_min: Mapped[Decimal]

minimum of raw air temperature in °C with no calibration applied

battery_voltage: Mapped[Decimal]

The battery voltage of the sensor in Volts

battery_voltage_max: Mapped[Decimal]

maximum of The battery voltage of the sensor in Volts

battery_voltage_min: Mapped[Decimal]

minimum of The battery voltage of the sensor in Volts

dew_point: Mapped[Decimal]

dew point temperature in °C calculated using thermal_comfort.dew_point()

dew_point_max: Mapped[Decimal]

maximum of dew point temperature in °C calculated using thermal_comfort.dew_point()

dew_point_min: Mapped[Decimal]

minimum of dew point temperature in °C calculated using thermal_comfort.dew_point()

heat_index: Mapped[Decimal]

heat index in °C calculated using thermal_comfort.heat_index_extended()

heat_index_max: Mapped[Decimal]

maximum of heat index in °C calculated using thermal_comfort.heat_index_extended()

heat_index_min: Mapped[Decimal]

minimum of heat index in °C calculated using thermal_comfort.heat_index_extended()

measured_at: Mapped[datetime]

The exact time the value was measured in UTC

protocol_version: Mapped[int]

The protocol version the data was sent with

relative_humidity: Mapped[Decimal]

relative humidity in %

relative_humidity_max: Mapped[Decimal]

maximum of relative humidity in %

relative_humidity_min: Mapped[Decimal]

minimum of relative humidity in %

relative_humidity_raw: Mapped[Decimal]

raw relative humidity in % with no calibration applied

relative_humidity_raw_max: Mapped[Decimal]

maximum of raw relative humidity in % with no calibration applied

relative_humidity_raw_min: Mapped[Decimal]

minimum of raw relative humidity in % with no calibration applied

specific_humidity: Mapped[Decimal]

specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

specific_humidity_max: Mapped[Decimal]

maximum of specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

specific_humidity_min: Mapped[Decimal]

minimum of specific humidity in g/kg calculated using thermal_comfort.specific_humidity()

station: Mapped[Station]

The station the data was measured at

station_id: Mapped[str]

id of the station these measurements were taken at

wet_bulb_temperature: Mapped[Decimal]

wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wet_bulb_temperature_max: Mapped[Decimal]

maximum of wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

wet_bulb_temperature_min: Mapped[Decimal]

minimum of wet bulb temperature in °C calculated using thermal_comfort.wet_bulb_temp()

app.models.create_hypertable(target, connection, **kwargs) None[source]

Create a timescaledb hypertable for the given table if it doesn’t exist.

Parameters:
  • target (Table) – The table to create a hypertable for

  • connection (Connection) – The database connection to use

  • kwargs (Any) – Additional keyword arguments (which are ignored)

Return type:

None