Skip to content

Commit

Permalink
better filtering of null station data for current weather close #54
Browse files Browse the repository at this point in the history
5.13.3
  • Loading branch information
netbymatt committed Oct 19, 2024
1 parent c930776 commit 13b77a0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dist/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/resources/ws.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ws4kp",
"version": "5.13.2",
"version": "5.13.3",
"description": "Welcome to the WeatherStar 4000+ project page!",
"main": "index.js",
"scripts": {
Expand Down
22 changes: 11 additions & 11 deletions server/scripts/modules/almanac.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Almanac extends WeatherDisplay {
if (iteration % 2 === 0) test = (lastPhase, testPhase) => lastPhase > threshold && testPhase <= threshold;

do {
// store last phase
// store last phase
const lastPhase = phase;
// calculate new phase after step
moonDate = moonDate.plus(step);
Expand All @@ -103,7 +103,7 @@ class Almanac extends WeatherDisplay {
if (phase > 0.9) phase -= 1.0;
// compare
if (test(lastPhase, phase)) {
// last iteration is three, return value
// last iteration is three, return value
if (iteration >= 3) break;
// iterate recursively
return this.getMoonTransition(threshold, phaseName, moonDate, iteration + 1);
Expand Down Expand Up @@ -160,15 +160,15 @@ class Almanac extends WeatherDisplay {

const imageName = (type) => {
switch (type) {
case 'Full':
return 'images/2/Full-Moon.gif';
case 'Last':
return 'images/2/Last-Quarter.gif';
case 'New':
return 'images/2/New-Moon.gif';
case 'First':
default:
return 'images/2/First-Quarter.gif';
case 'Full':
return 'images/2/Full-Moon.gif';
case 'Last':
return 'images/2/Last-Quarter.gif';
case 'New':
return 'images/2/New-Moon.gif';
case 'First':
default:
return 'images/2/First-Quarter.gif';
}
};

Expand Down
4 changes: 3 additions & 1 deletion server/scripts/modules/currentweather.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ class CurrentWeather extends WeatherDisplay {
|| observations.features[0].properties.windSpeed.value === null
|| observations.features[0].properties.textDescription === null
|| observations.features[0].properties.textDescription === ''
|| observations.features[0].properties.icon === null) {
|| observations.features[0].properties.icon === null
|| observations.features[0].properties.dewpoint.value === null
|| observations.features[0].properties.barometricPressure.value === null) {
observations = undefined;
throw new Error(`Unable to get observations: ${station.properties.stationIdentifier}, trying next station`);
}
Expand Down

0 comments on commit 13b77a0

Please sign in to comment.