Giter VIP home page Giter VIP logo

egsim's Introduction

eGSIM

A web service for selecting and testing ground shaking models in Europe (eGSIM), developed in the framework of the Thematic Core Services for Seismology of EPOS-IP (European Plate Observing System-Implementation Phase)

Installation (development)

Disclaimer: this is a temporary tutorial tested with MacOS (El Capitan) and Ubuntu 16.04.

Requirements (Ubuntu specific, in Mac should not be an issue, otherwise brew isntall instead of apt-get install):

brew doctor  # pre-requisite
brew update # pre-requisite
brew install gcc
sudo apt-get install git python3-venv python3-pip python3-dev

Please use Python 3.7+. Check with python --version: If it's Python2, then use python3 --version. If it's not 3.7+, then you need to install Python3.7 along with (i.e., not replacing) the current default python3 installed on your computer. From now on, each python command refers to the path of the Python3.7 distribution you have (i.e., you might need to type e.g. /opt/lib/python3.7 or something similar, instead of python or python3)

Activate virtualenv (links TBD).

[Pending: doc TBD] Three options:

  1. python-venv (for python>=3.5): Please use this option as it does not issues the 'matplotlib installed as a framework ...' problem
  2. python-virtualenv
  3. virtualenvwrapper (our choice)

FROM NOW ON virtualenv MUST be activated! EVERYTHING WILL BE INSTALLED ON YOUR "copy" of pyhton with no conflicts with the OS python distribution

Upgrade pip and setuptools:

pip install -U pip setuptools

Clone this repository

git clone and so on (see Github). From now on we assume you are inside the git repo (the local folder you clone the project into)

Install

pip install -r ./requirements.dev.txt

Test

Normal test (x=stop at first error, v*=increase verbosity):

pytest -xvvv --ds=egsim.settings_debug ./tests/

Test with coverage

pytest -xvvv --ds=egsim.settings_debug --cov=./egsim/ --cov-report=html ./tests/

Setup project data

Flatfile (ESM):

This procedure should be executed for all flatfiles to be included in the application. For testing purposes, we will use ESM flatfile (2018) only. Download ESM flatfile from https://esm.mi.ingv.it//flatfile-2018/flatfile.php (ESM_flatfile_2018) Unzip it and from within the same directory, copy the file:

cp ESM_flatfile_2018/ESM_flatfile_SA.csv ./ESM_flatfile_2018_SA.csv

Called $FLATFILE_PATH the full path of the CSV file just copied, now parse it into the ESM database, the database will be a HDF5 file inside the /media/ directory of the egsim repository (git ignores that directory):

export DJANGO_SETTINGS_MODULE="egsim.settings_debug";python manage.py gmdb_esm $FLATFILE_PATH

Migrate (setup django db)

From within the egsim folder (check that manage.py is therein):

export DJANGO_SETTINGS_MODULE="egsim.settings_debug";python manage.py migrate

Create db (setup egsim tables inside django db)

From within the egsim folder (check that manage.py is therein):

export DJANGO_SETTINGS_MODULE="egsim.settings_debug";python manage.py initdb

Run:

export DJANGO_SETTINGS_MODULE="egsim.settings_debug";python manage.py runserver

and pen your browser (or use the API) at the URL address on the console

Installation (production)

Please refer to 'deploy.html' (dynamic web page, open it in your browser of choice)

egsim's People

Contributors

rizac avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.