Compare commits

..

3 Commits

Author SHA1 Message Date
Matt Walsh
9150d42802 5.27.2 2025-07-15 22:13:04 -05:00
Matt Walsh
54257e4667 add new naming issue template 2025-07-15 22:07:52 -05:00
Matt Walsh
7d50ce28bd Allow for station data overrides #125 2025-07-15 22:00:33 -05:00
9 changed files with 16185 additions and 16142 deletions

13
.github/ISSUE_TEMPLATE/naming _issue.md vendored Normal file
View File

@@ -0,0 +1,13 @@
---
name: Naming issue
about: A city, airport or other location is not named correctly
title: 'Name Issue: '
labels: naming
assignees: ''
---
This form is not for reporting a location that you can not find from the search box.
Use this form to help us rename airports, points of interest and other data provided from the API (rarely updated) to a better name. For example the airport in Broomfield colorado was renamed from "Jeffco" in the API to "Rocky Mountain Metro" it's new name.
You can also make a pull request on the `[station-overrides.mjs](https://github.com/netbymatt/ws4kp/blob/main/datagenerators/stations-states.mjs)` file which includes instructions on how to make the change directly. This is the preferred method.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
// station overrides are used to change the data for a station that is provided by the api
// the most common use is to adjust the city (station name) for formatting or to update an outdated name
// a complete station object looks like this:
// {
// "id": "KMCO", // 4-letter station identifier and key for lookups
// "city": "Orlando International Airport", // name displayed for this station
// "state": "FL", // state
// "lat": 28.41826, // latitude of station
// "lon": -81.32413 // longitude of station
// }
// any or all of the data for a station can be overwritten, follow the existing override patterns below
const overrides = {
KBJC: {
city: 'Rocky Mountain Metro',
},
};
export default overrides;

View File

@@ -5,6 +5,7 @@ import { writeFileSync } from 'fs';
import https from './https.mjs';
import states from './stations-states.mjs';
import chunk from './chunk.mjs';
import overrides from './stations-overrides.mjs';
// skip stations starting with these letters
const skipStations = ['U', 'C', 'H', 'W', 'Y', 'T', 'S', 'M', 'O', 'L', 'A', 'F', 'B', 'N', 'V', 'R', 'D', 'E', 'I', 'G', 'J'];
@@ -43,12 +44,16 @@ for (let i = 0; i < chunkStates.length; i += 1) {
console.log(`Duplicate station: ${state}-${id}`);
return;
}
// get any overrides if available
const override = overrides[id] ?? {};
output[id] = {
id,
city: station.properties.name,
state,
lat: station.geometry.coordinates[1],
lon: station.geometry.coordinates[0],
// finally add the overrides
...override,
};
});
next = stations?.pagination?.next;
@@ -59,7 +64,7 @@ for (let i = 0; i < chunkStates.length; i += 1) {
while (next && stations.features.length > 0);
console.log(`Complete: ${state}`);
return true;
} catch (e) {
} catch {
console.error(`Unable to get state: ${state}`);
return false;
}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "ws4kp",
"version": "5.27.1",
"version": "5.27.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ws4kp",
"version": "5.27.1",
"version": "5.27.2",
"license": "MIT",
"dependencies": {
"dotenv": "^17.0.1",

View File

@@ -1,6 +1,6 @@
{
"name": "ws4kp",
"version": "5.27.1",
"version": "5.27.2",
"description": "Welcome to the WeatherStar 4000+ project page!",
"main": "index.mjs",
"type": "module",

View File

@@ -13350,6 +13350,13 @@ const StationInfo = {
lat: 38.7578,
lon: -104.3013,
},
KAEJ: {
id: 'KAEJ',
city: 'Central Colorado Regional Airport',
state: 'CO',
lat: 38.81416,
lon: -106.12069,
},
KAFF: {
id: 'KAFF',
city: 'Air Force Academy',
@@ -13357,13 +13364,6 @@ const StationInfo = {
lat: 38.96667,
lon: -104.81667,
},
KAIB: {
id: 'KAIB',
city: 'Nucla Hopkins Field Airport',
state: 'CO',
lat: 38.23875,
lon: -108.563277,
},
KAJZ: {
id: 'KAJZ',
city: 'Delta/Blake Field Airport',
@@ -13415,7 +13415,7 @@ const StationInfo = {
},
KBJC: {
id: 'KBJC',
city: 'Broomfield / Jeffco',
city: 'Rocky Mountain Metro',
state: 'CO',
lat: 39.90085,
lon: -105.10417,

View File

@@ -114,11 +114,14 @@ class CurrentWeather extends WeatherDisplay {
const wind = (typeof this.data.WindSpeed === 'number') ? this.data.WindDirection.padEnd(3, '') + this.data.WindSpeed.toString().padStart(3, ' ') : this.data.WindSpeed;
// get location (city name) from StationInfo if available (allows for overrides)
const location = (StationInfo[this.data.station.properties.stationIdentifier]?.city ?? locationCleanup(this.data.station.properties.name)).substr(0, 20);
const fill = {
temp: this.data.Temperature + String.fromCharCode(176),
condition,
wind,
location: locationCleanup(this.data.station.properties.name).substr(0, 20),
location,
humidity: `${this.data.Humidity}%`,
dewpoint: this.data.DewPoint + String.fromCharCode(176),
ceiling: (this.data.Ceiling === 0 ? 'Unlimited' : this.data.Ceiling + this.data.CeilingUnit),

View File

@@ -133,7 +133,10 @@ const baseScreens = [
// hazards
hazards,
// station name
(data) => `Conditions at ${locationCleanup(data.station.properties.name).substr(0, 20)}`,
(data) => {
const location = (StationInfo[data.station.properties.stationIdentifier]?.city ?? locationCleanup(data.station.properties.name)).substr(0, 20);
return `Conditions at ${location}`;
},
// temperature
(data) => {