calculate sum of the precipitation amount instead of determining the maximum when interval values are calculated form hourly values

This commit is contained in:
Starfish
2025-06-28 09:05:05 +02:00
parent 405223b9f0
commit 22dbf824cf
4 changed files with 23 additions and 3 deletions

View File

@@ -5,6 +5,8 @@
- the button to change to the nearest station is not displayed when data is not present but being re-loaded
- when the uv hazard index is set to "clear sky", the uv hazard index icon in the main view now indicates this by displaying a tiny "C" in the upper-right corner of the icon
- fixed rain radar film not starting properly when app is resumed and the rain radar data is still valid
- exclude exact matches of onset/expiry of weather warnings with start/stop of the time period from being displayed in the ForecastAdapter
- calculate sum of the precipitation amount instead of determining the maximum when interval values are calculated form hourly values
## Version 0.62.9
- added an option to allow the overview chart to start above 0°

View File

@@ -330,7 +330,7 @@ public class CurrentWeatherInfo{
wi.setPrecipitation(getDoubleItem(rawWeatherInfo.RR6c[index]));
if (!wi.hasPrecipitation()) {
// try to self-calculate this
wi.setPrecipitation(rawWeatherInfo.getMaxDoubleValue(rawWeatherInfo.RR1c, start, index));
wi.setPrecipitation(rawWeatherInfo.getSumDouble(rawWeatherInfo.RR1c, start, index));
}
wi.setProbPrecipitation(getIntItem(rawWeatherInfo.wwP6[index]));
if (!wi.hasProbPrecipitation()) {
@@ -432,7 +432,7 @@ public class CurrentWeatherInfo{
wi.setPrecipitation(getDoubleItem(rawWeatherInfo.RRdc[index]));
if (!wi.hasPrecipitation()){
// try to self-calculate this
wi.setPrecipitation(rawWeatherInfo.getMaxDoubleValue(rawWeatherInfo.RR1c, start,index));
wi.setPrecipitation(rawWeatherInfo.getSumDouble(rawWeatherInfo.RR1c, start,index));
}
wi.setProbPrecipitation(getIntItem(rawWeatherInfo.wwPd[index]));
if (!wi.hasProbPrecipitation()){

View File

@@ -503,7 +503,6 @@ public View getView(int i, View view, ViewGroup viewGroup) {
setVisibility(precipitation_unit_lower, View.GONE);
}
}
//precipitation_string = precipitation_string +">"+weatherInfo.getUvHazardIndex()+"<";
if (precipitation_string.equals("")){
setVisibility(precipitation_symbol,View.GONE);
setVisibility(precipitation_textview,View.GONE);

View File

@@ -458,6 +458,25 @@ public class RawWeatherInfo{
return null;
}
public Double getSumDouble(String[] item, int first, int last){
if (first<0){
first = 0;
}
if (last>elements){
last = elements;
}
double[] itemlist = toDoubleArray(item);
double result = 0;
if (itemlist!=null){
for (int i=first; i<=last; i++){
result = result + itemlist[i];
}
return result;
}
return null;
}
public Integer getMaxIntValue(String[] item, int first, int last){
if (first<0){
first = 0;