From fbd9c75a724f0a20aee90ad70498ee8de11da02f Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Tue, 21 Feb 2023 15:51:13 +0100 Subject: [PATCH] Add WeatherElements --- src/vipscore_common/entities.py | 52 +++++++++++++++++++++++++++++++++ tests/test_entities.py | 5 +++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/vipscore_common/entities.py b/src/vipscore_common/entities.py index 345d5e4..562d7de 100755 --- a/src/vipscore_common/entities.py +++ b/src/vipscore_common/entities.py @@ -162,3 +162,55 @@ class WeatherObservation(BaseModel): raise ValueError("%s must be timezone aware" % v) return v +class WeatherElements(): + + # Mean temp (Celcius) + TEMPERATURE_MEAN = "TM" + # Minimum temperature (Celcius) + TEMPERATURE_MINIMUM = "TN" + # Maximum temperature (Celcius) + TEMPERATURE_MAXIMUM = "TX" + # Instantaneous temperature (Celcius) + TEMPERATURE_INSTANTANEOUS = "TT" + #Soil temperatures at various depths + SOIL_TEMPERATURE_5CM_MEAN ="TJM5" + SOIL_TEMPERATURE_10CM_MEAN ="TJM10" + SOIL_TEMPERATURE_25CM_MEAN ="TJM25" + SOIL_TEMPERATURE_50CM_MEAN ="TJM50" + # Dew point temperature (Celcius) + DEW_POINT_TEMPERATURE = "TD" + # Aggregated rainfall (millimeters) + PRECIPITATION = "RR" + # Average relative humidity (%) + RELATIVE_HUMIDITY_MEAN = "UM" + # Instantaneous relative humidity (%) + RELATIVE_HUMIDITY_INSTANTANEOUS = "UU" + # Global radiation (W/sqm) + GLOBAL_RADIATION = "Q0" + # Immmediate calculated clear sky solar radiation (clear sky) + GLOBAL_RADIATION_CLEAR_SKY_CALCULATED = "Q0c" + # Leaf wetness (Minutes per hour) + LEAF_WETNESS_DURATION = "BT" + # Leaf wetness at ground level (Minutes per hour) + LEAF_WETNESS_DURATION_GROUND_LEVEL = "BTg" + # Soil water content at various depths + SOIL_WATER_CONTENT_5CM = "VAN5" + SOIL_WATER_CONTENT_10CM = "VAN10" + SOIL_WATER_CONTENT_25CM = "VAN25" + SOIL_WATER_CONTENT_50CM = "VAN50" + # Soil conductivity at various depths + SOIL_CONDUCTIVITY_5CM = "LEJ5" + # Average wind speed (meters / second) for the last 60 minutes, measured at 2 meter height + WIND_SPEED_2M = "FM2" + # Average wind speed (meters / second) for the last 60 minutes, measured at 10 meter height + WIND_SPEED_10M = "FM" + # Average wind speed (meters / second) for the last 10 minutes, measured at 2 meter height + WIND_SPEED_10MIN_2M = "FF2" + # Average wind speed (meters / second) for the last 10 minutes, measured at 10 meter height + WIND_SPEED_10MIN_10M = "FF" + # Average wind direction for the last 10 minutes, measured at 2 meter height + WIND_DIR_10MIN_2M = "DD2" + # Average wind direction for the last 10 minutes, measured at 10 meter height + WIND_DIR_10MIN_10M = "DD" + # Potential evapotranspiration by the Penman equation + POTENTIAL_EVAPORATION = "EPP" \ No newline at end of file diff --git a/tests/test_entities.py b/tests/test_entities.py index 1272768..5975b42 100644 --- a/tests/test_entities.py +++ b/tests/test_entities.py @@ -20,4 +20,7 @@ class TestEntities(unittest.TestCase): warning_status = 2 ) - r.set_value("TM",2) \ No newline at end of file + r.set_value("TM",2) + + def test_weather_elements(self): + self.assertEquals("TM",WeatherElements.TEMPERATURE_MEAN) \ No newline at end of file -- GitLab