mirror of
https://github.com/dotFionn/iassure-wx.git
synced 2026-03-21 06:22:56 -05:00
Compare commits
17 Commits
7e67950966
...
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| d8432315d5 | |||
| 7cd8ea9d50 | |||
|
|
80c961da81 | ||
|
|
79e559a723 | ||
|
|
80a354b456 | ||
|
|
407f817c8d | ||
|
|
759e4c3711 | ||
| 8460445381 | |||
| 131acbf75c | |||
| 627a39c02e | |||
| 248ac6620a | |||
| 37db228cdd | |||
| 2d7d2f5b5c | |||
| cd77081009 | |||
| b9a91a59a2 | |||
| 561cf13eb8 | |||
| f9fc7f2490 |
@@ -1,2 +1,2 @@
|
||||
.git
|
||||
node_modules
|
||||
**/node_modules
|
||||
@@ -8,7 +8,7 @@ steps:
|
||||
settings:
|
||||
dockerfile: Dockerfile
|
||||
registry: git.fsisp.de
|
||||
repo: git.fsisp.de/fionn/isasure-wx
|
||||
repo: git.fsisp.de/fionn/iassure-wx
|
||||
username:
|
||||
from_secret: reg_username
|
||||
password:
|
||||
@@ -20,6 +20,7 @@ steps:
|
||||
trigger:
|
||||
branch:
|
||||
- dev
|
||||
- develop
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
@@ -32,7 +33,7 @@ steps:
|
||||
settings:
|
||||
dockerfile: Dockerfile
|
||||
registry: git.fsisp.de
|
||||
repo: git.fsisp.de/fionn/isasure-wx
|
||||
repo: git.fsisp.de/fionn/iassure-wx
|
||||
username:
|
||||
from_secret: reg_username
|
||||
password:
|
||||
|
||||
21
README.md
21
README.md
@@ -1,7 +1,18 @@
|
||||
# TypeScript Project Template
|
||||
# IASsure-WX
|
||||
|
||||
## preparation
|
||||
## idea
|
||||
|
||||
```sh
|
||||
npm install -g eslint eslint-config-airbnb-typescript eslint-plugin-import eslint-plugin-n eslint-plugin-promise
|
||||
```
|
||||
This service is designed to gather weather data to be used by [IASsure](https://github.com/MorpheusXAUT/IASsure) by [MorpheusXAUT](https://github.com/MorpheusXAUT). It uses the [Open-Meteo.com](https://open-meteo.com)-API to gather the necessary data to provide to the plugin.
|
||||
|
||||
## Installation/Deployment
|
||||
|
||||
IASsure-WX can be installed using docker. The image is available at `git.fsisp.de/fionn/iassure-wx`.
|
||||
|
||||
Tags:
|
||||
- `latest` - The newest recommended build, built from `main`
|
||||
- `dev` - The newest development/staging build, built from `develop`
|
||||
- Other than those tags, every image is tagged with the git commit id
|
||||
|
||||
## Configuration
|
||||
|
||||
IASsure-WX can be configured using the `wx-config.json`-file. For now it contains test data but will include production data for at least the Langen FIR. It necessary, another file can be mounted on top of it (`/opt/wx-config.json`). You may also choose to make the necessary changes to the file in this repository. The file is documented in the schema definition file (`wx-config.schema.json`).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "app",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
|
||||
@@ -4,14 +4,14 @@ import morgan from 'morgan';
|
||||
import router from './router';
|
||||
import wxService from './services/wx.service';
|
||||
|
||||
const { PORT = 3000 } = process.env;
|
||||
const { PORT = 3000, BASE_PATH = '/api' } = process.env;
|
||||
|
||||
const app = express();
|
||||
|
||||
app.set('trust proxy', true);
|
||||
app.use(morgan('combined'));
|
||||
|
||||
app.use('/api', router.router);
|
||||
app.use(BASE_PATH, router.router);
|
||||
|
||||
const frontendRoot = '/opt/frontend/dist';
|
||||
app.use(express.static(frontendRoot));
|
||||
@@ -28,8 +28,24 @@ app.use((err, req: Request, res: Response, next: NextFunction) => {
|
||||
nodesched.scheduleJob('regenerate data', '*/30 * * * * *', wxService.wrappedGenerateData)
|
||||
wxService.wrappedGenerateData();
|
||||
|
||||
app.listen(PORT, () => {
|
||||
const server = app.listen(PORT, () => {
|
||||
console.log(
|
||||
`application is listening on port ${PORT}`,
|
||||
);
|
||||
});
|
||||
|
||||
const shutdown = (signal: string) => {
|
||||
console.log(`${signal} signal received. Shutting down.`);
|
||||
server.close((err) => {
|
||||
if (err) {
|
||||
console.error(`Failed to shut down server gracefully: ${err}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('Server closed');
|
||||
process.exit(0);
|
||||
});
|
||||
};
|
||||
|
||||
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
||||
process.on('SIGINT', () => shutdown('SIGINT'));
|
||||
|
||||
@@ -54,6 +54,7 @@ export interface WxData {
|
||||
info: {
|
||||
date: string;
|
||||
datestring: string;
|
||||
legal: string;
|
||||
};
|
||||
data: {
|
||||
[key: string]: WxFixData;
|
||||
@@ -80,8 +81,8 @@ export async function getDataAtFix(fix: WxFix, index: number): Promise<WxFixData
|
||||
|
||||
for(const [qnh, fl] of Object.entries(qnhLevelMapping)) {
|
||||
const temp = Number(hourlyData?.[`temperature_${qnh}hPa`]?.[index]) + 273.15;
|
||||
const dir = hourlyData?.[`windspeed_${qnh}hPa`]?.[index];
|
||||
const speed = hourlyData?.[`winddirection_${qnh}hPa`]?.[index];
|
||||
const dir = hourlyData?.[`winddirection_${qnh}hPa`]?.[index];
|
||||
const speed = hourlyData?.[`windspeed_${qnh}hPa`]?.[index];
|
||||
|
||||
data.levels[String(fl)] = {
|
||||
"T(K)": String(temp),
|
||||
@@ -103,6 +104,7 @@ export async function generateData() {
|
||||
info: {
|
||||
date: now.toISOString(),
|
||||
datestring: `${now.getUTCDate()}${now.getUTCHours()}`,
|
||||
legal: "Weather data by Open-Meteo.com (https://open-meteo.com)"
|
||||
},
|
||||
data: {}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,7 @@ services:
|
||||
args:
|
||||
- NODE_ENV=development
|
||||
ports:
|
||||
- '3030:3030/tcp'
|
||||
- '3030:3000/tcp'
|
||||
- '9229:9229/tcp'
|
||||
volumes:
|
||||
- .:/opt:delegated
|
||||
environment:
|
||||
- MONGO_URI
|
||||
- PORT=3030
|
||||
20
utils/convert-csv-to-json.js
Normal file
20
utils/convert-csv-to-json.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* This script can be used to convert a csv-file to the json format required by the wx-config.json
|
||||
*
|
||||
* the csv needs to follow the following format: <FIX>,<LAT>,<LON>
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const points = fs
|
||||
.readFileSync('./fixes.csv')
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map(str => str.split(','))
|
||||
.map(data => ({
|
||||
name: data[0],
|
||||
lat: Number(data[1]),
|
||||
lon: Number(data[2]),
|
||||
}));
|
||||
|
||||
fs.writeFileSync('./fixes.json', JSON.stringify(points, undefined, 2));
|
||||
443
wx-config.json
443
wx-config.json
@@ -32,17 +32,452 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "LOVV",
|
||||
"identifier": "EDXX",
|
||||
"fixes": [
|
||||
{
|
||||
"name": "RDG",
|
||||
"lat": 49.040139,
|
||||
"lon": 12.526625
|
||||
},
|
||||
{
|
||||
"name": "OTT",
|
||||
"lat": 48.180394,
|
||||
"lon": 11.816536
|
||||
},
|
||||
{
|
||||
"name": "LNZ",
|
||||
"lat": 48.229711,
|
||||
"lon": 14.103156
|
||||
},
|
||||
{
|
||||
"name": "VOZ",
|
||||
"lat": 49.532328,
|
||||
"lon": 14.874664
|
||||
},
|
||||
{
|
||||
"name": "MASUR",
|
||||
"lat": 48.520097,
|
||||
"lon": 15.439292
|
||||
},
|
||||
{
|
||||
"name": "VATET",
|
||||
"lat": 47.600953,
|
||||
"lon": 14.033119
|
||||
},
|
||||
{
|
||||
"name": "LNZ",
|
||||
"lat": 48.229711,
|
||||
"lon": 14.103156
|
||||
"name": "INSEL",
|
||||
"lat": 47.155556,
|
||||
"lon": 12.405278
|
||||
},
|
||||
{
|
||||
"name": "TRA",
|
||||
"lat": 47.6895,
|
||||
"lon": 8.436972
|
||||
},
|
||||
{
|
||||
"name": "NAXAV",
|
||||
"lat": 46.463856,
|
||||
"lon": 11.322183
|
||||
},
|
||||
{
|
||||
"name": "HOC",
|
||||
"lat": 47.466556,
|
||||
"lon": 7.665444
|
||||
},
|
||||
{
|
||||
"name": "LUPEN",
|
||||
"lat": 48.435053,
|
||||
"lon": 7.733622
|
||||
},
|
||||
{
|
||||
"name": "LADAT",
|
||||
"lat": 49.265256,
|
||||
"lon": 7.839472
|
||||
},
|
||||
{
|
||||
"name": "GTQ",
|
||||
"lat": 48.986444,
|
||||
"lon": 6.716222
|
||||
},
|
||||
{
|
||||
"name": "VALEK",
|
||||
"lat": 49.514444,
|
||||
"lon": 5.781111
|
||||
},
|
||||
{
|
||||
"name": "LNO",
|
||||
"lat": 50.585833,
|
||||
"lon": 5.710278
|
||||
},
|
||||
{
|
||||
"name": "BUB",
|
||||
"lat": 50.902333,
|
||||
"lon": 4.538083
|
||||
},
|
||||
{
|
||||
"name": "OKIDU",
|
||||
"lat": 51.7894,
|
||||
"lon": 4.85
|
||||
},
|
||||
{
|
||||
"name": "SPY",
|
||||
"lat": 52.540278,
|
||||
"lon": 4.853778
|
||||
},
|
||||
{
|
||||
"name": "NAPRO",
|
||||
"lat": 51.855833,
|
||||
"lon": 6.058889
|
||||
},
|
||||
{
|
||||
"name": "RKN",
|
||||
"lat": 52.133194,
|
||||
"lon": 6.763889
|
||||
},
|
||||
{
|
||||
"name": "EEL",
|
||||
"lat": 53.164167,
|
||||
"lon": 6.66675
|
||||
},
|
||||
{
|
||||
"name": "EDUBU",
|
||||
"lat": 54.183333,
|
||||
"lon": 6.5
|
||||
},
|
||||
{
|
||||
"name": "TIPAN",
|
||||
"lat": 54.598369,
|
||||
"lon": 4.398944
|
||||
},
|
||||
{
|
||||
"name": "AMADA",
|
||||
"lat": 55,
|
||||
"lon": 6.35
|
||||
},
|
||||
{
|
||||
"name": "BAVTA",
|
||||
"lat": 55.603056,
|
||||
"lon": 8.3
|
||||
},
|
||||
{
|
||||
"name": "ODN",
|
||||
"lat": 55.581011,
|
||||
"lon": 10.652989
|
||||
},
|
||||
{
|
||||
"name": "ERNOV",
|
||||
"lat": 56.168861,
|
||||
"lon": 12.573778
|
||||
},
|
||||
{
|
||||
"name": "TIDVU",
|
||||
"lat": 55.411306,
|
||||
"lon": 13.557528
|
||||
},
|
||||
{
|
||||
"name": "LUSID",
|
||||
"lat": 54.916667,
|
||||
"lon": 15.296111
|
||||
},
|
||||
{
|
||||
"name": "VAVUN",
|
||||
"lat": 53.475278,
|
||||
"lon": 15.333056
|
||||
},
|
||||
{
|
||||
"name": "DENKO",
|
||||
"lat": 52.816861,
|
||||
"lon": 15.8325
|
||||
},
|
||||
{
|
||||
"name": "KELOD",
|
||||
"lat": 52.233889,
|
||||
"lon": 15.883333
|
||||
},
|
||||
{
|
||||
"name": "VELAB",
|
||||
"lat": 51.469722,
|
||||
"lon": 16.748889
|
||||
},
|
||||
{
|
||||
"name": "LAGAR",
|
||||
"lat": 50.795275,
|
||||
"lon": 15.367089
|
||||
},
|
||||
{
|
||||
"name": "ELMEK",
|
||||
"lat": 49.9039,
|
||||
"lon": 14.029875
|
||||
},
|
||||
{
|
||||
"name": "BRENO",
|
||||
"lat": 46.98,
|
||||
"lon": 11.376667
|
||||
},
|
||||
{
|
||||
"name": "ALG",
|
||||
"lat": 47.997381,
|
||||
"lon": 10.262189
|
||||
},
|
||||
{
|
||||
"name": "LBU",
|
||||
"lat": 48.912975,
|
||||
"lon": 9.340228
|
||||
},
|
||||
{
|
||||
"name": "DKB",
|
||||
"lat": 49.142753,
|
||||
"lon": 10.238306
|
||||
},
|
||||
{
|
||||
"name": "SULUS",
|
||||
"lat": 50.075192,
|
||||
"lon": 10.728808
|
||||
},
|
||||
{
|
||||
"name": "BAMKI",
|
||||
"lat": 50.718064,
|
||||
"lon": 11.020208
|
||||
},
|
||||
{
|
||||
"name": "KOJEC",
|
||||
"lat": 51.512719,
|
||||
"lon": 11.50445
|
||||
},
|
||||
{
|
||||
"name": "OSKAN",
|
||||
"lat": 51.460847,
|
||||
"lon": 13.627669
|
||||
},
|
||||
{
|
||||
"name": "MAREM",
|
||||
"lat": 50.715467,
|
||||
"lon": 13.628808
|
||||
},
|
||||
{
|
||||
"name": "ABERU",
|
||||
"lat": 50.069194,
|
||||
"lon": 12.093719
|
||||
},
|
||||
{
|
||||
"name": "LAMSI",
|
||||
"lat": 48.653353,
|
||||
"lon": 13.583442
|
||||
},
|
||||
{
|
||||
"name": "SBG",
|
||||
"lat": 47.967533,
|
||||
"lon": 12.894072
|
||||
},
|
||||
{
|
||||
"name": "ERKIR",
|
||||
"lat": 47.537778,
|
||||
"lon": 12.008889
|
||||
},
|
||||
{
|
||||
"name": "WLD",
|
||||
"lat": 48.579419,
|
||||
"lon": 11.129386
|
||||
},
|
||||
{
|
||||
"name": "UPALA",
|
||||
"lat": 49.214372,
|
||||
"lon": 11.221436
|
||||
},
|
||||
{
|
||||
"name": "SUL",
|
||||
"lat": 48.381586,
|
||||
"lon": 8.644836
|
||||
},
|
||||
{
|
||||
"name": "KRH",
|
||||
"lat": 48.992944,
|
||||
"lon": 8.584236
|
||||
},
|
||||
{
|
||||
"name": "UMDAS",
|
||||
"lat": 49.395864,
|
||||
"lon": 8.824181
|
||||
},
|
||||
{
|
||||
"name": "COSJE",
|
||||
"lat": 49.717531,
|
||||
"lon": 9.947
|
||||
},
|
||||
{
|
||||
"name": "BOMBI",
|
||||
"lat": 50.056667,
|
||||
"lon": 8.800278
|
||||
},
|
||||
{
|
||||
"name": "UBIDU",
|
||||
"lat": 50.073333,
|
||||
"lon": 7.906389
|
||||
},
|
||||
{
|
||||
"name": "UMUPU",
|
||||
"lat": 50.558611,
|
||||
"lon": 7.431389
|
||||
},
|
||||
{
|
||||
"name": "BITBU",
|
||||
"lat": 49.98295,
|
||||
"lon": 6.561628
|
||||
},
|
||||
{
|
||||
"name": "NVO",
|
||||
"lat": 50.822675,
|
||||
"lon": 6.636533
|
||||
},
|
||||
{
|
||||
"name": "GMH",
|
||||
"lat": 51.170511,
|
||||
"lon": 7.892039
|
||||
},
|
||||
{
|
||||
"name": "DODEN",
|
||||
"lat": 50.602256,
|
||||
"lon": 8.09325
|
||||
},
|
||||
{
|
||||
"name": "DEMAB",
|
||||
"lat": 50.541111,
|
||||
"lon": 9.955833
|
||||
},
|
||||
{
|
||||
"name": "MAPOX",
|
||||
"lat": 51.133611,
|
||||
"lon": 8.813889
|
||||
},
|
||||
{
|
||||
"name": "RIMET",
|
||||
"lat": 51.333889,
|
||||
"lon": 10.219444
|
||||
},
|
||||
{
|
||||
"name": "PIROT",
|
||||
"lat": 52.053431,
|
||||
"lon": 9.236903
|
||||
},
|
||||
{
|
||||
"name": "HMM",
|
||||
"lat": 51.856867,
|
||||
"lon": 7.708294
|
||||
},
|
||||
{
|
||||
"name": "DIBIR",
|
||||
"lat": 51.276944,
|
||||
"lon": 6.124444
|
||||
},
|
||||
{
|
||||
"name": "BASUM",
|
||||
"lat": 52.771989,
|
||||
"lon": 8.788539
|
||||
},
|
||||
{
|
||||
"name": "MADOR",
|
||||
"lat": 52.566667,
|
||||
"lon": 9.9525
|
||||
},
|
||||
{
|
||||
"name": "HLZ",
|
||||
"lat": 52.363394,
|
||||
"lon": 10.795219
|
||||
},
|
||||
{
|
||||
"name": "MAG",
|
||||
"lat": 51.994989,
|
||||
"lon": 11.794306
|
||||
},
|
||||
{
|
||||
"name": "KLF",
|
||||
"lat": 52.019353,
|
||||
"lon": 13.563414
|
||||
},
|
||||
{
|
||||
"name": "KORUP",
|
||||
"lat": 51.583056,
|
||||
"lon": 14.738056
|
||||
},
|
||||
{
|
||||
"name": "SUBIX",
|
||||
"lat": 52.379722,
|
||||
"lon": 14.585556
|
||||
},
|
||||
{
|
||||
"name": "KETAP",
|
||||
"lat": 52.927853,
|
||||
"lon": 13.654947
|
||||
},
|
||||
{
|
||||
"name": "OGBER",
|
||||
"lat": 52.613889,
|
||||
"lon": 12.724722
|
||||
},
|
||||
{
|
||||
"name": "BKD",
|
||||
"lat": 53.034525,
|
||||
"lon": 11.546217
|
||||
},
|
||||
{
|
||||
"name": "HAM",
|
||||
"lat": 53.685575,
|
||||
"lon": 10.204997
|
||||
},
|
||||
{
|
||||
"name": "WSN",
|
||||
"lat": 53.347169,
|
||||
"lon": 8.874733
|
||||
},
|
||||
{
|
||||
"name": "DHE",
|
||||
"lat": 54.185686,
|
||||
"lon": 7.9107
|
||||
},
|
||||
{
|
||||
"name": "ATTUS",
|
||||
"lat": 54.899722,
|
||||
"lon": 8.782778
|
||||
},
|
||||
{
|
||||
"name": "ALASA",
|
||||
"lat": 54.808611,
|
||||
"lon": 9.961667
|
||||
},
|
||||
{
|
||||
"name": "BAGOS",
|
||||
"lat": 54.572778,
|
||||
"lon": 11.27
|
||||
},
|
||||
{
|
||||
"name": "ROBUS",
|
||||
"lat": 55.109444,
|
||||
"lon": 11.719722
|
||||
},
|
||||
{
|
||||
"name": "BANKU",
|
||||
"lat": 54.795833,
|
||||
"lon": 12.935278
|
||||
},
|
||||
{
|
||||
"name": "UMSET",
|
||||
"lat": 54.833056,
|
||||
"lon": 14.158611
|
||||
},
|
||||
{
|
||||
"name": "POBOX",
|
||||
"lat": 54.158889,
|
||||
"lon": 14.094167
|
||||
},
|
||||
{
|
||||
"name": "FLD",
|
||||
"lat": 53.762736,
|
||||
"lon": 13.563136
|
||||
},
|
||||
{
|
||||
"name": "TAGOB",
|
||||
"lat": 53.734772,
|
||||
"lon": 11.833056
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user