Git Product home page Git Product logo

jellyrisk_forecaster's Introduction

jellyrisk_forecaster

Python app to build jellyfishes risk forecastings.

It works calibrating an ensemble of models using historical data and then using this model to predict the presence of jellyfishes in future dates.

The climatological and biological data, both historical and predictions, is downloaded from MyOcean. The historical jellyfish presence data is provided by the Maritimal Sciences Institute (ICM).

Data processing and modelling is performed using R and the package biomod2. The rest of the system is written in Python.

The detailed process is as follows:

  • Download historical data from MyOcean using motu-client, restricting the area to the region containing the beaches of interest and minimal depth.
  • Extract the value of each climatological variable at each beach, for all days, using R.
  • Combine the values for all climatological variables, beaches and days in one single table.
  • Add the historical Pelagia jellyfish presence. In our case this comes from the Institute of Marine Sciences.
  • Use this historical table to train an ensemble of models using the R package biomod2.
  • Download the forecast for climatological data for the area of interest from MyOcean using motu-client.
  • Extract the climatological variables forecasting values for the beaches of interest.
  • Apply the trained model to the new data to predict the presence of Pelagia jellyfish in a future day.

Setup

This instructions are tested in Ubuntu 10.04.4 LTS.

Install system requirements:

$ sudo apt-get install libgdal-dev libproj-dev

Add to /etc/apt/sources.list:

$ deb http://ftp.cixug.es/CRAN/bin/linux/ubuntu lucid/

Add pubkey for this PPA: $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9

Install biomod2 in R: $ R

install.packages('biomod2') install.packages('FNN') install.packages('raster') install.packages('rgdal') install.packages('nlme') install.packages('Matrix') install.packages('mgcv') install.packages('ncdf')

Create a virtualenv, activate it and do:

$ pip install -r requirements.txt

Clone our motu-client-python fork modified to work in python 2.7.x:

git clone [email protected]:Science-o-matic/motu-client-python.git

Copy the settings template file and modify to apply your settings:

$ cp jellyrisk_forecaster/settings.py.tmpl jellyrisk_forecaster/settings.py

To run the scripts, please set the environment variable JELLYRISK_SETTINGS_MODULE pointing to an accessible Python module with all the settings set:

  • CARTODB_API_KEY
  • CARTODB_DOMAIN
  • TEMP_FOLDER: folder to chdir to before executing the R script
  • DATA_FOLDER: folder with data files
  • Any celery-related config var. `app.config_from_object(JELLYRISK_SETTINGS_MODULE)' will be invoked.

Hint: Use virtualenv's postactivate and postdeactivate hooks.

Usage

You can run a prediction with:

$ jellyrisk_forecaster/predict_ahead.py

This will download MyOcean data, run R to generate a forecast for next 2 days, and send it to CartoDB maps so they're updated.

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.