Skip to content
Snippets Groups Projects
Commit 77a86245 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

fix: total height bar interval error

parent 4682be73
No related branches found
No related tags found
1 merge request!16Clhp map into main
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
import '../../consts.dart'; import '../consts.dart';
import '../../utils/format_month.dart'; import '../utils/format_month.dart';
class BarData extends StatefulWidget { class BarData extends StatefulWidget {
const BarData({super.key}); const BarData({super.key});
...@@ -17,7 +17,7 @@ class _BarDataState extends State<BarData> { ...@@ -17,7 +17,7 @@ class _BarDataState extends State<BarData> {
// Allocate bar data dynamically from selected subdivision // Allocate bar data dynamically from selected subdivision
var barData = <int, List<double>>{}; var barData = <int, List<double>>{};
double totalHeight = 0; double totalHeight = 0.5; // Set minimum total height
int touchedIndex = -1; int touchedIndex = -1;
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
import 'graph_data/bar_data.dart'; import 'bar_data.dart';
import '../../consts.dart'; import '../../consts.dart';
class StatCharts extends StatelessWidget { class StatCharts extends StatelessWidget {
......
This diff is collapsed.
No preview for this file type
[ [
{ {
"MeasurementID": 0, "MeasurementID": 0,
"TimeMeasured": "2024-05-10 17:15:30.613745", "TimeMeasured": "2024-05-10 17:25:05.053204",
"CenterLat": 60.9845, "CenterLat": 60.9845,
"CenterLon": 10.1182, "CenterLon": 10.1182,
"Sensor": { "Sensor": {
...@@ -2774,7 +2774,7 @@ ...@@ -2774,7 +2774,7 @@
}, },
{ {
"MeasurementID": 1, "MeasurementID": 1,
"TimeMeasured": "2024-05-10 17:15:57.931723", "TimeMeasured": "2024-05-10 17:25:19.479987",
"CenterLat": 60.807, "CenterLat": 60.807,
"CenterLon": 10.8159, "CenterLon": 10.8159,
"Sensor": { "Sensor": {
...@@ -5547,7 +5547,7 @@ ...@@ -5547,7 +5547,7 @@
}, },
{ {
"MeasurementID": 2, "MeasurementID": 2,
"TimeMeasured": "2024-05-10 17:16:20.615158", "TimeMeasured": "2024-05-10 17:25:37.464410",
"CenterLat": 60.4017, "CenterLat": 60.4017,
"CenterLon": 10.0447, "CenterLon": 10.0447,
"Sensor": { "Sensor": {
...@@ -8320,7 +8320,7 @@ ...@@ -8320,7 +8320,7 @@
}, },
{ {
"MeasurementID": 3, "MeasurementID": 3,
"TimeMeasured": "2024-05-10 17:16:46.638331", "TimeMeasured": "2024-05-10 17:25:51.310935",
"CenterLat": 60.7814, "CenterLat": 60.7814,
"CenterLon": 10.5861, "CenterLon": 10.5861,
"Sensor": { "Sensor": {
...@@ -11093,7 +11093,7 @@ ...@@ -11093,7 +11093,7 @@
}, },
{ {
"MeasurementID": 4, "MeasurementID": 4,
"TimeMeasured": "2024-05-10 17:17:09.160680", "TimeMeasured": "2024-05-10 17:26:04.816382",
"CenterLat": 60.1757, "CenterLat": 60.1757,
"CenterLon": 10.9742, "CenterLon": 10.9742,
"Sensor": { "Sensor": {
...@@ -13866,7 +13866,7 @@ ...@@ -13866,7 +13866,7 @@
}, },
{ {
"MeasurementID": -1, "MeasurementID": -1,
"TimeMeasured": "2024-05-10 17:17:42.794895", "TimeMeasured": "2024-05-10 17:26:27.206420",
"CenterLat": null, "CenterLat": null,
"CenterLon": null, "CenterLon": null,
"Sensor": null, "Sensor": null,
...@@ -13879,7 +13879,7 @@ ...@@ -13879,7 +13879,7 @@
"CenLatitude": 60.5795, "CenLatitude": 60.5795,
"CenLongitude": 11.2231, "CenLongitude": 11.2231,
"Accuracy": 1, "Accuracy": 1,
"Color": 4278245119, "Color": 4287401100,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -14155,7 +14155,7 @@ ...@@ -14155,7 +14155,7 @@
"CenLatitude": 60.4425, "CenLatitude": 60.4425,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4294928896, "Color": 4294901760,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -14247,7 +14247,7 @@ ...@@ -14247,7 +14247,7 @@
"CenLatitude": 60.4523, "CenLatitude": 60.4523,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4287401100, "Color": 4289855232,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -14339,7 +14339,7 @@ ...@@ -14339,7 +14339,7 @@
"CenLatitude": 60.4605, "CenLatitude": 60.4605,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4294928896, "Color": 4287401100,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -14615,7 +14615,7 @@ ...@@ -14615,7 +14615,7 @@
"CenLatitude": 60.4712, "CenLatitude": 60.4712,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4294928896, "Color": 4294901760,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -14799,7 +14799,7 @@ ...@@ -14799,7 +14799,7 @@
"CenLatitude": 60.4761, "CenLatitude": 60.4761,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4278245119, "Color": 4287401100,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -14891,7 +14891,7 @@ ...@@ -14891,7 +14891,7 @@
"CenLatitude": 60.5053, "CenLatitude": 60.5053,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4294901760, "Color": 4294928896,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -15075,7 +15075,7 @@ ...@@ -15075,7 +15075,7 @@
"CenLatitude": 60.5213, "CenLatitude": 60.5213,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4278245119, "Color": 4287401100,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -15167,7 +15167,7 @@ ...@@ -15167,7 +15167,7 @@
"CenLatitude": 60.5339, "CenLatitude": 60.5339,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4294928896, "Color": 4278245119,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -15259,7 +15259,7 @@ ...@@ -15259,7 +15259,7 @@
"CenLatitude": 60.5567, "CenLatitude": 60.5567,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4278245119, "Color": 4294901760,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -15351,7 +15351,7 @@ ...@@ -15351,7 +15351,7 @@
"CenLatitude": 60.5795, "CenLatitude": 60.5795,
"CenLongitude": 11.2389, "CenLongitude": 11.2389,
"Accuracy": 1, "Accuracy": 1,
"Color": 4294928896, "Color": 4278245119,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -15535,7 +15535,7 @@ ...@@ -15535,7 +15535,7 @@
"CenLatitude": 60.5903, "CenLatitude": 60.5903,
"CenLongitude": 11.2838, "CenLongitude": 11.2838,
"Accuracy": 1, "Accuracy": 1,
"Color": 4278245119, "Color": 4294928896,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
...@@ -15627,7 +15627,7 @@ ...@@ -15627,7 +15627,7 @@
"CenLatitude": 60.6024, "CenLatitude": 60.6024,
"CenLongitude": 11.2838, "CenLongitude": 11.2838,
"Accuracy": 1, "Accuracy": 1,
"Color": 4294901760, "Color": 4278245119,
"IceStats": [ "IceStats": [
{ {
"Date": "2024-05-07", "Date": "2024-05-07",
......
...@@ -67,7 +67,17 @@ def update_measurements(self, lake_name: str): ...@@ -67,7 +67,17 @@ def update_measurements(self, lake_name: str):
# Increase accuracy by 1 if the LiDar data and NVE data have a minimal discrepancy # Increase accuracy by 1 if the LiDar data and NVE data have a minimal discrepancy
if abs(avg_thickness - ice_stats[0]['Total ice (m)']) < 1.0: if abs(avg_thickness - ice_stats[0]['Total ice (m)']) < 1.0:
accuracy = 4 accuracy = 4
else: # Failed to retrieve ice statistics else: # Failed to retrieve ice statistics, initialise empty ice stats object
ice_stats = {
"Date": "NA",
"Slush ice (m)": 0,
"Black ice (m)": 0,
"Total ice (m)": 0,
"Snow depth (m)": 0.0,
"Total snow (m)": 0.0,
"Cloud cover": 0.0,
"Temperature (c)": 0.0
}
accuracy = 2 accuracy = 2
# Create new subdivision object # Create new subdivision object
...@@ -167,7 +177,18 @@ def fill_remaining_subdivisions(lake_name: str, processed_ids: list): ...@@ -167,7 +177,18 @@ def fill_remaining_subdivisions(lake_name: str, processed_ids: list):
if len(ice_stats) > 0 and len(ice_stats[0]) > 0: if len(ice_stats) > 0 and len(ice_stats[0]) > 0:
total_ice_thickness = ice_stats[0]['Total ice (m)'] total_ice_thickness = ice_stats[0]['Total ice (m)']
accuracy = 1 accuracy = 1
else: else: # Initialise empty ice stats
ice_stats = {
"Date": "NA",
"Slush ice (m)": 0,
"Black ice (m)": 0,
"Total ice (m)": 0,
"Snow depth (m)": 0.0,
"Total snow (m)": 0.0,
"Cloud cover": 0.0,
"Temperature (c)": 0.0
}
total_ice_thickness = 0 total_ice_thickness = 0
accuracy = 0 accuracy = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment