Development

Credits

  • Michel Wortmann <wortmann@pik-potsdam.de> (development Lead), Potsdam Institute of Climate Impact Research, Germany

Change log

0.5 (2019-12-02)

  • MPI support to cluster.run_parallel and optional jobs or mp parallelism

  • Allow restarting optimization jobs

  • Record run_time in runs table

  • basin_parameters.set_defaults added

  • input and output interface plugins can now be instatiated by path without project

  • Generalisation of hydro.gumbel_recurrence to scipy distribution recurrence dist_recurrence

  • grass.GrassAttributeTable exposed from modelmanager.plugins.grass

0.4 (2019-07-11)

  • tests plugin renamed to test

  • Added more project-independent tests (water balance)

  • Lots of updating with SWIM/develop as m.swim/master

  • Various improvements and fixes

0.3 (2019-03-19)

  • Add optimization algorithms to default settings and include the evoalgos package to dependencies

  • Allow default stations.daily_discharge_observed loading through standardised CSV file in resource directory

  • Improved time management in optimization runs

  • Add crop output file interfaces

  • Allow project-specific tests in any file named swimpy/test_*.py

  • bug fixes and refactoring

0.2 (2019-02-25)

  • Extended setup to copy input files from SWIM’s test project

  • Separate swimpy.hydro module to bundle hydrology-related functionality

  • Various new output file interfaces

  • Bug fixes

0.1 (2018-10-09)

  • First release with all features listed in README

Contributing

Contributions are welcome, very little bit helps. You can contribute in many ways:

Report Bugs

Report bugs at https://gitlab.pik-potsdam.de/swim/swimpy/issues

If you are reporting a bug, please include:

  • Your operating system name and version.

  • Any details about your local setup that might be helpful in troubleshooting.

  • Detailed steps to reproduce the bug.

Submit a merge request

Ready to contribute? Here’s how to set up swimpy for local development.

  1. Fork the swimpy repository on Gitlab.

  2. Clone your fork locally:

    $ git clone git@gitlab.pik-potsdam.de:your_name_here/swimpy.git
    
  3. Install your local copy into a virtualenv as described in Setup a Python environment and Install from source.

  4. Create a branch for local development:

    $ git checkout -b name-of-your-bugfix-or-feature
    

    Now you can make your changes locally.

  5. Commit your changes and push your branch to GitLab:

    $ git add .
    $ git commit -m "Your detailed description of your changes."
    $ git push origin name-of-your-bugfix-or-feature
    
  6. Submit a pull request through the GitLab website.

Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

  1. The tests in swimpy/tests should pass without error in Python 2.7 and the latest stable Python 3 release. Consider adding tests for the additional code as well.

  2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring. If a module is added, a new file needs to be added to docs/modules and listed in docs/modules.rst.

Testing

As well as SWIMpy’s build-in testing suite for SWIM (swimpy.tests), the package comes with tests for its own code in tests/. They rely on the SWIM repository test project and the m.swim GRASS modules test grass database. Both these dependencies are git submodules in the dependencies/ directory and their tests need to be run before running SWIMpy’s tests:

git submodule update --init --recursive
cd dependencies/SWIM/project
make
cd ../m.swim/tests
make

To run the SWIMpy tests, install the version-frozen requirements (pip install -r requirements.txt) and then by running make in the tests/ directory. Individual tests can be run like this (e.g.):

$ python tests.py TestParameters.test_subcatch_parameters

Documentation

The documentation is produced by Sphinx and consists of the reStructuredText files and Jupyter Notebooks in docs/ as well as the docstrings included in the code. To build it, install the requirements_dev.txt packages, run the tests and execute:

$ make docs

docstrings should be formatted according to the NumpyDoc standards and/or according to the docutil reStructuredText. There is an online quick renderer here.

Releasing

A reminder for the maintainers on how to deploy:

  1. Pass tests with fresh environment created with pip install -e . and update requirements (pip freeze --exclude-editable > requirements.txt)

  2. Add entry to CHANGELOG.rst for major and minor.

  3. Change version in swimpy.__init__.py and README.md (semanitc versioning major.minor.patch, no v).

  4. Commit changes (e.g. $ git commit -m "Release 0.1.8").

  5. Tag commit with version number, e.g. v1.2.0

  6. Push commits and tags: $ git push ; git push --tags

  7. Update docs: $ make servedocs

Scroll To Top