Blame view

README.md 2.35 KB
19268da3   Goutte   Initial commit.
1

5f63c83b   Goutte   Lint.
2
## http://heliopropa.irap.omp.eu
19268da3   Goutte   Initial commit.
3
4
5
6
7

# What

## Web Server

6b149919   Goutte   Add a Download bu...
8
Build and serve heliopropa's visualizations.
e5a796dc   Goutte   Update the readme...
9
It's a `flask` webserver, serving `d3.js` plots.
6b149919   Goutte   Add a Download bu...
10
It also gathers NetCDF data from AMDA, and serves it as CSV to the plotter.
19268da3   Goutte   Initial commit.
11
12
13
14


### Rationale

6b149919   Goutte   Add a Download bu...
15
16
- Reading NetCDF from javascript is doable, but still *very* hacky.
- The bridge can handle pagination and collecting multiple NetCDF into one CSV.
19268da3   Goutte   Initial commit.
17
18
19
20


# How

d08bc6bc   Goutte   Lint the README.
21
22
23
24
25
## Source

https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE


19268da3   Goutte   Initial commit.
26
27
28
29
## Overview

- `config.yml` : the main configuration file.
- `web/run.py` : the front controller, holding most of the code.
6b149919   Goutte   Add a Download bu...
30
- `web/view/home.html.jinja2` : the HTML template.
d1c44c51   Goutte   Enable Earth
31
- `web/static/js/swapp.ls` : most of the javascript client-side.
19268da3   Goutte   Initial commit.
32
33
34
35
36
37
38


## Install

``` bash
virtualenv venv
source venv/bin/activate
f10f34d1   Goutte   More logic.
39
40
pip install matplotlib
pip install numpy==1.8.*
19268da3   Goutte   Initial commit.
41
42
43
pip install -r requirements.txt
```

f10f34d1   Goutte   More logic.
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
### CentOs 6 Shenanigans

``` bash
yum install https://centos6.iuscommunity.org/ius-release.rpm
yum install python27*
```

But then `virtualenv` yields

```
File "/var/www/html/HELIOPROPA/web/run.py", line 24, in <module>
[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119]     from netCDF4 import Dataset, date2num
[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119]   File "/var/www/html/HELIOPROPA/venv/lib/python2.7/site-packages/netCDF4/__init__.py", line 3, in <module>
[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119]     from ._netCDF4 import *
[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119] ImportError: /var/www/html/HELIOPROPA/venv/lib/python2.7/site-packages/netCDF4/_netCDF4.so: undefined symbol: PyUnicodeUCS2_FromStringAndSize
```

_Solution:_
Configure Apache to use `web/run_ssa.wsgi` and use pip2.7 install system wide.


### Install libcdf.

``` bash
wget https://spdf.sci.gsfc.nasa.gov/pub/software/cdf/dist/cdf37_0/linux/cdf37_0-dist-all.tar.gz
tar -xzvf cdf37_0-dist-all.tar.gz
cd cdf37_0-dist
make all OS=linux ENV=gnu
make INSTALLDIR=/usr/local/lib/libcdf install
```
19268da3   Goutte   Initial commit.
74
75
76
77
78
79
80
81
82

## Develop

``` bash
source venv/bin/activate
python web/run.py
```

Then, browse [localhost:5000](http://localhost:5000).
5ef50583   Goutte   Clean up.
83

d08bc6bc   Goutte   Lint the README.
84

5ef50583   Goutte   Clean up.
85
86
87
88
89
90
91
92
## Troubleshoot

### Installing scipy

Getting `MemoryErrors` ?
Try with the `--no-cache-dir` option.

`pip install scipy --no-cache-dir`
9c314ef2   Goutte   Add instructions ...
93
94
95
96
97
98
99

### Fix permissions problems with the cache

```
sudo setfacl  -R -m u:apache:rwx -m u:`whoami`:rwx cache
sudo setfacl -dR -m u:apache:rwx -m u:`whoami`:rwx cache
```