atmosx-nwws-parser 1.0.185 → 1.0.201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -86
- package/dist/cjs/bootstrap.cjs +1000 -0
- package/dist/cjs/database.cjs +1105 -0
- package/dist/cjs/dictionaries/awips.cjs +370 -0
- package/dist/cjs/dictionaries/events.cjs +139 -0
- package/dist/cjs/dictionaries/icao.cjs +265 -0
- package/dist/cjs/dictionaries/offshore.cjs +40 -0
- package/dist/cjs/dictionaries/signatures.cjs +132 -0
- package/dist/cjs/eas.cjs +2851 -0
- package/dist/cjs/helper.cjs +3008 -0
- package/dist/cjs/parsers/events.cjs +2851 -0
- package/dist/cjs/parsers/stanza.cjs +1099 -0
- package/dist/cjs/parsers/text.cjs +1133 -0
- package/dist/cjs/parsers/types/api.cjs +2851 -0
- package/dist/cjs/parsers/types/cap.cjs +2851 -0
- package/dist/cjs/parsers/types/text.cjs +2851 -0
- package/dist/cjs/parsers/types/ugc.cjs +2851 -0
- package/dist/cjs/parsers/types/vtec.cjs +2851 -0
- package/dist/cjs/parsers/ugc.cjs +1130 -0
- package/dist/cjs/parsers/vtec.cjs +1051 -0
- package/dist/cjs/types.cjs +17 -0
- package/dist/cjs/utils.cjs +2851 -0
- package/dist/cjs/xmpp.cjs +2851 -0
- package/dist/esm/bootstrap.mjs +963 -0
- package/dist/esm/database.mjs +1070 -0
- package/dist/esm/dictionaries/awips.mjs +346 -0
- package/dist/esm/dictionaries/events.mjs +111 -0
- package/dist/esm/dictionaries/icao.mjs +241 -0
- package/dist/esm/dictionaries/offshore.mjs +16 -0
- package/dist/esm/dictionaries/signatures.mjs +106 -0
- package/dist/esm/eas.mjs +2818 -0
- package/dist/esm/helper.mjs +2968 -0
- package/dist/esm/parsers/events.mjs +2818 -0
- package/dist/esm/parsers/stanza.mjs +1063 -0
- package/dist/esm/parsers/text.mjs +1097 -0
- package/dist/esm/parsers/types/api.mjs +2818 -0
- package/dist/esm/parsers/types/cap.mjs +2818 -0
- package/dist/esm/parsers/types/text.mjs +2818 -0
- package/dist/esm/parsers/types/ugc.mjs +2818 -0
- package/dist/esm/parsers/types/vtec.mjs +2818 -0
- package/dist/esm/parsers/ugc.mjs +1095 -0
- package/dist/esm/parsers/vtec.mjs +1016 -0
- package/dist/esm/types.mjs +0 -0
- package/dist/esm/utils.mjs +2818 -0
- package/dist/esm/xmpp.mjs +2818 -0
- package/package.json +47 -29
- package/src/bootstrap.ts +171 -0
- package/src/database.ts +99 -0
- package/src/dictionaries/awips.ts +342 -0
- package/src/dictionaries/events.ts +109 -0
- package/src/dictionaries/icao.ts +237 -0
- package/src/dictionaries/offshore.ts +12 -0
- package/src/dictionaries/signatures.ts +103 -0
- package/src/eas.ts +428 -0
- package/src/helper.ts +167 -0
- package/src/parsers/events.ts +289 -0
- package/src/parsers/stanza.ts +103 -0
- package/src/parsers/text.ts +167 -0
- package/src/parsers/types/api.ts +94 -0
- package/src/parsers/types/cap.ts +89 -0
- package/src/parsers/types/text.ts +54 -0
- package/src/parsers/types/ugc.ts +85 -0
- package/src/parsers/types/vtec.ts +60 -0
- package/src/parsers/ugc.ts +148 -0
- package/src/parsers/vtec.ts +66 -0
- package/src/types.ts +187 -0
- package/src/utils.ts +217 -0
- package/src/xmpp.ts +123 -0
- package/test.js +1 -36
- package/tsconfig.json +14 -0
- package/tsup.config.ts +11 -0
- package/bootstrap.js +0 -112
- package/index.js +0 -264
- package/src/events.js +0 -339
- package/src/stanza.js +0 -105
- package/src/text.js +0 -108
- package/src/ugc.js +0 -115
- package/src/vtec.js +0 -89
package/package.json
CHANGED
|
@@ -1,29 +1,47 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "atmosx-nwws-parser",
|
|
3
|
+
"version": "1.0.201",
|
|
4
|
+
"description": "NOAA Weather Wire Parser - Built for standalone and Project AtmosphericX Integration.",
|
|
5
|
+
"main": "dist/cjs/helper.cjs",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/K3YOMI/atmosx-nwws-parser.git",
|
|
9
|
+
"branch": "beta"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "cd ./test && node ./index.js",
|
|
13
|
+
"build:tsup": "tsup && cd ./test && node ./index.js",
|
|
14
|
+
"publish": "tsup && npm publish --access public",
|
|
15
|
+
"publish-beta": "tsup && npm publish --tag beta --access public"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"NWWS",
|
|
19
|
+
"NOAA Weather Wire Service",
|
|
20
|
+
"TypeScript",
|
|
21
|
+
"XMPP",
|
|
22
|
+
"Parser",
|
|
23
|
+
"JavaScript",
|
|
24
|
+
"CommonJS",
|
|
25
|
+
"ESM"
|
|
26
|
+
],
|
|
27
|
+
"author": "k3yomi, StarflightWx",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/K3YOMI/atmosx-nwws-parser/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/K3YOMI/atmosx-nwws-parser#readme",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@xmpp/client": "^0.7.3",
|
|
35
|
+
"axios": "^1.12.2",
|
|
36
|
+
"better-sqlite3": "^11.10.0",
|
|
37
|
+
"node-cron": "^4.2.1",
|
|
38
|
+
"say": "^0.16.0",
|
|
39
|
+
"shapefile": "^0.6.6",
|
|
40
|
+
"typescript": "^5.9.2",
|
|
41
|
+
"xml2js": "^0.6.2"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^24.5.2",
|
|
45
|
+
"tsup": "^8.5.0"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/bootstrap.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
11
|
+
Written by: k3yomi@GitHub
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import * as fs from 'fs';
|
|
16
|
+
import * as path from 'path';
|
|
17
|
+
import * as events from 'events';
|
|
18
|
+
import * as xmpp from '@xmpp/client';
|
|
19
|
+
import * as shapefile from 'shapefile';
|
|
20
|
+
import * as xml2js from 'xml2js';
|
|
21
|
+
import * as cron from 'node-cron';
|
|
22
|
+
import sqlite3 from 'better-sqlite3';
|
|
23
|
+
import axios from 'axios';
|
|
24
|
+
import crypto from 'crypto';
|
|
25
|
+
import os from 'os';
|
|
26
|
+
import say from 'say';
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
import * as dictEvents from './dictionaries/events';
|
|
30
|
+
import * as dictOffshore from './dictionaries/offshore';
|
|
31
|
+
import * as dictAwips from './dictionaries/awips';
|
|
32
|
+
import * as dictSignatures from './dictionaries/signatures';
|
|
33
|
+
import * as dictICAOs from './dictionaries/icao';
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export const packages = {
|
|
37
|
+
fs,
|
|
38
|
+
path,
|
|
39
|
+
events,
|
|
40
|
+
xmpp,
|
|
41
|
+
shapefile,
|
|
42
|
+
xml2js,
|
|
43
|
+
sqlite3,
|
|
44
|
+
cron,
|
|
45
|
+
axios,
|
|
46
|
+
crypto,
|
|
47
|
+
os,
|
|
48
|
+
say
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const cache = {
|
|
52
|
+
isReady: true,
|
|
53
|
+
sigHalt: false,
|
|
54
|
+
isConnected: false,
|
|
55
|
+
attemptingReconnect: false,
|
|
56
|
+
totalReconnects: 0,
|
|
57
|
+
lastStanza: null,
|
|
58
|
+
session: null,
|
|
59
|
+
lastConnect: null,
|
|
60
|
+
db: null,
|
|
61
|
+
events: new events.EventEmitter(),
|
|
62
|
+
isProcessingAudioQueue: false,
|
|
63
|
+
audioQueue: []
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const settings = {
|
|
67
|
+
database: path.join(process.cwd(), 'shapefiles.db'),
|
|
68
|
+
isNWWS: true,
|
|
69
|
+
NoaaWeatherWireService: {
|
|
70
|
+
clientReconnections: {
|
|
71
|
+
canReconnect: true,
|
|
72
|
+
currentInterval: 60,
|
|
73
|
+
},
|
|
74
|
+
clientCredentials: {
|
|
75
|
+
username: null,
|
|
76
|
+
password: null,
|
|
77
|
+
nickname: "AtmosphericX Standalone Parser",
|
|
78
|
+
},
|
|
79
|
+
cache: {
|
|
80
|
+
read: false,
|
|
81
|
+
maxSizeMB: 5,
|
|
82
|
+
maxHistory: 5000,
|
|
83
|
+
directory: null,
|
|
84
|
+
},
|
|
85
|
+
alertPreferences: {
|
|
86
|
+
isCapOnly: false,
|
|
87
|
+
isShapefileUGC: false,
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
NationalWeatherService: {
|
|
91
|
+
checkInterval: 15,
|
|
92
|
+
endpoint: "https://api.weather.gov/alerts/active",
|
|
93
|
+
},
|
|
94
|
+
global: {
|
|
95
|
+
useParentEvents: true,
|
|
96
|
+
betterEventParsing: true,
|
|
97
|
+
alertFiltering: {
|
|
98
|
+
filteredEvents: [],
|
|
99
|
+
filteredICOAs: [],
|
|
100
|
+
ignoredICOAs: [`KWNS`],
|
|
101
|
+
ignoredEvents: [`Xx`, `Test Message`],
|
|
102
|
+
ugcFilter: [],
|
|
103
|
+
stateFilter: [],
|
|
104
|
+
checkExpired: true,
|
|
105
|
+
},
|
|
106
|
+
easSettings: {
|
|
107
|
+
easAlerts: [],
|
|
108
|
+
easDirectory: null,
|
|
109
|
+
easIntroWav: null,
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
export const definitions = {
|
|
116
|
+
events: dictEvents.EVENTS,
|
|
117
|
+
actions: dictEvents.ACTIONS,
|
|
118
|
+
status: dictEvents.STATUS,
|
|
119
|
+
productTypes: dictEvents.TYPES,
|
|
120
|
+
correlations: dictEvents.STATUS_CORRELATIONS,
|
|
121
|
+
offshore: dictOffshore.OFFSHORE,
|
|
122
|
+
awips: dictAwips.AWIPS,
|
|
123
|
+
cancelSignatures: dictSignatures.CANCEL_SIGNATURES,
|
|
124
|
+
messageSignatures: dictSignatures.MESSAGE_SIGNATURES,
|
|
125
|
+
tags: dictSignatures.TAGS,
|
|
126
|
+
ICAO: dictICAOs.ICAOs,
|
|
127
|
+
enhancedEvents: [
|
|
128
|
+
{"Tornado Warning": {
|
|
129
|
+
"Tornado Emergency": { description: "tornado emergency", condition: (tornadoThreatTag: string) => tornadoThreatTag === 'OBSERVED'},
|
|
130
|
+
"PDS Tornado Warning": { description: "particularly dangerous situation", condition: (damageThreatTag: string) => damageThreatTag === 'CONSIDERABLE'},
|
|
131
|
+
"Confirmed Tornado Warning": { condition: (tornadoThreatTag: string) => tornadoThreatTag === 'OBSERVED'},
|
|
132
|
+
"Radar Indicated Tornado Warning": {condition: (tornadoThreatTag: string) => tornadoThreatTag !== 'OBSERVED'},
|
|
133
|
+
}},
|
|
134
|
+
{"Tornado Watch": {
|
|
135
|
+
"PDS Tornado Watch": { description: "particularly dangerous situation"}
|
|
136
|
+
}},
|
|
137
|
+
{"Flash Flood Warning": {
|
|
138
|
+
"Flash Flood Emergency": { description: "flash flood emergency", },
|
|
139
|
+
"Considerable Flash Flood Warning": { condition: (damageThreatTag: string) => damageThreatTag === 'CONSIDERABLE' },
|
|
140
|
+
}},
|
|
141
|
+
{"Severe Thunderstorm Warning": {
|
|
142
|
+
"EDS Severe Thunderstorm Warning": {description: "extremely dangerous situation"},
|
|
143
|
+
"Destructive Severe Thunderstorm Warning": {condition: (damageThreatTag: string) => damageThreatTag === 'DESTRUCTIVE'},
|
|
144
|
+
"Considerable Severe Thunderstorm Warning": {condition: (damageThreatTag: string) => damageThreatTag === 'CONSIDERABLE'},
|
|
145
|
+
}},
|
|
146
|
+
],
|
|
147
|
+
expressions: {
|
|
148
|
+
vtec: `[OTEX].(NEW|CON|EXT|EXA|EXB|UPG|CAN|EXP|COR|ROU).[A-Z]{4}.[A-Z]{2}.[WAYSFON].[0-9]{4}.[0-9]{6}T[0-9]{4}Z-[0-9]{6}T[0-9]{4}Z`,
|
|
149
|
+
wmo: `[A-Z0-9]{6}\\s[A-Z]{4}\\s\\d{6}`,
|
|
150
|
+
ugc1: `(\\w{2}[CZ](\\d{3}((-|>)\\s?(\n\n)?))+)`,
|
|
151
|
+
ugc2: `(\\d{6}(-|>)\\s?(\n\n)?)`,
|
|
152
|
+
ugc3: `(\\d{6})(?=-|$)`,
|
|
153
|
+
dateline: `/\d{3,4}\s*(AM|PM)?\s*[A-Z]{2,4}\s+[A-Z]{3,}\s+[A-Z]{3,}\s+\d{1,2}\s+\d{4}`,
|
|
154
|
+
wmoID: `[A-Z0-9]{2}([A-Z]{3})`,
|
|
155
|
+
},
|
|
156
|
+
shapefiles: [
|
|
157
|
+
{ id: `C`, file: `USCounties` },
|
|
158
|
+
{ id: `Z`, file: `ForecastZones` },
|
|
159
|
+
{ id: `Z`, file: `FireZones` },
|
|
160
|
+
{ id: `Z`, file: `OffShoreZones` },
|
|
161
|
+
{ id: `Z`, file: `FireCounties` },
|
|
162
|
+
{ id: `Z`, file: `Marine` }
|
|
163
|
+
],
|
|
164
|
+
messages: {
|
|
165
|
+
shapefile_creation: `[NOTICE] DO NOT CLOSE THIS PROJECT UNTIL THE SHAPEFILES ARE DONE COMPLETING!\n\t THIS COULD TAKE A WHILE DEPENDING ON THE SPEED OF YOUR STORAGE!!\n\t IF YOU CLOSE YOUR PROJECT, THE SHAPEFILES WILL NOT BE CREATED AND YOU WILL NEED TO DELETE ${settings.database} AND RESTART TO CREATE THEM AGAIN!`,
|
|
166
|
+
shapefile_creation_finished: `[NOTICE] SHAPEFILES HAVE BEEN SUCCESSFULLY CREATED AND THE DATABASE IS READY FOR USE!`,
|
|
167
|
+
not_ready: "[ERROR] You can NOT create another instance without shutting down the current one first, please make sure to call the stop() method first!",
|
|
168
|
+
invalid_nickname: "[WARNING] The nickname you provided is invalid, please provide a valid nickname to continue.",
|
|
169
|
+
eas_no_directory: "[WARNING] You have not set a directory for EAS audio files to be saved to, please set the 'easDirectory' setting in the global settings to enable EAS audio generation.",
|
|
170
|
+
}
|
|
171
|
+
};
|
package/src/database.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| "_ ` _ \ / _ \/ __| "_ \| "_ \ / _ \ "__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
11
|
+
Written by: KiyoWx (k3yomi)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import * as loader from './bootstrap';
|
|
16
|
+
import * as types from './types';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export class Database {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* handleAlertCache stores a unique alert in the SQLite database and ensures the total number of alerts does not exceed 5000.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
* @static
|
|
26
|
+
* @async
|
|
27
|
+
* @param {*} alert
|
|
28
|
+
* @returns {*}
|
|
29
|
+
*/
|
|
30
|
+
public static async stanzaCacheImport(stanza: string) {
|
|
31
|
+
const settings = loader.settings as types.ClientSettings;
|
|
32
|
+
loader.cache.db.prepare(`INSERT OR IGNORE INTO stanzas (stanza) VALUES (?)`).run(stanza);
|
|
33
|
+
const count = loader.cache.db.prepare(`SELECT COUNT(*) as total FROM stanzas`).get() as { total: number };
|
|
34
|
+
if (count.total > settings.NoaaWeatherWireService.cache.maxHistory) {
|
|
35
|
+
loader.cache.db.prepare(`DELETE FROM stanzas WHERE rowid IN (SELECT rowid FROM stanzas ORDER BY rowid ASC LIMIT ?)`).run(count.total - settings.NoaaWeatherWireService.cache.maxHistory / 2);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* loadDatabase initializes the SQLite database and imports shapefile data if the database or table does not exist.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
* @static
|
|
44
|
+
* @async
|
|
45
|
+
* @returns {Promise<void>}
|
|
46
|
+
*/
|
|
47
|
+
public static async loadDatabase(): Promise<void> {
|
|
48
|
+
const settings = loader.settings as types.ClientSettings;
|
|
49
|
+
try {
|
|
50
|
+
if (!loader.packages.fs.existsSync(settings.database)) { loader.packages.fs.writeFileSync(settings.database, ''); }
|
|
51
|
+
loader.cache.db = new loader.packages.sqlite3(settings.database);
|
|
52
|
+
const shapfileTable = loader.cache.db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='shapefiles'`).get();
|
|
53
|
+
const stanzaTable = loader.cache.db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='stanzas'`).get();
|
|
54
|
+
if (!stanzaTable) { loader.cache.db.prepare(`CREATE TABLE stanzas (id INTEGER PRIMARY KEY AUTOINCREMENT, stanza TEXT)`).run(); }
|
|
55
|
+
if (!shapfileTable) {
|
|
56
|
+
loader.cache.db.prepare(`CREATE TABLE shapefiles (id TEXT PRIMARY KEY, location TEXT, geometry TEXT)`).run();
|
|
57
|
+
console.log(loader.definitions.messages.shapefile_creation);
|
|
58
|
+
for (const shape of loader.definitions.shapefiles) {
|
|
59
|
+
const { id, file } = shape;
|
|
60
|
+
const filepath = loader.packages.path.join(__dirname, `../../shapefiles`, file);
|
|
61
|
+
const { features } = await loader.packages.shapefile.read(filepath, filepath);
|
|
62
|
+
console.log(`Importing ${features.length} entries from ${file}...`);
|
|
63
|
+
const insertStmt = loader.cache.db.prepare(`INSERT OR REPLACE INTO shapefiles (id, location, geometry)VALUES (?, ?, ?)`);
|
|
64
|
+
const insertTransaction = loader.cache.db.transaction((entries: any[]) => {
|
|
65
|
+
for (const feature of entries) {
|
|
66
|
+
const { properties, geometry } = feature;
|
|
67
|
+
let final: string, location: string;
|
|
68
|
+
switch (true) {
|
|
69
|
+
case !!properties.FIPS:
|
|
70
|
+
final = `${properties.STATE}${id}${properties.FIPS.substring(2)}`;
|
|
71
|
+
location = `${properties.COUNTYNAME}, ${properties.STATE}`;
|
|
72
|
+
break;
|
|
73
|
+
case !!properties.FULLSTAID:
|
|
74
|
+
final = `${properties.ST}${id}${properties.WFO}`;
|
|
75
|
+
location = `${properties.CITY}, ${properties.STATE}`;
|
|
76
|
+
break;
|
|
77
|
+
case !!properties.STATE:
|
|
78
|
+
final = `${properties.STATE}${id}${properties.ZONE}`;
|
|
79
|
+
location = `${properties.NAME}, ${properties.STATE}`;
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
final = properties.ID;
|
|
83
|
+
location = properties.NAME;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
insertStmt.run(final, location, JSON.stringify(geometry));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
await insertTransaction(features);
|
|
90
|
+
}
|
|
91
|
+
console.log(loader.definitions.messages.shapefile_creation_finished);
|
|
92
|
+
}
|
|
93
|
+
} catch (error: any) {
|
|
94
|
+
loader.cache.events.emit('onError', { code: 'error-load-database', message: `Failed to load database: ${error.message}`});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default Database;
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
export const AWIPS: Record<string, string> = {
|
|
2
|
+
ABV: `rawinsonde-data-above-100-millibars`,
|
|
3
|
+
ADA: `alarm-alert-administrative-message`,
|
|
4
|
+
ADM: `alert-administrative-message`,
|
|
5
|
+
ADR: `nws-administrative-message`,
|
|
6
|
+
ADV: `space-environment-advisory`,
|
|
7
|
+
AFD: `area-forecast-discussion`,
|
|
8
|
+
AFM: `area-forecast-matrices`,
|
|
9
|
+
AFP: `area-forecast-product`,
|
|
10
|
+
AFW: `fire-weather-matrix`,
|
|
11
|
+
AGF: `agricultural-forecast`,
|
|
12
|
+
AGO: `agricultural-observations`,
|
|
13
|
+
ALT: `space-environment-alert`,
|
|
14
|
+
AQA: `air-quality-alert`,
|
|
15
|
+
AQI: `air-quality-index-statement`,
|
|
16
|
+
ASA: `air-stagnation-advisory`,
|
|
17
|
+
AVA: `avalanche-watch`,
|
|
18
|
+
AVG: `avalanche-weather-guidance`,
|
|
19
|
+
AVW: `avalanche-warning`,
|
|
20
|
+
AWO: `area-weather-outlook`,
|
|
21
|
+
AWS: `area-weather-summary`,
|
|
22
|
+
AWU: `area-weather-update`,
|
|
23
|
+
AWW: `airport-weather-warning`,
|
|
24
|
+
BLU: `blue-alert`,
|
|
25
|
+
BOY: `buoy-report`,
|
|
26
|
+
BRG: `coast-guard-observations`,
|
|
27
|
+
BRT: `hourly-roundup-for-weather-radio`,
|
|
28
|
+
CAE: `child-abduction-emergency`,
|
|
29
|
+
CCF: `coded-city-forecast`,
|
|
30
|
+
CDW: `civil-danger-warning`,
|
|
31
|
+
CEM: `civil-emergency-message`,
|
|
32
|
+
CF6: `monthly-daily-climate-data`,
|
|
33
|
+
CFP: `convective-forecast-product`,
|
|
34
|
+
CFW: `coastal-flood-warnings-watches-statements`,
|
|
35
|
+
CGR: `coast-guard-surface-report`,
|
|
36
|
+
CHG: `computer-hurricane-guidance`,
|
|
37
|
+
CLA: `climatological-report-annual`,
|
|
38
|
+
CLI: `climatological-report-daily`,
|
|
39
|
+
CLM: `climatological-report-monthly`,
|
|
40
|
+
CLQ: `climatological-report-quarterly`,
|
|
41
|
+
CLS: `climatological-report-seasonal`,
|
|
42
|
+
CLT: `climate-report`,
|
|
43
|
+
CMM: `coded-climatological-monthly-means`,
|
|
44
|
+
COD: `coded-analysis-and-forecasts`,
|
|
45
|
+
CPF: `great-lakes-port-forecast`,
|
|
46
|
+
CUR: `space-environment-products-routine`,
|
|
47
|
+
CWA: `center-weather-advisory`,
|
|
48
|
+
CWF: `coastal-waters-forecast`,
|
|
49
|
+
CWS: `center-weather-statement`,
|
|
50
|
+
DAY: `space-environment-product-daily`,
|
|
51
|
+
DDO: `daily-dispersion-outlook`,
|
|
52
|
+
DGT: `drought-information-statement`,
|
|
53
|
+
DMO: `practice-demo-warning`,
|
|
54
|
+
DSA: `unnumbered-depression-advisory`,
|
|
55
|
+
DSM: `asos-daily-summary`,
|
|
56
|
+
DSW: `dust-storm-warning`,
|
|
57
|
+
EFP: `extended-forecast-3-to-5-day`,
|
|
58
|
+
EOL: `six-to-ten-day-weather-outlook-local`,
|
|
59
|
+
EQI: `tsunami-bulletin`,
|
|
60
|
+
EQR: `earthquake-report`,
|
|
61
|
+
EQW: `earthquake-warning`,
|
|
62
|
+
ESF: `flood-potential-outlook`,
|
|
63
|
+
ESG: `extended-streamflow-guidance`,
|
|
64
|
+
ESP: `extended-streamflow-prediction`,
|
|
65
|
+
ESS: `water-supply-outlook`,
|
|
66
|
+
EVI: `evacuation-immediate`,
|
|
67
|
+
EWW: `extreme-wind-warning`,
|
|
68
|
+
FA0: `aviation-area-forecast-pacific`,
|
|
69
|
+
FA1: `aviation-area-forecast-northeast`,
|
|
70
|
+
FA2: `aviation-area-forecast-southeast`,
|
|
71
|
+
FA3: `aviation-area-forecast-north-central`,
|
|
72
|
+
FA4: `aviation-area-forecast-south-central`,
|
|
73
|
+
FA5: `aviation-area-forecast-rocky-mountains`,
|
|
74
|
+
FA6: `aviation-area-forecast-west-coast`,
|
|
75
|
+
FA7: `aviation-area-forecast-juneau-ak`,
|
|
76
|
+
FA8: `aviation-area-forecast-anchorage-ak`,
|
|
77
|
+
FA9: `aviation-area-forecast-fairbanks-ak`,
|
|
78
|
+
FD0: `winds-aloft-forecast-24hr-high-altitude`,
|
|
79
|
+
FD1: `winds-aloft-forecast-6hr`,
|
|
80
|
+
FD2: `winds-aloft-forecast-12hr`,
|
|
81
|
+
FD3: `winds-aloft-forecast-24hr`,
|
|
82
|
+
FD4: `winds-aloft-forecast`,
|
|
83
|
+
FD5: `winds-aloft-forecast`,
|
|
84
|
+
FD6: `winds-aloft-forecast`,
|
|
85
|
+
FD7: `winds-aloft-forecast`,
|
|
86
|
+
FD8: `winds-aloft-forecast-6hr-high-altitude`,
|
|
87
|
+
FD9: `winds-aloft-forecast-12hr-high-altitude`,
|
|
88
|
+
FDI: `fire-danger-indices`,
|
|
89
|
+
FFA: `flash-flood-watch`,
|
|
90
|
+
FFG: `flash-flood-guidance`,
|
|
91
|
+
FFH: `headwater-guidance`,
|
|
92
|
+
FFS: `flash-flood-statement`,
|
|
93
|
+
FFW: `flash-flood-warning`,
|
|
94
|
+
FLN: `national-flood-summary`,
|
|
95
|
+
FLS: `flood-statement`,
|
|
96
|
+
FLW: `flood-warning`,
|
|
97
|
+
FOF: `upper-wind-fallout-forecast`,
|
|
98
|
+
FRW: `fire-warning`,
|
|
99
|
+
FSH: `marine-fisheries-service-message`,
|
|
100
|
+
FTM: `radar-outage-notification`,
|
|
101
|
+
FTP: `temp-pop-guidance`,
|
|
102
|
+
FWA: `fire-weather-administrative-message`,
|
|
103
|
+
FWD: `fire-weather-outlook-discussion`,
|
|
104
|
+
FWF: `fire-weather-forecast`,
|
|
105
|
+
FWL: `land-management-forecast`,
|
|
106
|
+
FWM: `miscellaneous-fire-weather-product`,
|
|
107
|
+
FWN: `fire-weather-notification`,
|
|
108
|
+
FWO: `fire-weather-observation`,
|
|
109
|
+
FWS: `fire-weather-spot-forecast`,
|
|
110
|
+
FZL: `freezing-level-data`,
|
|
111
|
+
GLF: `great-lakes-forecast`,
|
|
112
|
+
GLS: `great-lakes-storm-summary`,
|
|
113
|
+
GRE: `green`,
|
|
114
|
+
HD1: `rfc-qpf-data-product`,
|
|
115
|
+
HD2: `rfc-qpf-data-product`,
|
|
116
|
+
HD3: `rfc-qpf-data-product`,
|
|
117
|
+
HD4: `rfc-qpf-data-product`,
|
|
118
|
+
HD7: `rfc-qpf-data-product`,
|
|
119
|
+
HD8: `rfc-qpf-data-product`,
|
|
120
|
+
HD9: `rfc-qpf-data-product`,
|
|
121
|
+
HLS: `hurricane-local-statement`,
|
|
122
|
+
HMD: `hydrometeorological-discussion`,
|
|
123
|
+
HML: `ahps-xml-product`,
|
|
124
|
+
HMW: `hazardous-materials-warning`,
|
|
125
|
+
HP1: `rfc-qpf-verification-product`,
|
|
126
|
+
HP2: `rfc-qpf-verification-product`,
|
|
127
|
+
HP3: `rfc-qpf-verification-product`,
|
|
128
|
+
HP4: `rfc-qpf-verification-product`,
|
|
129
|
+
HP5: `rfc-qpf-verification-product`,
|
|
130
|
+
HP6: `rfc-qpf-verification-product`,
|
|
131
|
+
HP7: `rfc-qpf-verification-product`,
|
|
132
|
+
HP8: `rfc-qpf-verification-product`,
|
|
133
|
+
HRR: `weather-roundup`,
|
|
134
|
+
HSF: `high-seas-forecast`,
|
|
135
|
+
HWO: `hazardous-weather-outlook`,
|
|
136
|
+
HWR: `hourly-weather-roundup`,
|
|
137
|
+
HYD: `daily-hydrometeorological-products`,
|
|
138
|
+
HYM: `monthly-hydrometeorological-product`,
|
|
139
|
+
ICE: `ice-forecast`,
|
|
140
|
+
IDM: `ice-drift-vectors`,
|
|
141
|
+
INI: `administrative-message`,
|
|
142
|
+
IOB: `ice-observation`,
|
|
143
|
+
KPA: `keep-alive-message`,
|
|
144
|
+
LAE: `local-area-emergency`,
|
|
145
|
+
LCD: `preliminary-local-climatological-data`,
|
|
146
|
+
LCO: `local-cooperative-observation`,
|
|
147
|
+
LEW: `law-enforcement-warning`,
|
|
148
|
+
LFP: `local-forecast`,
|
|
149
|
+
LKE: `lake-stages`,
|
|
150
|
+
LLS: `low-level-sounding`,
|
|
151
|
+
LOW: `low-temperatures`,
|
|
152
|
+
LSR: `local-storm-report`,
|
|
153
|
+
LTG: `lightning-data`,
|
|
154
|
+
MAN: `rawinsonde-mandatory-levels`,
|
|
155
|
+
MAP: `mean-areal-precipitation`,
|
|
156
|
+
MAW: `amended-marine-forecast`,
|
|
157
|
+
MFM: `marine-forecast-matrix`,
|
|
158
|
+
MIM: `marine-interpretation-message`,
|
|
159
|
+
MIS: `miscellaneous-local-product`,
|
|
160
|
+
MOB: `marine-observations`,
|
|
161
|
+
MON: `space-environment-product-monthly`,
|
|
162
|
+
MRP: `marine-product-techniques-development`,
|
|
163
|
+
MSM: `asos-monthly-summary-message`,
|
|
164
|
+
MTR: `metar-observation`,
|
|
165
|
+
MTT: `metar-test-message`,
|
|
166
|
+
MVF: `marine-verification-coded-message`,
|
|
167
|
+
MWS: `marine-weather-statement`,
|
|
168
|
+
MWW: `marine-weather-message`,
|
|
169
|
+
NOU: `weather-reconnaissance-flights`,
|
|
170
|
+
NOW: `short-term-forecast`,
|
|
171
|
+
NOX: `data-management-message`,
|
|
172
|
+
NPW: `non-precipitation-warning`,
|
|
173
|
+
NSH: `nearshore-marine-forecast`,
|
|
174
|
+
NUW: `nuclear-power-plant-warning`,
|
|
175
|
+
NWR: `noaa-weather-radio-forecast`,
|
|
176
|
+
OAV: `other-aviation-products`,
|
|
177
|
+
OBS: `observations`,
|
|
178
|
+
OFA: `offshore-aviation-forecast`,
|
|
179
|
+
OFF: `offshore-forecast`,
|
|
180
|
+
OMR: `other-marine-products`,
|
|
181
|
+
OPU: `other-public-products`,
|
|
182
|
+
OSO: `other-surface-observations`,
|
|
183
|
+
OSW: `ocean-surface-winds`,
|
|
184
|
+
OUA: `other-upper-air-data`,
|
|
185
|
+
OZF: `zone-forecast`,
|
|
186
|
+
PFM: `point-forecast-matrices`,
|
|
187
|
+
PFW: `fire-weather-point-forecast-matrices`,
|
|
188
|
+
PLS: `plain-language-ship-report`,
|
|
189
|
+
PMD: `prognostic-meteorological-discussion`,
|
|
190
|
+
PNS: `public-information-statement`,
|
|
191
|
+
POE: `probability-of-exceedance`,
|
|
192
|
+
PRB: `heat-index-forecast-tables`,
|
|
193
|
+
PRC: `pilot-report-collective`,
|
|
194
|
+
PRE: `preliminary-forecasts`,
|
|
195
|
+
PSH: `post-storm-hurricane-report`,
|
|
196
|
+
PTS: `probabilistic-outlook-points`,
|
|
197
|
+
PWO: `public-severe-weather-outlook`,
|
|
198
|
+
PWS: `tropical-cyclone-probabilities`,
|
|
199
|
+
QPF: `quantitative-precipitation-forecast`,
|
|
200
|
+
QPS: `quantitative-precipitation-statement`,
|
|
201
|
+
RDF: `revised-digital-forecast`,
|
|
202
|
+
REC: `recreational-report`,
|
|
203
|
+
RER: `record-report`,
|
|
204
|
+
RET: `eas-activation-request`,
|
|
205
|
+
RFD: `rangeland-fire-danger-forecast`,
|
|
206
|
+
RFI: `rfi-observation`,
|
|
207
|
+
RFR: `route-forecast`,
|
|
208
|
+
RFW: `red-flag-warning`,
|
|
209
|
+
RHW: `radiological-hazard-warning`,
|
|
210
|
+
RMT: `required-monthly-test`,
|
|
211
|
+
RNS: `rain-information-statement`,
|
|
212
|
+
RR1: `hydro-met-data-report-part-1`,
|
|
213
|
+
RR2: `hydro-met-data-report-part-2`,
|
|
214
|
+
RR3: `hydro-met-data-report-part-3`,
|
|
215
|
+
RR4: `hydro-met-data-report-part-4`,
|
|
216
|
+
RR5: `hydro-met-data-report-part-5`,
|
|
217
|
+
RR6: `hydro-met-data-report-part-6`,
|
|
218
|
+
RR7: `hydro-met-data-report-part-7`,
|
|
219
|
+
RR8: `hydro-met-data-report-part-8`,
|
|
220
|
+
RR9: `hydro-met-data-report-part-9`,
|
|
221
|
+
RRA: `automated-hydrologic-observation-report`,
|
|
222
|
+
RRM: `miscellaneous-hydrologic-data`,
|
|
223
|
+
RRS: `hads-data`,
|
|
224
|
+
RRY: `asos-hourly-test-message`,
|
|
225
|
+
RSD: `daily-snotel-data`,
|
|
226
|
+
RSM: `monthly-snotel-data`,
|
|
227
|
+
RTP: `regional-temp-precip-table`,
|
|
228
|
+
RVA: `river-summary`,
|
|
229
|
+
RVD: `daily-river-forecast`,
|
|
230
|
+
RVF: `river-forecast`,
|
|
231
|
+
RVI: `river-ice-statement`,
|
|
232
|
+
RVM: `miscellaneous-river-product`,
|
|
233
|
+
RVR: `river-recreation-statement`,
|
|
234
|
+
RVS: `river-statement`,
|
|
235
|
+
RWR: `regional-weather-roundup`,
|
|
236
|
+
RWS: `regional-weather-summary`,
|
|
237
|
+
RWT: `required-weekly-test`,
|
|
238
|
+
SAB: `special-avalanche-bulletin`,
|
|
239
|
+
SAF: `agricultural-weather-forecast`,
|
|
240
|
+
SAG: `snow-avalanche-guidance`,
|
|
241
|
+
SAT: `apt-prediction`,
|
|
242
|
+
SAW: `preliminary-notice-of-watch`,
|
|
243
|
+
SCC: `storm-summary`,
|
|
244
|
+
SCD: `supplementary-climatological-data`,
|
|
245
|
+
SCN: `soil-climate-analysis-network`,
|
|
246
|
+
SCP: `satellite-cloud-product`,
|
|
247
|
+
SCS: `selected-cities-summary`,
|
|
248
|
+
SDO: `supplementary-data-observation`,
|
|
249
|
+
SDS: `special-dispersion-statement`,
|
|
250
|
+
SEL: `severe-local-storm-watch`,
|
|
251
|
+
SEV: `spc-watch-point-information`,
|
|
252
|
+
SFP: `state-forecast`,
|
|
253
|
+
SFT: `tabular-state-forecast`,
|
|
254
|
+
SGL: `rawinsonde-significant-levels`,
|
|
255
|
+
SHP: `surface-ship-report`,
|
|
256
|
+
SIG: `international-sigmet`,
|
|
257
|
+
SIM: `satellite-interpretation-message`,
|
|
258
|
+
SLS: `severe-local-storm-outline`,
|
|
259
|
+
SMF: `smoke-management-weather-forecast`,
|
|
260
|
+
SMW: `special-marine-warning`,
|
|
261
|
+
SOO: `science-operations-officer-product`,
|
|
262
|
+
SPE: `satellite-precipitation-estimates`,
|
|
263
|
+
SPF: `storm-strike-probability-bulletin`,
|
|
264
|
+
SPS: `special-weather-statement`,
|
|
265
|
+
SPW: `shelter-in-place-warning`,
|
|
266
|
+
SQW: `snow-squall-warning`,
|
|
267
|
+
SRD: `surf-discussion`,
|
|
268
|
+
SRF: `surf-forecast`,
|
|
269
|
+
SRG: `soaring-guidance`,
|
|
270
|
+
SSM: `synoptic-surface-observation`,
|
|
271
|
+
STA: `weather-statistical-summary`,
|
|
272
|
+
STD: `satellite-tropical-disturbance-summary`,
|
|
273
|
+
STO: `road-condition-report`,
|
|
274
|
+
STP: `state-temp-precip-table`,
|
|
275
|
+
STQ: `spot-forecast-request`,
|
|
276
|
+
SUM: `space-weather-message`,
|
|
277
|
+
SVR: `severe-thunderstorm-warning`,
|
|
278
|
+
SVS: `severe-weather-statement`,
|
|
279
|
+
SWO: `severe-storm-outlook`,
|
|
280
|
+
SWS: `state-weather-summary`,
|
|
281
|
+
SYN: `regional-weather-synopsis`,
|
|
282
|
+
TAF: `terminal-aerodrome-forecast`,
|
|
283
|
+
TAP: `terminal-alerting-products`,
|
|
284
|
+
TAV: `travelers-forecast-table`,
|
|
285
|
+
TCA: `tropical-cyclone-advisory`,
|
|
286
|
+
TCD: `tropical-cyclone-discussion`,
|
|
287
|
+
TCE: `tropical-cyclone-position-estimate`,
|
|
288
|
+
TCM: `tropical-cyclone-marine-aviation-advisory`,
|
|
289
|
+
TCP: `public-tropical-cyclone-advisory`,
|
|
290
|
+
TCS: `satellite-tropical-cyclone-summary`,
|
|
291
|
+
TCU: `tropical-cyclone-update`,
|
|
292
|
+
TCV: `tropical-cyclone-break-points`,
|
|
293
|
+
TIB: `tsunami-bulletin`,
|
|
294
|
+
TID: `tide-report`,
|
|
295
|
+
TMA: `tsunami-tide-seismic-acknowledgement`,
|
|
296
|
+
TOE: `telephone-outage-emergency`,
|
|
297
|
+
TOR: `tornado-warning`,
|
|
298
|
+
TPT: `temperature-precipitation-table`,
|
|
299
|
+
TSU: `tsunami-watch-warning`,
|
|
300
|
+
TUV: `ultraviolet-index`,
|
|
301
|
+
TVL: `travelers-forecast`,
|
|
302
|
+
TWB: `transcribed-weather-broadcast`,
|
|
303
|
+
TWD: `tropical-weather-discussion`,
|
|
304
|
+
TWO: `tropical-weather-outlook`,
|
|
305
|
+
TWS: `tropical-weather-summary`,
|
|
306
|
+
URN: `aircraft-reconnaissance`,
|
|
307
|
+
UVI: `ultraviolet-index`,
|
|
308
|
+
VAA: `volcanic-activity-advisory`,
|
|
309
|
+
VER: `forecast-verification-statistics`,
|
|
310
|
+
VFT: `taf-verification-product`,
|
|
311
|
+
VOW: `volcano-warning`,
|
|
312
|
+
WA0: `airmet-pacific`,
|
|
313
|
+
WA1: `airmet-northeast`,
|
|
314
|
+
WA2: `airmet-southeast`,
|
|
315
|
+
WA3: `airmet-north-central`,
|
|
316
|
+
WA4: `airmet-south-central`,
|
|
317
|
+
WA5: `airmet-rocky-mountains`,
|
|
318
|
+
WA6: `airmet-west-coast`,
|
|
319
|
+
WA7: `airmet-juneau-ak`,
|
|
320
|
+
WA8: `airmet-anchorage-ak`,
|
|
321
|
+
WA9: `airmet-fairbanks-ak`,
|
|
322
|
+
WAR: `space-environment-warning`,
|
|
323
|
+
WAT: `space-environment-watch`,
|
|
324
|
+
WCN: `weather-watch-clearance-notification`,
|
|
325
|
+
WCR: `weekly-weather-and-crop-report`,
|
|
326
|
+
WDA: `weekly-data-for-agriculture`,
|
|
327
|
+
WDU: `warning-decision-update`,
|
|
328
|
+
WEK: `space-environment-product-weekly`,
|
|
329
|
+
WOU: `watch-outline-update`,
|
|
330
|
+
WS1: `sigmet-northeast`,
|
|
331
|
+
WS2: `sigmet-southeast`,
|
|
332
|
+
WS3: `sigmet-north-central`,
|
|
333
|
+
WS4: `sigmet-south-central`,
|
|
334
|
+
WS5: `sigmet-rocky-mountains`,
|
|
335
|
+
WS6: `sigmet-west-coast`,
|
|
336
|
+
WST: `tropical-cyclone-sigmet`,
|
|
337
|
+
WSV: `volcanic-activity-sigmet`,
|
|
338
|
+
WSW: `winter-weather-warning`,
|
|
339
|
+
WWA: `watch-status-report`,
|
|
340
|
+
WWP: `watch-probabilities`,
|
|
341
|
+
ZFP: `zone-forecast-product`,
|
|
342
|
+
};
|