Skip to content

Commit

Permalink
Merge pull request #6 from LCOGT/156576199-visualization-improvements-2
Browse files Browse the repository at this point in the history
Make Weather Page more useful for Network Monitoring [2/2]
  • Loading branch information
raleighlittles authored May 31, 2018
2 parents 46f0fb9 + c165029 commit d42a5e7
Show file tree
Hide file tree
Showing 10 changed files with 2,857 additions and 3,082 deletions.
5,449 changes: 2,509 additions & 2,940 deletions client/package-lock.json

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,35 @@
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"bulma": "^0.6.2",
"bulma": "^0.7.1",
"chart.js": "^2.7.1",
"chartjs-plugin-annotation": "^0.5.7",
"moment": "^2.20.1",
"serve-static": "^1.13.1",
"moment": "^2.22.1",
"serve-static": "^1.13.2",
"suncalc": "^1.8.0",
"vue": "^2.5.11",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"weathericons": "^2.1.0"
"weathericons": "^2.1.0",
"node-sass": "^4.9.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"eslint": "^4.15.0",
"eslint-plugin-html": "^4.0.1",
"cross-env": "^5.1.6",
"css-loader": "^0.28.11",
"eslint": "^4.19.0",
"request": "^2.87.0",
"eslint-plugin-html": "^4.0.3",
"file-loader": "^1.1.4",
"node-sass": "^4.5.3",
"hawk": "^7.0.7",
"sass-loader": "^6.0.6",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.4.4",
Expand Down
12 changes: 7 additions & 5 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<div id="app">
<section class="section">
<div class="container">
<div class="container is-fluid">
<div class="columns">
<div class="column is-one-quarter">
<div class="column is-one-fifth-desktop is-one-half-tablet">
<div class="fixed">
<WeatherNav/>
</div>
</div>
<div class="column">
<div class="column is-three-fourths-desktop">
<router-view/>
</div>
</div>
Expand All @@ -26,8 +26,10 @@
<style lang="scss">
@media screen and (min-width: 1224px){
.fixed {
position: fixed;
width: 19rem;
width: 95%;
padding-right: 5px;
resize: both
}
}
</style>
6 changes: 4 additions & 2 deletions client/src/components/NavItem.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div class="navitem">
<div class="columns level mini-info">
<div class="column status is-one-fifth"> {{site_status}} </div>
<div class="column place is-two-thirds">
{{site.name}} {{ site.country }}
</div>
Expand All @@ -19,7 +20,7 @@
import moment from 'moment';
export default {
name: 'NavItem',
props: ['site'],
props: ['site', 'site_status'],
computed: {
mapimg(){
return require(`../assets/maps/${this.site.code}.png`); // eslint-disable-line no-undef
Expand All @@ -39,6 +40,7 @@
display: none;
}
.mini-info {
margin-right: 0rem;
margin-right: 3rem;
padding-right: 3rem;
}
</style>
98 changes: 55 additions & 43 deletions client/src/components/Site.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,75 +17,78 @@
</div>

<div>
<p class="level-heading heading">Current Values</p>
<nav class="level">
<h3 class="level-heading heading title is-size-4 is-bold">Current Values</h3>
<nav class="level is-mobile">
<div class="level-item has-text-centered">
<div>
<p class="heading">Air Temp &deg;C</p>
<p class="title">{{ datums['Weather Air Temperature Value'].data | latestVal }}</p>
<p class="title">{{ datums['Weather Air Temperature Value'].data | latestResult('Value') }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Pressure mbar</p>
<p class="title">{{ datums['Weather Barometric Pressure Value'].data | latestVal }}</p>
<p class="title">{{ datums['Weather Barometric Pressure Value'].data | latestResult('Value') }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Dewpoint &deg;C</p>
<p class="title">{{ datums['Weather Dew Point Value'].data | latestVal }}</p>
<p class="title">{{ datums['Weather Dew Point Value'].data | latestResult('Value') }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Humidity %</p>
<p class="title">{{ datums['Weather Humidity Value'].data | latestVal }}</p>
<p class="title">{{ datums['Weather Humidity Value'].data | latestResult('Value') }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Wind meters per sec</p>
<p class="title">{{ datums['Weather Wind Speed Value'].data | latestVal }}</p>
<p class="heading">Wind meters/second</p>
<p class="title">{{ datums['Weather Wind Speed Value'].data | latestResult('Value') }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Wind &deg;E of N</p>
<p class="title">{{ datums['Weather Wind Direction Value'].data | latestVal }}&deg;</p>
<p class="title">{{ datums['Weather Wind Direction Value'].data | latestResult('Value') }}&deg;</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Brightness mag/arcsec<sup>^</sup>2</p>
<p class="title">{{ datums['Weather Sky Brightness Value'].data | latestVal }}</p>
<p class="title">{{ datums['Weather Sky Brightness Value'].data | latestResult('Value') }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Sky Transparency %</p>
<p class="title">{{ datums['Boltwood Transparency Measure'].data | latestVal }}</p>
<p class="title">{{ datums['Boltwood Transparency Measure'].data | latestResult('Value') }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Sky Temp &deg;C</p>
<p class="title">{{ datums['Boltwood Sky Minus Ambient Temperature'].data | latestVal }}</p>
<p class="title">{{ datums['Boltwood Sky Minus Ambient Temperature'].data | latestResult('Value') }}</p>
</div>
</div>
</nav>
</div>

<section class="section section-xsmall">
<p class="heading">Last {{ this.$store.state.range }}</p>


<section class="section section-medium">
<p class="heading is-size-3 has-text-centered">Last {{ this.$store.state.range }}</p>
<h4 class="is-size-4 helptoggle"> OK to Open
<a class="helptoggle is-pulled-right "><sup>?</sup>

</a><span class="help is-pulled-right">All weather conditions are within acceptable range to allow observing.</span>
</h4>

<figure class="image">
<Timeline datumid="oktoopen" :suntimes="suntTimes" :timezone="site.tz" datumname="Weather Ok To Open" :cdata="datums['Weather Ok To Open'].data"></Timeline>
<Timeline datumid="oktoopen" :suntimes="suntTimes" :timezone="site.tz" datumname="Weather Ok To Open" :cdata="datums['Weather Ok To Open'].data"
:fdata="datums['Weather Failure Reason'].data"></Timeline>
</figure>
</section>

Expand All @@ -96,7 +99,7 @@
<figure class="image">
<TimeChart datumid="airtemp" datumname="Air Temperature" unit="C"
:cdata="datums['Weather Air Temperature Value'].data"
:limit="limit('Weather Air Temperature Value')">
:limit="limit('Weather Air Temperature Value')" limit_direction="min">
</TimeChart>
</figure>
</section>
Expand All @@ -106,6 +109,7 @@
<a class="helptoggle is-pulled-right"><sup><small>?</small></sup></a><span class="help is-pulled-right">Sky Temperature is inferred from 8-14µm irradiance measure by a Boltwood II cloud sensor at the site's weather station.</span>

</h4>

<figure class="image">
<TimeChart datumid="skytemp" datumname="Boltwood Sky Minus Ambient Temperature" unit="C"
:cdata="datums['Boltwood Sky Minus Ambient Temperature'].data">
Expand All @@ -120,7 +124,7 @@
<figure class="image">
<TimeChart datumid="transparency" datumname="Boltwood Transparency Measure" unit="%"
:cdata="datums['Boltwood Transparency Measure'].data"
:limit="limit('Boltwood Transparency Measure')">
:limit="limit('Boltwood Transparency Measure')" limit_direction="min">
</TimeChart>
</figure>
</section>
Expand Down Expand Up @@ -151,12 +155,12 @@

<section class="section section-xsmall">
<h4 class="is-size-4">Air temperature minus dewpoint
<a class="helptoggle is-pulled-right"><sup><small>?</small></sup></a><span class="help is-pulled-right">Dew Point measured by device telemetry.</span>
<a class="helptoggle is-pulled-right"><sup><small>?</small></sup></a><span class="help is-pulled-right">Absolute value of difference between Dew Point and Air Temperature.</span>
</h4>
<figure class="image">
<TimeChart datumid="ATminusDP" datumname="Air Temperature minus Dewpoint" unit="C"
:cdata="datumDifference(datums['Weather Air Temperature Value'].data, datums['Weather Dew Point Value'].data)"
:limit="2">
:cdata="datumDifference(datums['Weather Dew Point Value'].data, datums['Weather Air Temperature Value'].data)"
:limit="2" limit_direction="min">
</TimeChart>
</figure>
</section>
Expand Down Expand Up @@ -198,7 +202,16 @@
</figure>
</section>


<div class="box">
<div class="columns is-centered">
<div class="column is-narrow">
Minimum <div class="min-line"></div>
</div>
<div class="column is-narrow">
Maximum <div class="max-line"></div>
</div>
</div>
</div>

</div>
</template>
Expand Down Expand Up @@ -277,7 +290,7 @@ export default {
'Boltwood Transparency Measure': {
data: [],
limit: {
default: null
}
},
Expand All @@ -297,7 +310,7 @@ export default {
'Boltwood Transparency Close Threshold': {
data: [],
limit: {
default: null
}
}
}
Expand Down Expand Up @@ -357,8 +370,8 @@ export default {
if (datumName == 'Boltwood Transparency Measure')
{ // this datum has a dynamically changing threshold
let latest_value = this.$options.filters.latestVal(this.datums['Boltwood Transparency Close Threshold'].data);
return latest_value;
let latest_value = this.$options.filters.latestResult(this.datums['Boltwood Transparency Close Threshold'].data, 'Value');
return Number(latest_value);
}
if(this.datums[datumName].limit.hasOwnProperty(this.site.code)){
Expand Down Expand Up @@ -403,7 +416,7 @@ export default {
return suntimes_array;
}, // TODO: Rename these to last_sunrise/sunset
},
sunrise(){
// get last sunrise
return moment.utc((this.suntTimes.slice(-1)[0].sunrise));
Expand All @@ -426,27 +439,26 @@ export default {
},
filters: {
// TODO: Refactor all of the LATEST filters
latestVal(values){
if (!values || values.length < 1) return 0;
let val = values[values.length - 1].Value;
return val.toFixed(1);
},
// needed for string values?
latestMsg(messages)
latestResult(values, property)
{
if (!messages || messages.length < 1)
/**
* @param values - an array of values to parse, must contain a property name that matches the property parameter
* @param property - the property you wish to extract, either 'Value' or 'ValueString'
*/
if (property === 'Value')
{
return '';
if (!values || values.length < 1) return 0;
let val = values[values.length - 1][property];
return val.toFixed(1);
}
else{
return messages[messages.length - 1].ValueString;
else if (property === 'ValueString')
{
if (!values || values.length < 1 ) return '';
return values[values.length -1][property];
}
},
parseMsg(msg)
{
return ((msg === "None" || msg === "Unknown") ? "Open" : msg);
},
cardinal(val){
Expand Down Expand Up @@ -479,7 +491,7 @@ export default {
<style lang="scss">
.help {
display: none;
margin-right: 20px;
margin-right: 0px;
}
.helptoggle:hover + .help {
display: inline;
Expand Down
Loading

0 comments on commit d42a5e7

Please sign in to comment.