-
Notifications
You must be signed in to change notification settings - Fork 5
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?
add ground temperature 1m as option to weather data #1351
Conversation
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.
Didn't get to all of it. Just a first view thoughts that imho needs to be adapted. As well it might get easier since it would reduce the amount of changes.
src/test/groovy/edu/ie3/test/helper/WeatherSourceTestHelper.groovy
Outdated
Show resolved
Hide resolved
src/main/java/edu/ie3/datamodel/io/factory/timeseries/CosmoTimeBasedWeatherValueFactory.java
Outdated
Show resolved
Hide resolved
src/main/java/edu/ie3/datamodel/io/factory/timeseries/IconTimeBasedWeatherValueFactory.java
Outdated
Show resolved
Hide resolved
...t/groovy/edu/ie3/datamodel/io/factory/timeseries/IconTimeBasedWeatherValueFactoryTest.groovy
Outdated
Show resolved
Hide resolved
src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvWeatherSourceIconTest.groovy
Outdated
Show resolved
Hide resolved
src/main/java/edu/ie3/datamodel/io/factory/timeseries/CosmoTimeBasedWeatherValueFactory.java
Outdated
Show resolved
Hide resolved
…eatherValueFactory and IconTimeBasedWeatherValueFactory
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.
This looks already quite ok, but I guess some parts can be improved.
Set<String> withGroundTemp = expandSet(minConstructorParams, GROUND_TEMPERATURE); | ||
|
||
return List.of(minConstructorParams, withGroundTemp); |
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.
What will happen if there are no ground temperatures and one calls this method?
private static final Logger logger = | ||
LoggerFactory.getLogger(CosmoTimeBasedWeatherValueFactory.class); |
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.
What does logger log in this class?
import tech.units.indriya.ComparableQuantity; | ||
|
||
/** Describes a ground temperature value. */ | ||
public class GroundTemperatureValue implements Value { |
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.
I think you can reuse many parts from TemperatureValue
if you make GroundTemperatureValue
extending from it.
ComparableQuantity<Temperature> groundTemperature = null; | ||
try { | ||
groundTemperature = | ||
data.getQuantity(GROUND_TEMPERATURE, Units.KELVIN).to(StandardUnits.TEMPERATURE); | ||
} catch (IllegalArgumentException ignored) { | ||
} | ||
|
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.
same as for cosmo
src/main/java/edu/ie3/datamodel/io/factory/timeseries/IconTimeBasedWeatherValueFactory.java
Show resolved
Hide resolved
private static final Logger logger = | ||
LoggerFactory.getLogger(IconTimeBasedWeatherValueFactory.class); |
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.
Same for logger here
ComparableQuantity<Temperature> groundTemperature = null; | ||
try { | ||
groundTemperature = data.getQuantity(GROUND_TEMPERATURE, StandardUnits.TEMPERATURE); | ||
} catch (IllegalArgumentException ignored) { | ||
|
||
} |
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.
In my opinion this is a bit counterintuitive. The advantage of try is that one get's a result of the try. But we ignore this.
But first, please change to Optional<ComparableQuantity<Tempearture>>
. And then it should be possible to try to get the quantity from data, as for the others, and wrap it into some Optional.ofNullable, or similar.
Resolves #1343