|
|
# Introduction
|
|
|
|
|
|
niViz has been created as a very flexible visualization / edition tool that should cater to *all* the usage scenarios of the Snowpack community. Therefore, it is currently possible to address the following scenarios:
|
|
|
1. visualization / edition of snow profiles "on the go";
|
|
|
2. visualization / edition of snow profiles integrated within an operational system;
|
|
|
3. visualization / edition of snow profiles as a service, ie without requiring any software installation on the client's computer.
|
|
|
|
|
|
For the point (1), it is necessary to provide a package. The necessary steps to create a package are given in the section below. For the points (2) and (3), niViz must be installed in a server. The necessary steps are given in the last section.
|
|
|
|
|
|
# Creating a package
|
|
|
|
|
|
Although there is no need to package or even install niViz for the end user, it is necessary to properly package it when starting from the sources in order to be able to distribute it (specially for offline use) or make it available on a server as a service. The necessary steps are described in this section.
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
|
The following software must be installed on the computer where the packaging will be performed:
|
|
|
|
|
|
* the <A HREF="http://git-scm.com/">git</A> distributed version control system;
|
|
|
* the <A HREF="http://nodejs.org/">node.js</A> javascript framework, including the <A HREF="https://www.npmjs.com/">npm</A> package manager;
|
|
|
* make
|
|
|
|
|
|
It is highly recommended to install node.js from source in order to get a recent enough version (it currently works well with the latest version 0.12.0).
|
|
|
|
|
|
## Packaging
|
|
|
|
|
|
First, check out (or clone, in the git terminology) the latest version of niViz from <A HREF="https://gitlabext.wsl.ch/snow-models/niviz">the repository</A>. Then, follow the steps listed below, at the root of your checkout:
|
|
|
* **make dep**, this will download (using npm) all the required dependencies;
|
|
|
* **make dist**, this will package everything into the *dist* directory
|
|
|
* enter the *dist* directory, it contains a subdirectory and an *index.html* file. Opening this file in a browser starts niViz.
|
|
|
* in order to install niViz locally on a computer, simply copy this *dist* directory (or directly its content) on the computer.
|
|
|
|
|
|
# Installing
|
|
|
|
|
|
This covers two kind of installations: on a personal computer for potentially offline use and on a server.
|
|
|
|
|
|
## Personal installation
|
|
|
|
|
|
This makes it possible to use niViz without any Internet connection. The easiest way to install it would be from a package, but a git checkout would work the same (after properly packaging niViz as outline above). Then copy the *dist* directory on the target computer (you can rename it to something more meaningful) and start niViz by opening *dist/index.html* in a web browser. It can be a good idea to add a direct link to this *index.html* directly either in the bookmarks or in the start menu.
|
|
|
|
|
|
## Server installation
|
|
|
|
|
|
After installing your web server of choice (for example <A HREF="https://www.apache.org/">Apache</A>), copy the *dist* directory of niViz in one of the directories that is served by the web server. The easiest would be to copy it directly in the *server root* directory, but this depends on what other content is served by this machine. Rename the *dist* directory into something more meaningful (for example *niViz*) and make sure the ownership and permissions are right (most probably, it would need to belong to *www-data*). Make sure the web server is running, and open in a browser the URL for this installation, for example *http://my_server.com/niViz*.
|
|
|
|
|
|
If this server should serve operational content, then copy or link to the operational simulations' output directory. For example, if Snowpack runs on the same server, create a link in your *server root* pointing to the *output* directory of snowpack (in this example, we will name this link *current*). Now point your web browser to *http://my_server.com/index.html?file=current/WFJ2.pro* and this should automatically open the operational *WFJ2* simulation in niViz. Make sure the permissions and ownerships are right and check in the web server's logs if something does not work (most probably a path has not been properly set, a path is not accessible to the web server or the web server has been configured not to follow links). Finally, consider creating a web page that would contains such links for all your operational simulations so the users can simply open this web page, click on the link to the simulation they want and get directly the visualization in their browser. A script that does this automatically and that can be run as a cron job is available in the snowpack-operational toolchain. |