Skip to content

Commit

Permalink
Adding static release
Browse files Browse the repository at this point in the history
  • Loading branch information
bgailleton committed May 20, 2021
1 parent cab0a08 commit 16b53fc
Show file tree
Hide file tree
Showing 304 changed files with 160,331 additions and 62 deletions.
86 changes: 24 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# lsdtopytools

Repository for `lsdtopytools`. So far, it only contains instructions to install and wheels (python installers). Will evolve soon. Source code in the `LSDTT_development` repository. `lsdtt-xtensor-python` is a direct wrapper to the `c++` code and `lsdtopytools` a nicer `python` interface easier to use.
Repository for `lsdtopytools`, a python wrapper on LSDTopoTools. It binds the c++ code with `lsdtt-xtensor` and expose it to `python` via `numpy`. It allows us to take advantage of both world: `c++` speed and python flexibility. `lsdtopytools` suite can be done using Docker or Anaconda.

`lsdtopytools` suite can be done using Docker or Anaconda, you have the choice, really.
This repository host the static version of the code available for installation, it is updated at each release (usually when we are publishing a new manuscript utilising new features). Tutorial and example notebooks can be found in [this dedicated repository](https://github.com/LSDtopotools/lsdtt_notebooks/tree/master/lsdtopytools).

# Features

- Raster i/o and basic operations
- Preprocessing depressions (carving, filling, nodata, ...)
- River extraction (drainage area threshold)
- ksn from segmented profiles (Mudd et al. 2014)
- concavity index (Mudd et al., 2018, Gailleton et al., 2021 (preprint))
- polyfit metrics
- ...

# Installation using docker

Expand All @@ -12,63 +22,37 @@ See https://github.com/LSDtopotools/lsdtt_pytools_docker for intruction on how t

## Installation through `conda` and `pip`

Best installation is from `conda`, it has been tested for windows and different linuxes. Other OSes will need to build from source (explanation bellow).
You need first to have a valid installation of `anaconda` on your computer. I really reccomend `miniforge` [see readme here](https://github.com/conda-forge/miniforge) which guarentee a full open-source and open-license installation.

First create a `conda` environment and activate it:
Installation from `conda` has been tested for windows10, MacOS and different linuxes (ubuntu, Debian, Redhat, WSL). Other OSes will need to build from source (explanation bellow).

First create a `conda` environment `with python <= 3.8` (3.9 will come shortly) and activate it:

```
conda create -n lsdtopytools python=3.7
conda create -n lsdtopytools python=3.8
conda activate lsdtopytools
```

**RECOMENDED STEP** - *basically except if you have a specific reason not to do it*: you need to fix an annoying tendency of gdal to rely on messed up dependencies:
**RECOMENDED STEP IF YOU HAVE ANOTHER DISTRIBUTION THAN MINIFORGE**: you need to fix an annoying tendency of gdal to rely on messed up dependencies:
```
conda config --prepend channels defaults
conda config --prepend channels conda-forge
conda config --set channel_priority strict
```

Then install the required dependencies:

```
conda install -c conda-forge gdal rasterio geopandas matplotlib=3.1 numpy scipy pytables numba feather-format pandas pip pybind11 xtensor xtensor-python
```

We are now ready to install the wheels, let's clone the github repository on the computer:

```
git clone https://github.com/LSDtopotools/lsdtopytools
```

This downloads the ropository in the current folder, then you can navigate to teh wheels and list the files:
Then, you can install by simply running:

```
cd lsdtopytools/wheels/lsdtt-xtensor-python
ls
conda install lsdtopytools
```

This will display the available wheels. One of them should correspond to your architecture (= computer type).

```
pip install lsdtt_xtensor_python-YYY-cp37-cp37m-XXX.whl
```
where YYY is the latest version of lsdtt-xtensor-python, e.g. `0.0.3`, and XXX your architecture, e.g. `linux_x86_64` for linux 64 bits. Finally:

```
cd ../lsdtopytools
pip install lsdtopytools-XXX-py2.py3-none-any.whl
```

where XXX is the latest version available. And everything is installed!

## No compatible wheels for lsdtt-xtensor-python?
## Something went wrong

In that case you need to check several things:
- You are on iOS, I do not own a mac and cannot generate the wheel, you need to generate it from source.
- You are on a previously created conda environment and trying to install lsdtt-xtensor-python in it, check that you DO have `python=3.7.X`
- You have a `32 bits` OS/processor, You need to install from source (also it's been like 15 years all the computers are 64 bits)
- You are on an antiquated computer unable to get recent `libc`, `libc++` or `libstdc++`, there is nothing we can do unfortunately although I'd be surprised if it happens.
- You have a `32 bits` OS/processor, You need to install from source (also it's been like 15 years all the computers are 64 bits, this is the reason we do not guarentee compatibility)
- You are on an antiquated computer unable to get recent `libc`, `libc++` or `libstdc++`, there is nothing we can do unfortunately although I'd be surprised if it happens. We need `c++14` for `lsdtt-xtensor` and that is a hard-pass unfortunately.

## Installation from source

Expand All @@ -91,32 +75,10 @@ pip install .
```
Done.

# Updating the code

So far I will post updated wheel in that repository, in the future I will create a more sofisticated and simpler installing method. To update the `lsdtt-xtensor-python`:

```
pip uninstall -y lsdtt-xtensor-python
cd wheels/lsdtt-xtensor-python
pip install XXX
```

where XXX is the newest wheel. To update `lsdtopytools`:

```
cd wheels/lsdtopytools
pip install --force-reinstall --no-deps XXX
```
where XXX is the newest wheel.

# Quick start

I will put tutorial and example scripts and jupyter notebooks in the future.

# Troubleshoots

- **[LINUX] GLIBC error**: I am working on it, but basically your linux is older than the one with which I installed it and does not have as recent glibc. Good news is that there is a solution, bad news is that It will take me a bit of time to implement and you need to install from source. I need to build `manylinux2010` wheels which involve using docker, which is not compatible with any of my hardware without accessing the BIOS and I cannot.

So far in early development stage, all of that code will evolve very rapidly and probably drastically. Contact `b.gailleton@sms.ed.ac.uk` for questions.
So far in early development stage, all of that code will evolve very rapidly and probably drastically. Contact `boris.gailleton@gfz-potsdam.de` for questions.


17 changes: 17 additions & 0 deletions lsdtopytools/AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
=======
Credits
=======

Development Lead
----------------

* Boris Gailleton <[email protected]>

Contributors
------------

* Python development: Boris Gailleton

* Cpp lsdtopotools: Simon M. Mudd (lead dev.), (unordered) Dave T. Miladowski, Stuart Grieves, Fiona J. Clubb, Declan Valters, Boris Gailleton

* lsdtopytools alpha tester: Emma Graf, Jorien Van Der Hoeven, Rebbeca Harries, Arturo Tamay
128 changes: 128 additions & 0 deletions lsdtopytools/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
.. highlight:: shell

============
Contributing
============

Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.

You can contribute in many ways:

Types of Contributions
----------------------

Report Bugs
~~~~~~~~~~~

Report bugs at https://github.com/bgailleton/lsdtopytools/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.

Fix Bugs
~~~~~~~~

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.

Implement Features
~~~~~~~~~~~~~~~~~~

Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.

Write Documentation
~~~~~~~~~~~~~~~~~~~

LSDTopyTools could always use more documentation, whether as part of the
official LSDTopyTools docs, in docstrings, or even on the web in blog posts,
articles, and such.

Submit Feedback
~~~~~~~~~~~~~~~

The best way to send feedback is to file an issue at https://github.com/bgailleton/lsdtopytools/issues.

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)

Get Started!
------------

Ready to contribute? Here's how to set up `lsdtopytools` for local development.

1. Fork the `lsdtopytools` repo on GitHub.
2. Clone your fork locally::

$ git clone [email protected]:your_name_here/lsdtopytools.git

3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::

$ mkvirtualenv lsdtopytools
$ cd lsdtopytools/
$ python setup.py develop

4. Create a branch for local development::

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

Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox::

$ flake8 lsdtopytools tests
$ python setup.py test or py.test
$ tox

To get flake8 and tox, just pip install them into your virtualenv.

6. Commit your changes and push your branch to GitHub::

$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature

7. Submit a pull request through the GitHub website.

Pull Request Guidelines
-----------------------

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

1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check
https://travis-ci.org/bgailleton/lsdtopytools/pull_requests
and make sure that the tests pass for all supported Python versions.

Tips
----

To run a subset of tests::


$ python -m unittest tests.test_lsdtopytools

Deploying
---------

A reminder for the maintainers on how to deploy.
Make sure all your changes are committed (including an entry in HISTORY.rst).
Then run::

$ bumpversion patch # possible: major / minor / patch
$ git push
$ git push --tags

Travis will then deploy to PyPI if tests pass.
8 changes: 8 additions & 0 deletions lsdtopytools/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=======
History
=======

0.0.1 (2018-11-07)
------------------

* First release on PyPI.
33 changes: 33 additions & 0 deletions lsdtopytools/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

High-level interface to LSDTopoTools in pyhton. Include as much tools as we can port in python, for the rest see our docker solutions
Copyright (C) 2018 Boris Gailleton

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

11 changes: 11 additions & 0 deletions lsdtopytools/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include AUTHORS.rst
include CONTRIBUTING.rst
include HISTORY.rst
include LICENSE
include README.rst

recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]

recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
Loading

0 comments on commit 16b53fc

Please sign in to comment.