The easiest way to get started is to use our Docker container, which has everything pre-installed. Instructions for that are below.
If you don't have Docker, or don't want it, the next best way to install things is through a conda environment. However, this works in MacOS or Linux, but not windows. If you are in windows you will want to run a Windows Linux Subsystem instance. But if you are going to do that yo might as well use Docker.
Finally, you can just run the code in Google Colab or Microsoft Planetary Computer.
- Start Google Colab session.
- Install
lsdviztools
(and dependencies) usingpip
!pip install lsdviztools &> /dev/null
- Install condacolab (which gives you the package manager
mamba
):
!pip install -q condacolab
import condacolab
condacolab.install()
- Install
lsdtopotools
:
!mamba install -y lsdtopotools &> /dev/null
- That process should take less than 2 minuts and you are ready to go.
- Wait a long time for MPC to give you a server.
- Install
lsdviztools
(and dependencies) usingpip
!pip install lsdviztools &> /dev/null
- Install
lsdtopotools
(this seems to take a lot longer on MPC than on google colab):
!mamba install -y lsdtopotools &> /dev/null
- You should be ready to go. MPC takes longer to spin up. But it has ~32 GB of memory vs ~ 12GB on Google Colab.
These instructions are for using our Docker container. You can look at the readme there to see instructions for installing Docker.
- You will want to be able to see LSDTopoTools output on your host operating system, so you will need to create a directory for hosting your LSDTopoTools data, code, and scripts.
- For the purposes of this tutorial, I will assume you are using Windows and that you have made a directory
C:\LSDTopoTools
.
- You can put this directory anywhere you want as long as you remember where it is. You don't need to put anything in this directory yet.
Preamble: The new versions of Docker desktop use winsows linux subsystem to manage memory. The default is to use up all your memory, which is not ideal. To stop this you need to make a little file, called .wsclonfig
, and put it in your user directory (mine is C:\Users\smudd
). The file looks like this:
[wsl2]
memory=6GB # Limits VM memory in WSL 2 up to 3GB
processors=1 # Makes the WSL 2 VM use two virtual processors
you should adjust the memory accordingly. Now, we can run the container.
- To get the container, go into a terminal (MacOS or Linux) or Powershell window (Windows) that has docker enabled and run:
$ docker pull lsdtopotools/lsdtt_pytools_docker
- You need to open your docker container with a port: this port will host the jupyter notebooks:
# docker run -it -v C:\LSDTopoTools:/LSDTopoTools -p 8888:8888 lsdtopotools/lsdtt_pytools_docker
-
The
-it
means "interactive". -
The
-v
stands for "volume" and in practice it links the files in the docker container with files in your host operating system. -
After the
-v
you need to tell docker where the directories are on both the host operating system (in this caseC:\LSDTopoTools
) and the container (in this case/LSDTopoTools
). These are separated by a colon (:
). Note that you should update theC:\LSDTopoTools
to reflect the directory structure on your local machine. -
the
-p
stand for port.8888:8888
is the default. -
Once you do this you will get a
#
symbol showing that you are inside the container. You can now do LSDTopoTools stuff. -
Two of our packages are already installed in the container, these are
lsdviztools
andlsdtopytools
. You might also want to installlsdttparamselector
which includes an interface for running lsdtopotools analyses (Warning: the interface is still basic and does not have all the lsdtopotools analysis options.)
# pip install lsdttparamselector
- Then, inside the container, start the notebook:
# jupyter notebook --ip 0.0.0.0 --port 8888 --no-browser --allow-root
- When you run this command, it will give you some html addresses. These will not work from your host computer!! But these addresses do show you a
token
: you can see it in the address aftertoken=
. - Instead, go into a browser on your host computer and go to http://localhost:8888/
- Then, in the password box, insert the
token
that was shown in the docker container. - Yay, you can now start working with notebooks, using all the fun geospatial stuff that is in this container!
- The package
lsdttparamselector
allows you to select parameters for thelsdtopotools
command line tools. These can be run from an ipython notebook usinglsdviztools
. But you can also run the command line tools straight from a terminal window. - The command line tools are already install in the docker container. Try
# lsdtt-basic-metrics
- To see what is possible, check out the following documentation:
- Note: for the below instructions, you will need the example datasets. Grab these with
# sh Get_LSDTT_example_data.sh
- https://lsdtopotools.github.io/LSDTT_documentation/LSDTT_basic_usage.html
- https://lsdtopotools.github.io/LSDTT_documentation/LSDTT_channel_extraction.html
- https://lsdtopotools.github.io/LSDTT_documentation/LSDTT_chi_analysis.html
- We include a script to install some local python packages. To run, use:
# install_lsdtt_python_packages.sh
- This will install
lsdttparamselector
,lsdviztools
, andlsdtopytools
from local repositories that the script downloads. This means that you will get the latest version of the tools.
- Alternatively, you can install some of the tools with the latest tagged version:
$ pip install lsdviztools
$ pip install lsdttparamselector
These tools will then be installed via the pypi
repository.
-
Install miniconda on your computer (use the 64 bit python 3.7 version)
-
Start with some conda housekeeping
$ conda install -y -c conda-forge conda
$ conda config --add channels conda-forge
$ conda config --set channel_priority strict
- Make a conda environment. We'll used python 3.8
$ conda create -n lsdtt python=3.8
$ conda activate lsdtt
- Then run these conda commands. Warning! This will take a LONG time.
$ conda install -y lsdtopotools
$ conda install -y git python=3
$ conda install -y ipython ipykernel jupyter
$ conda install -y conda-build
$ conda install -y gdal rasterio geopandas matplotlib numpy scipy pytables numba feather-format pandas pip pybind11 xtensor xtensor-python fiona utm pyproj cartopy folium h5py lsdtopytools
$ pip install lsdttparamselector lsdviztools
You can set up the tools in google colab as well. Please see the lsdtopotools_on_colab.ipynb
file in this repository.
The notebooks in this repository work with various components of lsdtopotools, so check the readme in each subdirectory, or if that doesn't exist, just open the notebook. The subdirectories are named in a way that hopefully explains their contents.