-
Notifications
You must be signed in to change notification settings - Fork 7
add ground temperature 1m as option to weather data #1351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
6bb6984
0342ae2
920be80
e259bee
1b8dd09
6a77ffc
d46b0d1
9f767ed
b015b66
8e33409
b0d87d9
0399aa3
813cdbe
88191d1
47ac942
41302fe
3c153a3
83b3736
13f27ee
55a7c15
cde88f0
f0698b4
1d9ff09
4ec2c68
f939e57
55bb4e1
71ab33a
224aa30
6039cc2
46fb11f
082451a
3a0e1e9
57640e2
7f11669
1c5c4ba
3be844f
3f04286
c8f0d18
c067c0b
64c0172
d691a2c
e80cb33
42e8599
ae9da09
481ab12
5efc4d2
41d031e
a1967ea
aa481ca
ac127ec
9d7215c
2b6ed95
fe531ab
47455fe
6338599
b4ace56
2da8ced
f85cf9b
9a6840c
da1a8cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -62,5 +62,14 @@ Weather data is comprised of five key components: | |||||
| * - **`windDirection`** | ||||||
| - Wind direction, where 0° is North, 90° is East, etc. | ||||||
| - ° (degrees) | ||||||
| * - **`groundTemperatureLevel1`** | ||||||
| - Ground temperature at level 2 for this coordinate. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - K (Kelvin) | ||||||
| * - **`groundTemperatureLevel2`** | ||||||
| - Ground temperature at level 2 for this coordinate. | ||||||
| - K (Kelvin) | ||||||
| ``` | ||||||
| Weather data in COSMO and ICON formats is supported. Additional optional weather data can also be provided. | ||||||
| Weather data in COSMO and ICON formats is supported. Additional optional weather data can also be provided. | ||||||
| The ground temperature measurements at level 1 and level 2 depth are used. Underground cables are typically laid at around 80 cm depth. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,8 +13,9 @@ | |
| import edu.ie3.util.quantities.interfaces.Irradiance; | ||
| import java.time.ZonedDateTime; | ||
| import java.time.format.DateTimeFormatter; | ||
| import java.util.Collections; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import java.util.Set; | ||
| import javax.measure.quantity.Angle; | ||
| import javax.measure.quantity.Speed; | ||
|
|
@@ -32,6 +33,8 @@ public class CosmoTimeBasedWeatherValueFactory extends TimeBasedWeatherValueFact | |
| private static final String TEMPERATURE = "temperature"; | ||
| private static final String WIND_DIRECTION = "windDirection"; | ||
| private static final String WIND_VELOCITY = "windVelocity"; | ||
| private static final String GROUND_TEMPERATURE_LEVEL_1 = "groundTemperatureLevel1"; | ||
| private static final String GROUND_TEMPERATURE_LEVEL_2 = "groundTemperatureLevel2"; | ||
|
|
||
| public CosmoTimeBasedWeatherValueFactory(TimeUtil timeUtil) { | ||
| super(timeUtil); | ||
|
|
@@ -55,7 +58,11 @@ protected List<Set<String>> getFields(Class<?> entityClass) { | |
| TEMPERATURE, | ||
| WIND_DIRECTION, | ||
| WIND_VELOCITY); | ||
| return Collections.singletonList(minConstructorParams); | ||
|
|
||
| Set<String> withGroundTemp = | ||
| expandSet(minConstructorParams, GROUND_TEMPERATURE_LEVEL_1, GROUND_TEMPERATURE_LEVEL_2); | ||
|
|
||
| return Arrays.asList(minConstructorParams, withGroundTemp); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -72,14 +79,21 @@ protected TimeBasedValue<WeatherValue> buildModel(TimeBasedWeatherValueData data | |
| data.getQuantity(WIND_DIRECTION, StandardUnits.WIND_DIRECTION); | ||
| ComparableQuantity<Speed> windVelocity = | ||
| data.getQuantity(WIND_VELOCITY, StandardUnits.WIND_VELOCITY); | ||
| Optional<ComparableQuantity<Temperature>> groundTempValOne = | ||
| data.getQuantityOptional(GROUND_TEMPERATURE_LEVEL_1, StandardUnits.TEMPERATURE); | ||
| Optional<ComparableQuantity<Temperature>> groundTempValTwo = | ||
| data.getQuantityOptional(GROUND_TEMPERATURE_LEVEL_2, StandardUnits.TEMPERATURE); | ||
| WeatherValue weatherValue = | ||
| new WeatherValue( | ||
| coordinate, | ||
| directIrradiance, | ||
| diffuseIrradiance, | ||
| temperature, | ||
| windDirection, | ||
| windVelocity); | ||
| windVelocity, | ||
| groundTempValOne, | ||
| groundTempValTwo); | ||
|
Comment on lines
+94
to
+95
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. align naming |
||
|
|
||
| return new TimeBasedValue<>(time, weatherValue); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,8 @@ public class IconTimeBasedWeatherValueFactory extends TimeBasedWeatherValueFacto | |
| private static final String TEMPERATURE = "t2m"; | ||
| private static final String WIND_VELOCITY_U = "u131m"; | ||
| private static final String WIND_VELOCITY_V = "v131m"; | ||
| private static final String GROUND_TEMPERATURE_LEVEL_1 = "tg1"; | ||
| private static final String GROUND_TEMPERATURE_LEVEL_2 = "tg2"; | ||
|
|
||
| public IconTimeBasedWeatherValueFactory() { | ||
| super(); | ||
|
|
@@ -53,7 +55,8 @@ protected List<Set<String>> getFields(Class<?> entityClass) { | |
| "albrad", | ||
| "asobs", | ||
| "aswdifuS", | ||
| "tG", | ||
| "tg1", | ||
| "tg2", | ||
| "u10m", | ||
| "u20m", | ||
| "u216m", | ||
|
|
@@ -88,14 +91,21 @@ protected TimeBasedValue<WeatherValue> buildModel(TimeBasedWeatherValueData data | |
| data.getQuantity(TEMPERATURE, Units.KELVIN).to(StandardUnits.TEMPERATURE); | ||
| ComparableQuantity<Angle> windDirection = getWindDirection(data); | ||
| ComparableQuantity<Speed> windVelocity = getWindVelocity(data); | ||
| Optional<ComparableQuantity<Temperature>> groundTemperatureLevel1 = | ||
| data.getQuantityOptional(GROUND_TEMPERATURE_LEVEL_1, Units.KELVIN); | ||
| Optional<ComparableQuantity<Temperature>> groundTemperatureLevl2 = | ||
| data.getQuantityOptional(GROUND_TEMPERATURE_LEVEL_2, Units.KELVIN); | ||
|
|
||
| WeatherValue weatherValue = | ||
| new WeatherValue( | ||
| coordinate, | ||
| directIrradiance, | ||
| diffuseIrradiance, | ||
| temperature, | ||
| windDirection, | ||
| windVelocity); | ||
| windVelocity, | ||
| groundTemperatureLevel1, | ||
| groundTemperatureLevl2); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo |
||
| return new TimeBasedValue<>(time, weatherValue); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* | ||
| * © 2025. TU Dortmund University, | ||
| * Institute of Energy Systems, Energy Efficiency and Energy Economics, | ||
| * Research group Distribution grid planning and operation | ||
| */ | ||
| package edu.ie3.datamodel.models.value; | ||
|
|
||
| import javax.measure.quantity.Temperature; | ||
| import tech.units.indriya.ComparableQuantity; | ||
|
|
||
| /** | ||
| * Describes a ground temperature value. This class extends {@link TemperatureValue} to represent | ||
| * temperature at a specific depth in the ground. | ||
| */ | ||
| public class GroundTemperatureValue extends TemperatureValue { | ||
|
|
||
| /** | ||
| * Constructs a new GroundTemperatureValue. | ||
| * | ||
| * @param temperature The temperature quantity (typically in K) | ||
| */ | ||
| public GroundTemperatureValue(ComparableQuantity<Temperature> temperature) { | ||
| super(temperature); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "GroundTemperatureValue{" + "temperature=" + getTemperature().orElse(null) + '}'; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
|
|
||
| import edu.ie3.util.quantities.interfaces.Irradiance; | ||
| import java.util.Objects; | ||
| import java.util.Optional; | ||
| import javax.measure.quantity.Angle; | ||
| import javax.measure.quantity.Speed; | ||
| import javax.measure.quantity.Temperature; | ||
|
|
@@ -27,44 +28,66 @@ | |
| /** Wind values for this coordinate */ | ||
| private final WindValue wind; | ||
|
|
||
| /** Ground temperature value for this coordinate */ | ||
| private final Optional<GroundTemperatureValue> groundTemperatureLevel1; | ||
|
Check failure on line 32 in src/main/java/edu/ie3/datamodel/models/value/WeatherValue.java
|
||
|
|
||
| /** Ground temperature value for this coordinate */ | ||
| private final Optional<GroundTemperatureValue> groundTemperatureLevel2; | ||
|
Check failure on line 35 in src/main/java/edu/ie3/datamodel/models/value/WeatherValue.java
|
||
|
|
||
| /** | ||
| * @param coordinate of this weather value set | ||
| * @param solarIrradiance values for this coordinate | ||
| * @param temperature values for this coordinate | ||
| * @param wind values for this coordinate | ||
| * @param groundTemperatureValueOne values for this coordinate (can be null) | ||
| * @param groundTemperatureValueTwo values for this coordinate (can be null) | ||
| */ | ||
| public WeatherValue( | ||
| Point coordinate, | ||
| SolarIrradianceValue solarIrradiance, | ||
| TemperatureValue temperature, | ||
| WindValue wind) { | ||
| WindValue wind, | ||
| Optional<GroundTemperatureValue> groundTemperatureValueOne, | ||
| Optional<GroundTemperatureValue> groundTemperatureValueTwo) { | ||
|
Comment on lines
+50
to
+51
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we still have a different naming |
||
| this.coordinate = coordinate; | ||
| this.solarIrradiance = solarIrradiance; | ||
| this.temperature = temperature; | ||
| this.wind = wind; | ||
| this.groundTemperatureLevel1 = groundTemperatureValueOne; | ||
| this.groundTemperatureLevel2 = groundTemperatureValueTwo; | ||
| } | ||
|
|
||
| /** | ||
| * Constructor with all parameters as quantities. | ||
| * | ||
| * @param coordinate of this weather value set | ||
| * @param directSolarIrradiance Direct sun irradiance for this coordinate (typically in W/m²) | ||
| * @param diffuseSolarIrradiance Diffuse sun irradiance for this coordinate (typically in W/m²) | ||
| * @param temperature for this coordinate (typically in K) | ||
| * @param direction Direction, the wind comes from as an angle from north increasing clockwise | ||
| * (typically in rad) | ||
| * @param velocity Wind velocity for this coordinate (typically in m/s) | ||
| * @param groundTempValOne Ground temperature for this coordinate (typically in K, can be null) | ||
| * @param groundTempValTwo Ground temperature for this coordinate (typically in K, can be null) | ||
| */ | ||
| public WeatherValue( | ||
| Point coordinate, | ||
| ComparableQuantity<Irradiance> directSolarIrradiance, | ||
| ComparableQuantity<Irradiance> diffuseSolarIrradiance, | ||
| ComparableQuantity<Temperature> temperature, | ||
| ComparableQuantity<Angle> direction, | ||
| ComparableQuantity<Speed> velocity) { | ||
| ComparableQuantity<Speed> velocity, | ||
| Optional<ComparableQuantity<Temperature>> groundTempValOne, | ||
| Optional<ComparableQuantity<Temperature>> groundTempValTwo) { | ||
| this( | ||
| coordinate, | ||
| new SolarIrradianceValue(directSolarIrradiance, diffuseSolarIrradiance), | ||
| new TemperatureValue(temperature), | ||
| new WindValue(direction, velocity)); | ||
| new WindValue(direction, velocity), | ||
| Optional.ofNullable(groundTempValOne) | ||
| .flatMap(optional -> optional.map(GroundTemperatureValue::new)), | ||
| Optional.ofNullable(groundTempValTwo) | ||
| .flatMap(optional -> optional.map(GroundTemperatureValue::new))); | ||
| } | ||
|
|
||
| public Point getCoordinate() { | ||
|
|
@@ -83,6 +106,14 @@ | |
| return wind; | ||
| } | ||
|
|
||
| public Optional<GroundTemperatureValue> getGroundTemperatureLevel1() { | ||
| return groundTemperatureLevel1; | ||
| } | ||
|
|
||
| public Optional<GroundTemperatureValue> getGroundTemperatureLevel2() { | ||
| return groundTemperatureLevel2; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) return true; | ||
|
|
@@ -91,12 +122,20 @@ | |
| return coordinate.equals(that.coordinate) | ||
| && solarIrradiance.equals(that.solarIrradiance) | ||
| && temperature.equals(that.temperature) | ||
| && wind.equals(that.wind); | ||
| && wind.equals(that.wind) | ||
| && Objects.equals(groundTemperatureLevel1, that.groundTemperatureLevel1) | ||
| && Objects.equals(groundTemperatureLevel2, that.groundTemperatureLevel2); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(coordinate, solarIrradiance, temperature, wind); | ||
| return Objects.hash( | ||
| coordinate, | ||
| solarIrradiance, | ||
| temperature, | ||
| wind, | ||
| groundTemperatureLevel1, | ||
| groundTemperatureLevel2); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -110,6 +149,10 @@ | |
| + temperature | ||
| + ", wind=" | ||
| + wind | ||
| + ", groundTemperatureLevel1=" | ||
| + groundTemperatureLevel1 | ||
| + ", groundTemperatureLevel2=" | ||
| + groundTemperatureLevel2 | ||
| + '}'; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,9 @@ class CosmoTimeBasedWeatherValueFactoryTest extends Specification { | |
| "directIrradiance" : "286.872985839844", | ||
| "temperature" : "", | ||
| "windDirection" : "0", | ||
| "windVelocity" : "1.66103506088257" | ||
| "windVelocity" : "1.66103506088257", | ||
| "groundTemperatureLevel1" : "", | ||
| "groundTemperatureLevel2" : "" | ||
| ] | ||
|
|
||
| def data = new TimeBasedWeatherValueData(parameter, coordinate) | ||
|
|
@@ -39,7 +41,9 @@ class CosmoTimeBasedWeatherValueFactoryTest extends Specification { | |
| Quantities.getQuantity(282.671997070312d, StandardUnits.SOLAR_IRRADIANCE), | ||
| null, | ||
| Quantities.getQuantity(0d, StandardUnits.WIND_DIRECTION), | ||
| Quantities.getQuantity(1.66103506088257d, StandardUnits.WIND_VELOCITY))) | ||
| Quantities.getQuantity(1.66103506088257d, StandardUnits.WIND_VELOCITY), | ||
| Optional.empty(), | ||
| Optional.empty())) | ||
|
|
||
| when: | ||
| def model = factory.buildModel(data) | ||
|
|
@@ -61,7 +65,9 @@ class CosmoTimeBasedWeatherValueFactoryTest extends Specification { | |
| "directIrradiance" : "286.872985839844", | ||
| "temperature" : "278.019012451172", | ||
| "windDirection" : "0", | ||
| "windVelocity" : "1.66103506088257" | ||
| "windVelocity" : "1.66103506088257", | ||
| "groundTemperatureLevel1" : "", | ||
| "groundTemperatureLevel2" : "" | ||
| ] | ||
|
Comment on lines
+68
to
71
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. format |
||
|
|
||
| def data = new TimeBasedWeatherValueData(parameter, coordinate) | ||
|
|
@@ -72,7 +78,9 @@ class CosmoTimeBasedWeatherValueFactoryTest extends Specification { | |
| Quantities.getQuantity(282.671997070312d, StandardUnits.SOLAR_IRRADIANCE), | ||
| Quantities.getQuantity(278.019012451172d, StandardUnits.TEMPERATURE), | ||
| Quantities.getQuantity(0d, StandardUnits.WIND_DIRECTION), | ||
| Quantities.getQuantity(1.66103506088257d, StandardUnits.WIND_VELOCITY))) | ||
| Quantities.getQuantity(1.66103506088257d, StandardUnits.WIND_VELOCITY), | ||
| Optional.of(Quantities.getQuantity(278.019012451172d, StandardUnits.TEMPERATURE)), | ||
| Optional.of(Quantities.getQuantity(278.019012451172d, StandardUnits.TEMPERATURE)))) | ||
|
Comment on lines
+82
to
+83
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not correct. see #1470 |
||
|
|
||
| when: | ||
| def model = factory.buildModel(data) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.