From c6afcc0e75447b6b5acd3202bbf91e187639819c Mon Sep 17 00:00:00 2001 From: Marco Dalla Tiezza Date: Sat, 1 Jun 2024 11:48:27 +0200 Subject: [PATCH] Added Aurora Forecast Model --- artemis.qrc | 1 + artemis/resources.py | 189 +++++++++++++++++++++++++--------- artemis/ui/spaceweather.py | 4 + ui/SpaceWeather.qml | 9 ++ ui/SpaceWeatherAuroraPage.qml | 49 +++++++++ 5 files changed, 204 insertions(+), 48 deletions(-) create mode 100644 ui/SpaceWeatherAuroraPage.qml diff --git a/artemis.qrc b/artemis.qrc index 4567b95..2da6b0e 100644 --- a/artemis.qrc +++ b/artemis.qrc @@ -39,6 +39,7 @@ ui/SpaceWeatherCurrentPage.qml ui/SpaceWeatherForecastPage.qml ui/SpaceWeatherDRAPPage.qml + ui/SpaceWeatherAuroraPage.qml ui/About.qml diff --git a/artemis/resources.py b/artemis/resources.py index 3a6dc14..ad8b69d 100644 --- a/artemis/resources.py +++ b/artemis/resources.py @@ -5961,42 +5961,43 @@ Text\x0d\x0a \ .WordWrap\x0d\x0a \ }\x0d\x0a }\x0d\x0a}\x0d\x0a\ \ -\x00\x00\x02\x19\ +\x00\x00\x02*\ \x00\ -\x00\x07\x87x\xda\xbdT\xddk\xdb0\x10\x7f\x0f\xe4\x7f\ -\x10}j\x1f\xe6\xa5\x8510\xf4!\xcd\x18+\xb4\x90\ -.\x85<+\xf69\x16\x95%O:\x93d\xc3\xff\xfb\ -\xf4a%\xb6\xe3lM\xcbv\xf8A\xba\xfb\xdd\xdd\xef\ ->,V\x94R!y\xc2\xa7\x8a%/\xe3\x11\xeb\xdc\ -\xa3%\x13\xa9\xdc\x1c\xa9gR\xa0\x92\x5c\x9f4D\x8f\ -\x14A1\xca\x8f\x10\x0ft'+4\x9e\xe3\x91\x0fN\ -~\x8dG\xc4\x08Kc\xb2q\x9aEI\x13X\x02\xc5\ -\x1c\x94\xc5Y\xeb\x86\xa5\x98\xc7\xe4z2\x99xE\x0e\ -l\x9dcL>[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xb7j\x93\x9f)\ +Q\xe6\xd2\xcb\xb1\xcf\xfdo\x8d\xbb\xf5\xccV\xb6\xa7~\ +d\xe8\x1ck\xef\xb1\xaf\xd1\xb1O\xe9Ex\x0c\xf2\xa4\ +\xea\xeaK\x8fG]B\x9f@ Q\xdav\xe5\x10\x8f\ +Z[\xf6\xc6\x83\xb4f\xa5vU\x9d\x94\xfa\xb0\xea?\ +S\x7fU\x1abf\xd0\xbcE\xf2/\xdf\xa7\xf3\xb7\xc8\ +;-\xb5\xd2\xec\x1f2W\xfd\xd1/\x90\xc5/\xc3\xd2\ +q+\xf6\x83\xbe\x97\x09l\x83\x14h\xdb\xf8\xc7+\xff\ +\xd6\xbcl\xfe\xce_\xaf\x8d{\xfb\x90\x9c\x1aC\xfb\x89\ +md\xd1\xff\xf8\x87Tm\x86\xc3\x86\x83\xaa\xc1\xb9\xbe\ +\x9eg\xd0\xd8\xb9D\xdbq\xef\xc3\xd4\x09\xf6\x5c\x96!\ +\xe6}\x18z\xe9\x9f\xcb\xf1\x10u\x0e\xcb\x13\xc7j\xff\ +\xf7c\x7f\xbf\x01\x0fJ\x0a\x01\ \x00\x00\x08\xdf\ \x00\ \x00[\x00x\xda\xed\x5cmo\xdb\xb6\x16\xfe>`\xff\ @@ -6249,6 +6250,91 @@ n4\xcd\xc2\xae\xe4\xb4\xef\xb9m\xaf\xc4\xc0;\x8a\xd6\ \xfc\x9e\x95V\xdc&\xfe\x9f\x95\xb5\xbd*\xef\xa7+\xf3\ +\xff\xe7\xa8\xca\xf4\xf7=k\xaa\xfa\x1b\xe4\xbfp\xab\ \xb0\xf1\xdd\x13\xc2\xff\x7f\x00&\x9a\x88\xe6\ +\x00\x00\x05%\ +i\ +mport QtQuick\x0d\x0ai\ +mport QtQuick.Wi\ +ndow\x0d\x0aimport QtQ\ +uick.Controls\x0d\x0ai\ +mport QtQuick.Co\ +ntrols.Material\x0d\ +\x0aimport QtQuick.\ +Layouts\x0d\x0a\x0d\x0a\x0d\x0aPag\ +e {\x0d\x0a id: spa\ +ceWeatherAurora\x0d\ +\x0a anchors.fil\ +l: parent\x0d\x0a\x0d\x0a \ + objectName: \x22sp\ +aceWeatherAurora\ +Obj\x22\x0d\x0a\x0d\x0a func\ +tion loadAuroraR\ +eport() {\x0d\x0a \ + checkUrlExist\ +s(\x22https://www.a\ +resvalley.com/po\ +seidon_engine/au\ +rora.png\x22, funct\ +ion(exists) {\x0d\x0a \ + if (e\ +xists) {\x0d\x0a \ + imageB\ +ox.source = \x22htt\ +ps://www.aresval\ +ley.com/poseidon\ +_engine/aurora.p\ +ng\x22\x0d\x0a \ + } else {\x0d\x0a \ + image\ +Box.source = \x22qr\ +c:///images/arte\ +mis_not_availabl\ +e.svg\x22\x0d\x0a \ + }\x0d\x0a }\ +)\x0d\x0a }\x0d\x0a\x0d\x0a \ +function checkUr\ +lExists(url, cal\ +lback) {\x0d\x0a \ + var xhr = new \ +XMLHttpRequest()\ +\x0d\x0a xhr.on\ +readystatechange\ + = function() {\x0d\ +\x0a if \ +(xhr.readyState \ +=== XMLHttpReque\ +st.DONE) {\x0d\x0a \ + call\ +back(xhr.status \ +=== 200)\x0d\x0a \ + }\x0d\x0a \ + }\x0d\x0a xhr.\ +open(\x22HEAD\x22, url\ +, true)\x0d\x0a \ + xhr.send()\x0d\x0a \ + }\x0d\x0a\x0d\x0a Column\ +Layout {\x0d\x0a \ + anchors.fill: \ +parent\x0d\x0a \ +anchors.rightMar\ +gin: 20\x0d\x0a \ + anchors.leftMar\ +gin: 20\x0d\x0a \ + anchors.bottomM\ +argin: 20\x0d\x0a \ + anchors.topMa\ +rgin: 20\x0d\x0a\x0d\x0a \ + Image {\x0d\x0a \ + id: ima\ +geBox\x0d\x0a \ + Layout.fillHe\ +ight: true\x0d\x0a \ + Layout.f\ +illWidth: true\x0d\x0a\ + fill\ +Mode: Image.Pres\ +erveAspectFit\x0d\x0a \ + }\x0d\x0a }\x0d\ +\x0a}\x0d\x0a\ \x00\x00\x03\xf0\ \x00\ \x00\x0f\xd5x\xda\xddWQo\xdb6\x10~/\xd0\xff\ @@ -7007,6 +7093,11 @@ qt_resource_name = b"\ \x09\x22a\xfc\ \x00D\ \x00b\x00M\x00a\x00n\x00a\x00g\x00e\x00r\x00.\x00q\x00m\x00l\ +\x00\x1a\ +\x0f\x8fy|\ +\x00S\ +\x00p\x00a\x00c\x00e\x00W\x00e\x00a\x00t\x00h\x00e\x00r\x00A\x00u\x00r\x00o\x00r\ +\x00a\x00P\x00a\x00g\x00e\x00.\x00q\x00m\x00l\ \x00\x0f\ \x0e^\x1a\x9c\ \x00P\ @@ -7044,7 +7135,7 @@ qt_resource_name = b"\ qt_resource_struct = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x01\ \x00\x00\x00\x00\x00\x00\x00\x00\ -\x00\x00\x00\x00\x00\x02\x00\x00\x00\x10\x00\x00\x00\x19\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x11\x00\x00\x00\x19\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x0a\x00\x02\x00\x00\x00\x05\x00\x00\x00\x03\ \x00\x00\x00\x00\x00\x00\x00\x00\ @@ -7102,35 +7193,37 @@ qt_resource_struct = b"\ \x00\x00\x01\x8f\xcb\x84\x8f\xb2\ \x00\x00\x03\x18\x00\x01\x00\x00\x00\x01\x00\x01;\xcf\ \x00\x00\x01\x8f\xcb\x849\xd5\ -\x00\x00\x05J\x00\x00\x00\x00\x00\x01\x00\x01\x95N\ +\x00\x00\x05\x84\x00\x00\x00\x00\x00\x01\x00\x01\x9a\x88\ \x00\x00\x01\x8f\xcb\x83\x89\xfd\ \x00\x00\x03N\x00\x01\x00\x00\x00\x01\x00\x01E\xbf\ \x00\x00\x01\x8f\xcb\x86T\x18\ -\x00\x00\x05(\x00\x00\x00\x00\x00\x01\x00\x01\x8f\x9f\ +\x00\x00\x05b\x00\x00\x00\x00\x00\x01\x00\x01\x94\xd9\ \x00\x00\x01\x8f\xc8\xd7c\x19\ -\x00\x00\x034\x00\x02\x00\x00\x00\x04\x00\x00\x00)\ +\x00\x00\x034\x00\x02\x00\x00\x00\x04\x00\x00\x00*\ \x00\x00\x00\x00\x00\x00\x00\x00\ -\x00\x00\x04\xa0\x00\x01\x00\x00\x00\x01\x00\x01rI\ +\x00\x00\x04\xa0\x00\x01\x00\x00\x00\x01\x00\x01rZ\ \x00\x00\x01\x8f\xc8\xd7c\x19\ -\x00\x00\x05\x06\x00\x01\x00\x00\x00\x01\x00\x01\x85\xc1\ +\x00\x00\x05@\x00\x01\x00\x00\x00\x01\x00\x01\x8a\xfb\ \x00\x00\x01\x8f\xc8\xd7c\x19\ -\x00\x00\x04\xc2\x00\x01\x00\x00\x00\x01\x00\x01{,\ +\x00\x00\x04\xc2\x00\x01\x00\x00\x00\x01\x00\x01{=\ \x00\x00\x01\x8f\xcb\x83z\xd6\ \x00\x00\x04$\x00\x01\x00\x00\x00\x01\x00\x01^\xa5\ \x00\x00\x01\x8f\xcb\x84\xd9\xfc\ \x00\x00\x04R\x00\x00\x00\x00\x00\x01\x00\x01jg\ \x00\x00\x01\x8f\xc8\xd7c\x19\ \x00\x00\x04z\x00\x01\x00\x00\x00\x01\x00\x01p,\ -\x00\x00\x01\x8f\xcf4qQ\ -\x00\x00\x04\xe2\x00\x01\x00\x00\x00\x01\x00\x01\x81\xcd\ +\x00\x00\x01\x8f\xd301\xb9\ +\x00\x00\x05\x1c\x00\x01\x00\x00\x00\x01\x00\x01\x87\x07\ \x00\x00\x01\x8f\xcb\x85\x05&\ -\x00\x00\x05~\x00\x01\x00\x00\x00\x01\x00\x01\x9e\x01\ +\x00\x00\x04\xe2\x00\x00\x00\x00\x00\x01\x00\x01\x81\xde\ +\x00\x00\x01\x8f\xd3.\xfb<\ +\x00\x00\x05\xb8\x00\x01\x00\x00\x00\x01\x00\x01\xa3;\ \x00\x00\x01\x8f\xc8\xd7c\x19\ -\x00\x00\x05\xc6\x00\x01\x00\x00\x00\x01\x00\x01\xa3\xfe\ +\x00\x00\x06\x00\x00\x01\x00\x00\x00\x01\x00\x01\xa98\ \x00\x00\x01\x8f\xc8\xd7c\x19\ -\x00\x00\x05b\x00\x01\x00\x00\x00\x01\x00\x01\x9a\xfe\ +\x00\x00\x05\x9c\x00\x01\x00\x00\x00\x01\x00\x01\xa08\ \x00\x00\x01\x8f\xc8\xd7c\x19\ -\x00\x00\x05\xa2\x00\x01\x00\x00\x00\x01\x00\x01\xa0\xc0\ +\x00\x00\x05\xdc\x00\x01\x00\x00\x00\x01\x00\x01\xa5\xfa\ \x00\x00\x01\x8f\xc8\xd7c\x19\ " diff --git a/artemis/ui/spaceweather.py b/artemis/ui/spaceweather.py index 507086c..89ed78f 100644 --- a/artemis/ui/spaceweather.py +++ b/artemis/ui/spaceweather.py @@ -13,6 +13,7 @@ class UIspaceweather(QObject): load_poseidon_report = Signal(dict) load_poseidon_forecast_report = Signal(dict) load_poseidon_drap_report = Signal(dict) + load_aurora_report = Signal() update_bottom_bar = Signal(str) @@ -28,6 +29,7 @@ class UIspaceweather(QObject): self._window_current = self._window.findChild(QObject, "spaceWeatherCurrentObj") self._window_forecast = self._window.findChild(QObject, "spaceWeatherForecastObj") self._window_drap = self._window.findChild(QObject, "spaceWeatherDRAPObj") + self._window_aurora = self._window.findChild(QObject, "spaceWeatherAuroraObj") self._connect() @@ -41,6 +43,7 @@ class UIspaceweather(QObject): self.load_poseidon_report.connect(self._window_current.loadReport) self.load_poseidon_forecast_report.connect(self._window_forecast.loadForecastReport) self.load_poseidon_drap_report.connect(self._window_drap.loadDrapReport) + self.load_aurora_report.connect(self._window_aurora.loadAuroraReport) def load_spaceweather_ui(self): @@ -59,6 +62,7 @@ class UIspaceweather(QObject): self.load_poseidon_report.emit(poseidon_data) self.load_poseidon_forecast_report.emit(poseidon_data) self.load_poseidon_drap_report.emit(poseidon_data) + self.load_aurora_report.emit() self.update_bottom_bar.emit( 'Loaded Poseidon report issued on {} at {} UTC'.format( diff --git a/ui/SpaceWeather.qml b/ui/SpaceWeather.qml index 1f24a46..b9368e9 100644 --- a/ui/SpaceWeather.qml +++ b/ui/SpaceWeather.qml @@ -53,6 +53,9 @@ Window { TabButton { text: qsTr("DRAP") } + TabButton { + text: qsTr("Aurora") + } } StackLayout { @@ -77,6 +80,12 @@ Window { id: spaceWeatherDRAPPage } } + + Item { + SpaceWeatherAuroraPage { + id: spaceWeatherAuroraPage + } + } } } } diff --git a/ui/SpaceWeatherAuroraPage.qml b/ui/SpaceWeatherAuroraPage.qml new file mode 100644 index 0000000..b25dccb --- /dev/null +++ b/ui/SpaceWeatherAuroraPage.qml @@ -0,0 +1,49 @@ +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts + + +Page { + id: spaceWeatherAurora + anchors.fill: parent + + objectName: "spaceWeatherAuroraObj" + + function loadAuroraReport() { + checkUrlExists("https://www.aresvalley.com/poseidon_engine/aurora.png", function(exists) { + if (exists) { + imageBox.source = "https://www.aresvalley.com/poseidon_engine/aurora.png" + } else { + imageBox.source = "qrc:///images/artemis_not_available.svg" + } + }) + } + + function checkUrlExists(url, callback) { + var xhr = new XMLHttpRequest() + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + callback(xhr.status === 200) + } + } + xhr.open("HEAD", url, true) + xhr.send() + } + + ColumnLayout { + anchors.fill: parent + anchors.rightMargin: 20 + anchors.leftMargin: 20 + anchors.bottomMargin: 20 + anchors.topMargin: 20 + + Image { + id: imageBox + Layout.fillHeight: true + Layout.fillWidth: true + fillMode: Image.PreserveAspectFit + } + } +}