diff --git a/Display/angular.json b/Display/angular.json index 4819390..8fdcdc9 100644 --- a/Display/angular.json +++ b/Display/angular.json @@ -40,7 +40,6 @@ "highcharts/modules/exporting", "highcharts/modules/windbarb", "moment-duration-format", - "regression", "socket.io-client", "socket.io-parser" ] diff --git a/Display/package-lock.json b/Display/package-lock.json index df3f876..8cfe827 100644 --- a/Display/package-lock.json +++ b/Display/package-lock.json @@ -1810,11 +1810,6 @@ "integrity": "sha1-vShOV8hPEyXacCur/IKlMoGQwMU=", "dev": true }, - "@types/regression": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/regression/-/regression-2.0.0.tgz", - "integrity": "sha512-Ch2FD53M1HpFLL6zSTc/sfuyqQcIPy+/PV3xFT6QYtk9EOiMI29XOYmLNxBb1Y0lfMOR/NNa86J1gRc/1jGLyw==" - }, "@types/selenium-webdriver": { "version": "3.0.17", "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-3.0.17.tgz", @@ -10206,11 +10201,6 @@ } } }, - "regression": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/regression/-/regression-2.0.1.tgz", - "integrity": "sha1-jSnD6CJKEIUMNeM36FqLL6w7DIc=" - }, "remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", diff --git a/Display/package.json b/Display/package.json index 22357fd..5a8bbc5 100644 --- a/Display/package.json +++ b/Display/package.json @@ -24,7 +24,6 @@ "@angular/router": "~10.0.1", "@aspnet/signalr": "^1.1.4", "@types/moment-duration-format": "^2.2.2", - "@types/regression": "^2.0.0", "@types/suncalc": "^1.8.0", "angular-gridster2": "^10.0.1", "angular-highcharts": "^9.0.11", @@ -33,7 +32,6 @@ "moment-duration-format": "^2.3.2", "ngx-moment": "^4.0.1", "ngx-socket-io": "^3.2.0", - "regression": "^2.0.1", "rxjs": "~6.5.5", "suncalc": "^1.8.0", "tslib": "^2.0.0", diff --git a/Display/src/app/components/weather/current/weather-current.component.html b/Display/src/app/components/weather/current/weather-current.component.html index ae3a483..52fae3e 100644 --- a/Display/src/app/components/weather/current/weather-current.component.html +++ b/Display/src/app/components/weather/current/weather-current.component.html @@ -13,6 +13,22 @@ {{ latestReading.PressureTemperature.toFixed(2) }}°F + + + Heat Index + + + {{ latestReading.HeatIndex.toFixed(2) }}°F + + + + + Wind Chill + + + {{ latestReading.WindChill.toFixed(2) }}°F + + Humidity @@ -21,6 +37,14 @@ {{ latestReading.Humidity.toFixed(2) }}% + + + Dew point + + + {{ latestReading.DewPoint.toFixed(2) }}°F + + Pressure @@ -28,7 +52,7 @@ {{ (latestReading.Pressure / 33.864 / 100).toFixed(2) }}" - + diff --git a/Display/src/app/components/weather/current/weather-current.component.ts b/Display/src/app/components/weather/current/weather-current.component.ts index 18b9838..465f098 100644 --- a/Display/src/app/components/weather/current/weather-current.component.ts +++ b/Display/src/app/components/weather/current/weather-current.component.ts @@ -1,11 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { WeatherReading } from 'src/app/models/weather/weather-reading'; import { WeatherService } from 'src/app/services/weather/weather.service'; -import { WeatherValueType } from 'src/app/models/weather/weather-value-type'; -import { WeatherValue } from 'src/app/models/weather/weather-value'; - -import * as moment from 'moment'; -import * as regression from 'regression'; @Component({ selector: 'app-weather-current', @@ -13,57 +8,28 @@ import * as regression from 'regression'; styleUrls: ['./weather-current.component.scss'] }) export class WeatherCurrentComponent implements OnInit { - public pressureDifference: number = null; public latestReading: WeatherReading; constructor(private weatherService: WeatherService) { } ngOnInit() { - this.update(); - - setInterval(() => this.update(), 60000); - this.weatherService.getLatestReading().subscribe(r => this.latestReading = r); } - async update() { - this.pressureDifference = null; - - const end: moment.Moment = moment(); - const start: moment.Moment = moment(end).subtract(3, 'hours'); - - const weatherData = await this.weatherService.getReadingValueHistory(WeatherValueType.Pressure, start, end); - - if (!weatherData) { - return; - } - - const points: [number, number][] = []; - - weatherData.forEach((weatherValue: WeatherValue) => { - const point: [number, number] = [moment(weatherValue.timestamp).unix(), weatherValue.value / 100]; - points.push(point); - }); - - const result = regression.linear(points, { precision: 10 }); - - const regressionPoints = result.points; - - this.pressureDifference = regressionPoints[regressionPoints.length - 1][1] - regressionPoints[0][1]; - } - rotationClass(): string { - if (!this.pressureDifference) { + const pressureDifference = this.latestReading.PressureTrend; + + if (!pressureDifference) { return ''; - } else if (Math.abs(this.pressureDifference) <= 1.0) { + } else if (Math.abs(pressureDifference) <= 1.0) { return ''; - } else if (this.pressureDifference > 1.0 && this.pressureDifference <= 2.0) { + } else if (pressureDifference > 1.0 && pressureDifference <= 2.0) { return 'up-low'; - } else if (this.pressureDifference > 2.0) { + } else if (pressureDifference > 2.0) { return 'up-high'; - } else if (this.pressureDifference < -1.0 && this.pressureDifference >= -2.0) { + } else if (pressureDifference < -1.0 && pressureDifference >= -2.0) { return 'down-low'; - } else if (this.pressureDifference < -2.0) { + } else if (pressureDifference < -2.0) { return 'down-high'; } } diff --git a/Display/src/app/models/weather/weather-reading.ts b/Display/src/app/models/weather/weather-reading.ts index 1790659..66987f0 100644 --- a/Display/src/app/models/weather/weather-reading.ts +++ b/Display/src/app/models/weather/weather-reading.ts @@ -16,4 +16,8 @@ export class WeatherReading { Altitude: number; SatelliteCount: number; GpsTimestamp: Date; + WindChill: number; + HeatIndex: number; + DewPoint: number; + PressureTrend: number; }