Package: lisflood-model
Lisflood OSThis repository hosts source code of LISFLOOD model.
Go toLisflood OS pagefor more information.Other useful resourcesProjectDocumentationSource codeLisfloodModel docshttps://github.com/ec-jrc/lisflood-code(this repository)User guideLisvapDocshttps://github.com/ec-jrc/lisflood-lisvapCalibration toolDocshttps://github.com/ec-jrc/lisflood-calibrationLisflood Utilitieshttps://github.com/ec-jrc/lisflood-utilitiesLisflood Usecaseshttps://github.com/ec-jrc/lisflood-usecasesQuick startYou can use conda environment to easily install dependencies.InstallminicondaCreate a conda env named "lisflood" and install dependencies:condacreate--namelisfloodpython=3.7-cconda-forge
condaactivatelisflood
condainstall-cconda-forgepcrastergdalInstall lisflood-model pypi packagepipinstalllisflood-modelCommand above will also install the executablelisfloodin the conda env, so that you can run LISFLOOD with the following:lisflood/absolute_path/to/my/local/folder/LF_ETRS89_UseCase/settings/cold.xmlYou can also clone the repository which contains datasets to test the model.
Follow this instruction for a basic test (included in this repository undertests/data)Clone the master branch of this repository (you need to have git installed on your machine).gitclone--single-branch--branchmasterhttps://github.com/ec-jrc/lisflood-code.gitInstall requirements into a python 3 conda envcondacreate--namelisfloodpython=3.7-cconda-forge
condaactivatelisflood
condainstall-cconda-forgepcrastergdalcdlisflood-code
pipinstall-rrequirements.txtIf you don't use conda but a plain virtualenv, you need to install PCRaster and GDAL by your own and include its python interface in PYTHONPATH environment variable.
For details, please follow instruction onofficial docs.Run a cold run for the test catchmentNow your environment should be set up to run lisflood. Try with a prepared settings file for one of the two test catchments:mkdirtests/data/LF_ETRS89_UseCase/out
pythonsrc/lisf1.pytests/data/LF_ETRS89_UseCase/settings/cold.xmlIf the command above successed without errors, producing dis.nc into tests/data/LF_ETRS89_UseCase/out folder, your lisflood installation was correct.Docker imageYou can use the updated docker image to run lisflood, so without taking care to install dependencies on your system.Pull image from repository:dockerpulljrce1/lisflood:latestRun test catchments in image:dockerrun-v/absolute_path/to/my/local/folder:/usecasesjrce1/lisflood:latestusecasesAfter this command, you can find all files to run tests against catchments under the directory you mapped:/absolute_path/to/my/local/folder//absolute_path/to/my/local/folder/LF_ETRS89_UseCase
/absolute_path/to/my/local/folder/LF_lat_lon_UseCaseNow, you can run LISFLOOD as a docker container to test included catchments. Only thing you need to do is to map the test catchment folder to the container folderinput, 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 lisflood with a Docker image:dockerrun-v/absolute_path/to/my/local/folder/LF_ETRS89_UseCase:/inputjrce1/lisflood/input/settings/cold.xmlOnce LISFLOOD finished, you find reported maps in/absolute_path/to/my/local/folder/LF_ETRS89_UseCase/out/folder.Pypi packaged LISFLOODLISFLOOD is also distributed as a standard python package. You can install the pip package in your Python 3 virtualenv:pipinstalllisflood-modelCommand above will also install the executablelisfloodin the virtualenv, so that you can run LISFLOOD with the following:lisflood/absolute_path/to/my/local/folder/LF_ETRS89_UseCase/settings/cold.xmlIMPORTANT NOTE 1Please note that there are known issues when installing the LISFLOOD code on Windows (source code and pypi package). We cannot provide Windows support and strongly recommend using LINUX to install the LISFLOOD code.
Windows users are recommended to execute LISFLOOD with a Docker image.IMPORTANT NOTE 2The users are recommended to download thereference settings xmlfile and adapt it by inserting their own paths and modelling choices.CollaborateIf you find an issue in our code, please follow theGitHub flowto propose your changes (Fork, commit your changes and ask for a Pull Request).
You are required to run unit tests during your development and before to propose a pull request.To execute unit tests:pytesttests/Furthermore, before to propose a pull request, there are additional tests we ask you to execute:pytesttests/-m"slow"These tests could take 30 minutes or several hours, depending on your machine.You can find full description and implementation details atTest documentationpage.Note: If yuor pull request is about a new feature you may want to integrate in LISFLOOD,
ensure to include tests with good coverage for it.For more info about pytest, seeofficial website.