Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • develop
  • master
2 results

Target

Select target project
  • metobs/MetObsSite
  • wroberts/MetObsSite
  • davidh/MetObsSite
3 results
Select Git revision
  • develop
  • master
2 results
Show changes
Commits on Source (50)
Showing
with 6900 additions and 6883 deletions
...@@ -54,6 +54,9 @@ After following GitLab instructions for registering a new GitLab runner, we ...@@ -54,6 +54,9 @@ After following GitLab instructions for registering a new GitLab runner, we
need to do some extra setup to prepare the runner's account. See the need to do some extra setup to prepare the runner's account. See the
`.gitlab-ci.yml` file for the exact commands that are run for each job. `.gitlab-ci.yml` file for the exact commands that are run for each job.
At the time of writing a runner is registered on the `rain03` server with a
"shell" executor with everything running under the gitlab-runner user account.
### Add conda to the runner's environment ### Add conda to the runner's environment
The GitLab CI configuration expects the runner to know what the "conda" The GitLab CI configuration expects the runner to know what the "conda"
...@@ -61,7 +64,7 @@ command is. To enable this we run a onetime command on the runner which ...@@ -61,7 +64,7 @@ command is. To enable this we run a onetime command on the runner which
initializes a bashrc for the `gitlab-runner` user. initializes a bashrc for the `gitlab-runner` user.
```bash ```bash
sudo -u gitlab-runner /home/davidh/miniconda3/bin/conda init bash sudo -u gitlab-runner /opt/miniforge3_YYYYMMDD/condabin/conda init bash
``` ```
Or where ever conda is installed for this system. This will create a bashrc Or where ever conda is installed for this system. This will create a bashrc
...@@ -71,10 +74,11 @@ is used in the `.gitlab-ci.yml` scripts for creating a build environment. ...@@ -71,10 +74,11 @@ is used in the `.gitlab-ci.yml` scripts for creating a build environment.
### GitLab Runner Upload ### GitLab Runner Upload
The uploading of the generated website content is done with rsync via SSH. The uploading of the generated website content is done with rsync via SSH.
This currently uses two SSH keys under David Hoese's user account (davidh) This currently uses two SSH keys defined in the GitLab CI Variables (via
on the `webaccess` server. These keys are restricted to only run the specific the web GUI). These are configured under David Hoese's user account (davidh)
rsync commands used by gitlab-ci. This is configured in the on the `webaccess` server in `~/.ssh/authorized_keys`. These keys are
`~/.ssh/authorized_keys` file: restricted to only run the specific
rsync commands used by gitlab-ci.
```bash ```bash
command="rsync --server -vulogDtpre.iLsfxC --delete . METOBS_TEST",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa <key> metobs-test upload key command="rsync --server -vulogDtpre.iLsfxC --delete . METOBS_TEST",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa <key> metobs-test upload key
......
...@@ -217,11 +217,11 @@ nav { ...@@ -217,11 +217,11 @@ nav {
<div class="row"> <div class="row">
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4 class="hidden-lg">6 Hours</h4> <h4 class="hidden-lg">6 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.temp_xsec.last_06_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.temp_xsec.last_06_hours.png">
</div> </div>
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4 class="hidden-lg">24 Hours</h4> <h4 class="hidden-lg">24 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.temp_xsec.last_24_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.temp_xsec.last_24_hours.png">
</div> </div>
</div> </div>
</div> </div>
...@@ -238,11 +238,11 @@ nav { ...@@ -238,11 +238,11 @@ nav {
<div class="row"> <div class="row">
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4 class="hidden-lg">6 Hours</h4> <h4 class="hidden-lg">6 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.wvmr_xsec.last_06_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.wvmr_xsec.last_06_hours.png">
</div> </div>
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4 class="hidden-lg">24 Hours</h4> <h4 class="hidden-lg">24 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.wvmr_xsec.last_24_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.wvmr_xsec.last_24_hours.png">
</div> </div>
</div> </div>
</div> </div>
...@@ -259,11 +259,11 @@ nav { ...@@ -259,11 +259,11 @@ nav {
<div class="row"> <div class="row">
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4 class="hidden-lg">6 Hours</h4> <h4 class="hidden-lg">6 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.rh_xsec.last_06_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.rh_xsec.last_06_hours.png">
</div> </div>
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4 class="hidden-lg">24 Hours</h4> <h4 class="hidden-lg">24 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.rh_xsec.last_24_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.rh_xsec.last_24_hours.png">
</div> </div>
</div> </div>
</div> </div>
...@@ -280,11 +280,11 @@ nav { ...@@ -280,11 +280,11 @@ nav {
<div class="row"> <div class="row">
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4 class="hidden-lg">6 Hours</h4> <h4 class="hidden-lg">6 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.theta_xsec.last_06_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.theta_xsec.last_06_hours.png">
</div> </div>
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4 class="hidden-lg">24 Hours</h4> <h4 class="hidden-lg">24 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.theta_xsec.last_24_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.theta_xsec.last_24_hours.png">
</div> </div>
</div> </div>
</div> </div>
...@@ -303,11 +303,11 @@ nav { ...@@ -303,11 +303,11 @@ nav {
<div class="row"> <div class="row">
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4>6 Hours</h4> <h4>6 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.lwp_itau.last_06_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.lwp_itau.last_06_hours.png">
</div> </div>
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4>24 Hours</h4> <h4>24 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.lwp_itau.last_24_hours.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/aeri/level_c1/version_00/aerioe.lwp_itau.last_24_hours.png">
</div> </div>
</div> </div>
</div> </div>
...@@ -326,11 +326,11 @@ nav { ...@@ -326,11 +326,11 @@ nav {
<div class="row"> <div class="row">
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4>6 Hours</h4> <h4>6 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/windpro/level_a1/version_00/wind_speed_last_6_hrs.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/windpro/level_a1/version_00/wind_speed_last_6_hrs.png">
</div> </div>
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4>24 Hours</h4> <h4>24 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/windpro/level_a1/version_00/wind_speed_last_24_hrs.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/windpro/level_a1/version_00/wind_speed_last_24_hrs.png">
</div> </div>
</div> </div>
</div> </div>
...@@ -349,17 +349,17 @@ nav { ...@@ -349,17 +349,17 @@ nav {
<div class="row"> <div class="row">
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4>6 Hours</h4> <h4>6 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/windpro/level_a1/version_00/wind_dir_last_6_hrs.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/windpro/level_a1/version_00/wind_dir_last_6_hrs.png">
</div> </div>
<div class="col-lg-6 text-center"> <div class="col-lg-6 text-center">
<h4>24 Hours</h4> <h4>24 Hours</h4>
<img class="ql-refresh" width="100%" src="http://metobs.ssec.wisc.edu/pub/cache/sparc/current/windpro/level_a1/version_00/wind_dir_last_24_hrs.png"> <img class="ql-refresh" width="100%" src="/pub/cache/sparc/current/windpro/level_a1/version_00/wind_dir_last_24_hrs.png">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script src="metobs.ssec.wisc.edu/js/moment.min.js"></script> <script src="{static}/js/moment.min.js"></script>
<script> <script>
setInterval(function(){ setInterval(function(){
//cache-break the images with a new url every 10 minutes //cache-break the images with a new url every 10 minutes
......
...@@ -7,21 +7,25 @@ os_kind=$(awk -F= '/^ID=/{print $2}' /etc/os-release) ...@@ -7,21 +7,25 @@ os_kind=$(awk -F= '/^ID=/{print $2}' /etc/os-release)
os_kind=${os_kind//\"/} os_kind=${os_kind//\"/}
if [[ "${os_kind}" == "ubuntu" ]]; then if [[ "${os_kind}" == "ubuntu" ]]; then
source /var/lib/gitlab-runner/.bashrc source /var/lib/gitlab-runner/.bashrc
elif [[ "${os_kind}" == "centos" ]]; then elif [[ "${os_kind}" == "pop" ]]; then
source ~/.bashrc source /var/lib/gitlab-runner/.bashrc
else
source ${HOME}/.bashrc
fi fi
if [[ -z "$METOBS_SITE_DEST" ]]; then if [[ -z "$METOBS_SITE_DEST" ]]; then
if [[ "$CI_COMMIT_BRANCH" == "develop" ]]; then if [[ "$CI_COMMIT_BRANCH" == "develop" ]]; then
METOBS_SITE_DEST="metobs-test" export METOBS_SITE_DEST="metobs-test"
else else
METOBS_SITE_DEST="metobs" export METOBS_SITE_DEST="metobs"
fi fi
fi fi
# create or update the existing environment to the newest pelican version # create or update the existing environment to the newest pelican version
conda env update -p "${PWD}/rain_site_env" -f "${SCRIPT_DIR}/build_environment.yml" # Environments should be created as gitlab-runner user and placed in
conda activate "${PWD}/rain_site_env" # /home/gitlab-runner/.conda/envs/<env name> by default
conda env update -n "rain_site_env" -f "${SCRIPT_DIR}/build_environment.yml"
conda activate "rain_site_env"
make clean make clean
make publish make publish
echo $PWD echo $PWD
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/">
<title>Playlist</title>
<trackList>
<track>
<location>rtp://@233.0.59.107:5678</location>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:id>0</vlc:id>
</extension>
</track>
</trackList>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:item tid="0" />
</extension>
</playlist>
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/">
<title>Playlist</title>
<trackList>
<track>
<location>rtp://@233.0.59.107:2345</location>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:id>0</vlc:id>
</extension>
</track>
</trackList>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:item tid="0" />
</extension>
</playlist>
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/">
<title>Playlist</title>
<trackList>
<track>
<location>rtp://@233.0.59.107:3456</location>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:id>0</vlc:id>
</extension>
</track>
</trackList>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:item tid="0" />
</extension>
</playlist>
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/">
<title>Playlist</title>
<trackList>
<track>
<location>rtp://@233.0.59.107:6789</location>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:id>0</vlc:id>
</extension>
</track>
</trackList>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:item tid="0" />
</extension>
</playlist>
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/">
<title>Playlist</title>
<trackList>
<track>
<location>rtp://@233.0.59.107:1234</location>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:id>0</vlc:id>
</extension>
</track>
</trackList>
<extension application="http://www.videolan.org/vlc/playlist/0">
<vlc:item tid="0" />
</extension>
</playlist>
...@@ -37,10 +37,15 @@ var DATA_API_INFO= { ...@@ -37,10 +37,15 @@ var DATA_API_INFO= {
'8.0m','9.0m','10.0m','11.0m','12.0m','13.0m','14.0m','15.0m', '8.0m','9.0m','10.0m','11.0m','12.0m','13.0m','14.0m','15.0m',
'16.0m','17.0m','18.0m','19.0m','20.0m'] '16.0m','17.0m','18.0m','19.0m','20.0m']
}, },
"doptoppm":{"display_name":"Dissolved Oxygen Concentration"}, "spcond":{"display_name":"Specific conductivity of the water (2019-present)"},
"doptosat":{"display_name":"Dissolved Oxygen Saturation"}, "do_raw2":{"display_name":"Dissolved Oxygen Concentration (2019-present)"},
"chlorophyll":{"display_name":"Chlorophyll"}, "do_sat2":{"display_name":"Dissolved Oxygen Saturation (2019-present)"},
"phycocyanin":{"display_name":"Phycocyanin"} "chlorophyll_ysi":{"display_name":"Chlorophyll (2019-present)"},
"phycocyanin_ysi":{"display_name":"Phycocyanin (2019-present)"},
"doptoppm":{"display_name":"Dissolved Oxygen Concentration (pre-2019)"},
"doptosat":{"display_name":"Dissolved Oxygen Saturation (pre-2019)"},
"chlorophyll":{"display_name":"Chlorophyll (pre-2019)"},
"phycocyanin":{"display_name":"Phycocyanin (pre-2019)"}
} }
} }
} }
......
...@@ -319,9 +319,12 @@ $(document).ready(function(){ ...@@ -319,9 +319,12 @@ $(document).ready(function(){
changeYear: true, changeYear: true,
dateFormat:'yy-mm-dd', dateFormat:'yy-mm-dd',
timeFormat:'HH:mm', timeFormat:'HH:mm',
showTimezone:true,
timezoneList:[{label: "UTC", value: 0}],
timezone:0,
showSecond:false, showSecond:false,
showMillisec:false, showMillisec:false,
showMicrosec:false showMicrosec:false,
}); });
$('#End-date-picker').datetimepicker({ $('#End-date-picker').datetimepicker({
...@@ -329,9 +332,12 @@ $(document).ready(function(){ ...@@ -329,9 +332,12 @@ $(document).ready(function(){
changeYear: true, changeYear: true,
dateFormat:'yy-mm-dd', dateFormat:'yy-mm-dd',
timeFormat:'HH:mm', timeFormat:'HH:mm',
showTimezone:true,
timezoneList:[{label: "UTC", value: 0}],
timezone:0,
showSecond:false, showSecond:false,
showMillisec:false, showMillisec:false,
showMicrosec:false showMicrosec:false,
}); });
//bind the enabling/disabling of forms to radio buttons //bind the enabling/disabling of forms to radio buttons
......
{
"ignore": [
"node_modules/*"
]
}
> 0.25%
not dead
\ No newline at end of file
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "entry",
"corejs": "3.22"
}
]
]
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -5,32 +5,31 @@ ...@@ -5,32 +5,31 @@
"main": "tower/API.js", "main": "tower/API.js",
"dependencies": { "dependencies": {
"event-emitter": "^0.3.5", "event-emitter": "^0.3.5",
"flux": "^3.1.3", "flux": "^4.0.4",
"html2canvas": "^1.0.0-rc.3", "html2canvas": "^1.4.1",
"jquery": "^3.4.0", "jquery": "^3.7.1",
"jquery-timepicker": "^1.3.3", "jquery-timepicker": "^1.3.3",
"react": "^16.8.6", "node": "^23.11.0",
"underscore": "^1.9.1" "react": "^16.14.0",
"underscore": "^1.13.7"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.4.3", "@babel/core": "^7.26.10",
"@babel/preset-env": "^7.4.3", "@babel/preset-env": "^7.26.9",
"babel-core": "^6.26.3", "babel-loader": "^10.0.0",
"babel-loader": "^7.1.5", "jsdoc": "^4.0.4",
"babel-preset-es2015": "^6.24.1",
"jsdoc": "^3.6.3",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"npm-watch": "^0.6.0", "npm-watch": "^0.13.0",
"raw-loader": "^2.0.0", "raw-loader": "^4.0.2",
"rimraf": "^2.6.3", "rimraf": "^5.0.10",
"source-map-loader": "^0.2.4", "source-map-loader": "^0.2.4",
"uglifyjs-webpack-plugin": "^2.1.2", "terser-webpack-plugin": "^5.3.14",
"webpack": "^4.30.0", "webpack": "^5.99.6",
"webpack-cli": "^3.3.0" "webpack-cli": "^6.0.1"
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"babel": "babel --ignore 'node_modules/*' --presets es2015 controller.js -o build/main.bundle.js", "babel": "babel --ignore 'node_modules/*' --presets env controller.js -o build/main.bundle.js",
"start": "http-server", "start": "http-server",
"webpack": "webpack", "webpack": "webpack",
"watch": "npm-run-all -p watch:*", "watch": "npm-run-all -p watch:*",
......
...@@ -128,6 +128,10 @@ function requestPlotUpdate(dataCache, div, plotsInfo, startTime, endTime, interv ...@@ -128,6 +128,10 @@ function requestPlotUpdate(dataCache, div, plotsInfo, startTime, endTime, interv
interval = '1m'; interval = '1m';
// hours, minutes, seconds // hours, minutes, seconds
time_parts = _.map(startTime.split(':'), Number); time_parts = _.map(startTime.split(':'), Number);
if (update) {
// if we're updating then we don't need to get a ton of data every time
startTime = "-00:05:00";
}
dt_in_ms = -1000 * 60 * 60 * time_parts[0] + 1000 * 60 * time_parts[1] + 1000 * time_parts[2]; dt_in_ms = -1000 * 60 * 60 * time_parts[0] + 1000 * 60 * time_parts[1] + 1000 * time_parts[2];
for (var i in intervalLookUp) { for (var i in intervalLookUp) {
if (dt_in_ms >= intervalLookUp[i][0]) { if (dt_in_ms >= intervalLookUp[i][0]) {
......
...@@ -9,7 +9,7 @@ var utils = require('./utils.js'); ...@@ -9,7 +9,7 @@ var utils = require('./utils.js');
*/ */
function initTable(div_id, plotOrder, plotsInfo) { function initTable(div_id, plotOrder, plotsInfo) {
var div = $('#'+div_id); var div = $('#'+div_id);
var table = $('<table class="met_table"><tbody></tbody></table>'); var table = $('<table class="met_table text-left" align="center"><tbody></tbody></table>');
var tbody = table.children('tbody'); var tbody = table.children('tbody');
var plot_info; var plot_info;
...@@ -41,9 +41,9 @@ function initTable(div_id, plotOrder, plotsInfo) { ...@@ -41,9 +41,9 @@ function initTable(div_id, plotOrder, plotsInfo) {
} }
}; };
} }
div.append('<h3>'+plotsInfo.title+'</h3>'); div.append('<h3 style="text-align:center">'+plotsInfo.title+'</h3>');
div.append(table); div.append(table);
div.append('<span id="timestamp"></span>'); div.append('<span id="timestamp" style="text-align:center"></span>');
}; };
function add_anc_rows(tbody,plot_key,idx,trace_info){ function add_anc_rows(tbody,plot_key,idx,trace_info){
...@@ -153,6 +153,7 @@ function updateTable(dataObj,plotsInfo) { ...@@ -153,6 +153,7 @@ function updateTable(dataObj,plotsInfo) {
if (trace_info.type=='contour') { if (trace_info.type=='contour') {
td_idx=update_contour_cells(data,data_cells,convert_cells,trace_info,td_idx); td_idx=update_contour_cells(data,data_cells,convert_cells,trace_info,td_idx);
} else { } else {
ticktext.preConvertValue(data[trace_info['var_names'][0]], plot_info.yaxis);
var update_val = data[trace_info['var_names'][0]][0]; var update_val = data[trace_info['var_names'][0]][0];
if(update_val || update_val==0){ if(update_val || update_val==0){
var units = plot_info.yaxis.units; var units = plot_info.yaxis.units;
......
...@@ -42,6 +42,10 @@ function getSpeedMPH(val) { ...@@ -42,6 +42,10 @@ function getSpeedMPH(val) {
// convert m/s to mph // convert m/s to mph
return val * 3600 / 1608; return val * 3600 / 1608;
} }
function getSpeedKnotsToMPH(val) {
// convert knots to mph
return val * 1.15078;
}
function getSpeedKTS(val) { function getSpeedKTS(val) {
//m/s to knots //m/s to knots
return val * 1.94384; return val * 1.94384;
...@@ -58,10 +62,16 @@ function getAccumMillimeter(val) { ...@@ -58,10 +62,16 @@ function getAccumMillimeter(val) {
// convert inches to millimeters // convert inches to millimeters
return val * 25.4; return val * 25.4;
} }
function getAccumMillimeterToInches(val) {
// convert millimeters to inches
return val / 25.4;
}
function cardinalWDir(degrees){ function cardinalWDir(degrees){
if (isNaN(degrees)) {
return "N/A";
}
return ['N','NNE','NE','ENE', return ['N','NNE','NE','ENE',
'E','ESE','SE','SSE', 'E','ESE','SE','SSE',
'S','SSW','SW','WSW', 'S','SSW','SW','WSW',
...@@ -83,7 +93,9 @@ var CONVERSION_FUNCTIONS = { ...@@ -83,7 +93,9 @@ var CONVERSION_FUNCTIONS = {
getF: getF, getF: getF,
getPresInHg: getPresInHg, getPresInHg: getPresInHg,
getSpeedMPH: getSpeedMPH, getSpeedMPH: getSpeedMPH,
getSpeedKnotsToMPH: getSpeedKnotsToMPH,
getAccumMillimeter: getAccumMillimeter, getAccumMillimeter: getAccumMillimeter,
getAccumMillimeterToInches: getAccumMillimeterToInches,
cardinalWDir: cardinalWDir, cardinalWDir: cardinalWDir,
getSpeedKTS:getSpeedKTS getSpeedKTS:getSpeedKTS
}; };
...@@ -197,9 +209,26 @@ function getTickVals(min, max, bump) { ...@@ -197,9 +209,26 @@ function getTickVals(min, max, bump) {
} }
function preConvertValue(values, axis_info) {
/**
* Convert values before inserting them into the final storage array.
*/
if (!('preconvert_value' in axis_info)) {
return;
}
var val;
for (var i=0; i < values.length; i++) {
val = CONVERSION_FUNCTIONS[axis_info.preconvert_value](values[i]);
val = (val.toFixed)?val.toFixed(axis_info.precision):val;
values[i] = val;
}
}
module.exports.getTickVals = getTickVals; module.exports.getTickVals = getTickVals;
module.exports.getProbeText = getProbeText; module.exports.getProbeText = getProbeText;
module.exports.getTickText = getTickText; module.exports.getTickText = getTickText;
module.exports.preConvertValue = preConvertValue;
......