Coder Social home page Coder Social logo

domeniconappo / lisflood-code Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ec-jrc/lisflood-code

3.0 1.0 0.0 9.43 MB

Lisflood OS (LISFLOOD)

Home Page: https://ec-jrc.github.io/lisflood

License: European Union Public License 1.2

Dockerfile 0.43% Python 97.64% Shell 1.93%

lisflood-code's Introduction

Lisflood OS

This repository hosts source code of LISFLOOD model. Go to Lisflood OS page for more information.

Other useful resources

Project Documentation Source code
Lisflood Model docs https://github.com/ec-jrc/lisflood-code (this repository)
User guide
Lisvap Docs https://github.com/ec-jrc/lisflood-lisvap
Calibration tool Docs https://github.com/ec-jrc/lisflood-calibration
Lisflood Utilities https://github.com/ec-jrc/lisflood-utilities
Lisflood Usecases https://github.com/ec-jrc/lisflood-usecases

Quick start

You can download code and datasets for testing the model. Follow this instruction for a basic test (Drina catchment, included in this repository under tests/data/Drina)

  1. Clone the master branch of this repository (you need to have git installed on your machine).
git clone --single-branch --branch master https://github.com/ec-jrc/lisflood-code.git
  1. Install requirements into a python 2.7 virtualenv
cd lisflood-code
pip install -r requirements.txt

You need to install PCRaster and include its python interface in PYTHONPATH environment variable. For details, please follow instruction on official docs.

  1. Compile the cython module kinematic_wave_parallel_tool

To compile this Cython module to enable OpenMP multithreading (parallel kinematic wave):

  • Delete the files *.so (if any) in directory hydrological-modules

  • Inside the hydrological_modules folder, execute "python2 compile_kinematic_wave_parallel_tools.py build_ext --inplace"

Important: the module has to be compiled on the machine where the model is run - the resulting binary is not portable.

Then in the settings file the option "numberParallelThreadsKinematicWave" may take the following values: - "0" : auto-detection of the machine/node's number of CPUs (all CPUs are used minus 1) (do not set it if other simulations are running on the same machine/node) - "1" : serial execution (not parallel) - "2", "3", ... : manual setting of the number of parallel threads. (if exceeding the number of CPUs, the option is set to "0") -->

<textvar name="numCPUs_parallelKinematicWave" value="3"/>
  1. Run a cold run for the Drina test catchment

Now your environment should be set up to run lisflood. Try with a prepared settings file for Drina catchment:

python src/lisflood/lisf1.py tests/data/Drina/settings/lisfloodSettings_cold_day_base.xml

If the command above successed without errors, producing dis.nc into tests/data/Drina/outputs folder, your lisflood installation was correct.

Docker image

You can use the updated docker image to run lisflood, so without taking care to install dependencies on your system. First, you pull image from repository.

docker pull efas/lisflood:latest

Copy Drina catchment files from container to your host, using mapped directories.

docker run -v /absolute_path/to/my/local/folder:/usecases efas/lisflood:latest usecases

After this command, you can find all files to run a test against Drina catchment under the directory you mapped: /absolute_path/to/my/local/folder/Drina

Now, you can run LISFLOOD as a docker container to test the Drina catchment. Only thing you need to do is to map the Drina folder to the container folder input, by using -v option. In the XML settings file, all paths are adjusted to be relative to the very same settings file, so you don't need to edit paths, as long as you keep same folders structure.

Execute the following to run the simulation:

docker run -v /absolute_path/to/my/local/folder/Drina:/input efas/lisflood /input/settings/lisfloodSettings_cold_day_base.xml

Once LISFLOOD finished, you can find reported maps in /absolute_path/to/my/local/folder/Drina/outputs/ folder.

Pypi packaged LISFLOOD

LISFLOOD is also distributed as a standard python package. You can install the pip package in your Python 2.71 virtualenv:

pip install lisflood-model

Command above will also install the executable lisflood in the virtualenv, so that you can run LISFLOOD with the following:

lisflood /absolute_path/to/my/local/folder/Drina/settings/lisfloodSettings_cold_day_base.xml

1: We planned to migrate to Python 3 in a few months.

lisflood-code's People

Contributors

thiemve avatar domeniconappo avatar emiliano-gelati avatar valeriolorini avatar eccinziamazzetti avatar spadaal avatar

Stargazers

Arthur Hrast Essenfelder avatar Xuejian Cao avatar  avatar

Watchers

James Cloos 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.