Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tutorial documentation and set up instruction improvements #87

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 57 additions & 14 deletions source/d_apitutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,76 @@
API tutorials
==============================

We created interactive manuals for data scientists to use the Lizard API.
At the moment we have the following:
New to using Lizard?
You have come to the right place: read this material to quickly get up and running.
Throughout this interactive manual for data scientists, we’ll walk you through basic Lizard API interactions.
Currently the following information is available:

0. Virtual Environment
----------------------
For working in local environment, the required Python packages can be found in: `requirements.txt <https://github.com/nens/lizard-docs/blob/master/source/files/tutorials/requirements.txt>`_.

| `Virtual Environment Requirements <https://demo.lizard.net/media/tutorials/requirements.txt>`_
0. Jupyter Notebook kernel installation instructions
-----------------------------------------------------

For local development using Jupyter Notebook, it's recommended to create the Jupyter kernel in a Python virtual environment.
Once created and activated, packages can be installed in the environment with Conda or pip.
Follow instructions explain the steps to install the kernel in the virtual environment.

1. Interactive Time Series API manual
-------------------------------------
1. Open a new terminal of the ``cmd`` command prompt.

| `Notebook for /api/v4/timeseries <https://demo.lizard.net/media/tutorials/Lizard_Time_Series_API_V4_Tutorial.ipynb>`_
2. Navigate to a directory where you want to install your virtual environment.

- Navigate to a directory by running the command ``cd {directory}``.

2. Interactive Rasters API manual and download script
-----------------------------------------------------
3. Create the virtual environment in the selected directory.

- Run: ``py -m venv {virtual environment name}``.

- Example, run: ``py -m venv lizard``.

4. Activate the environment.

- Run: ``./{virtual environment name}\Scripts\activate.bat``.

- Example, run: ``.\lizard\Scripts\activate.bat``.

- You should now see ``({virtual environment name})`` before the terminal line.

5. Download the `requirements.txt <https://github.com/nens/lizard-docs/blob/master/source/files/tutorials/requirements.txt>`_.

| `Notebook for /api/v4/rasters <https://demo.lizard.net/media/tutorials/Getting_familiair_with_Lizard_Rasters_API.ipynb>`_
- Example, run: ``wget -O requirements.txt https://raw.githubusercontent.com/nens/lizard-docs/master/source/files/tutorials/requirements.txt``.

| `Download script for /api/v4/rasters <https://demo.lizard.net/media/tutorials/export_lizard_raster_layers.py>`_
6. To install the packages.

- Run: ``.\{virtual environment name}\bin\pip install -r \path\to\requirements.txt``.

3. Learn to retrieve scenarios from the Lizard API
- Example, run: ``.\lizard\bin\pip install -r C:\Users\steven\Downloads\requirements.txt``.

| `Notebook for 3Di results / Scenarios in Lizard <https://demo.lizard.net/media/tutorials/How_to_download_a_maximum_waterdepth_raster_from_a_3Di_scenario_stored_in_the_Scenario_Archive_in_Lizard_.ipynb>`_
7. Create a Jupyter kernel in the virtual environment for the specific tutorial.

- Run: ``.\{virtual environment name}\bin\ipython kernel install --user --name=raster_tutorial``.

8. Open the Jupyter Notebook from inside the virtual environment.

- Run: ``.\{virtual environment name}\bin\jupyter notebook``.

Once Jupyter has started, open the preferred notebook.
The newly created kernel can be selected through the menu.

1. Interactive Time Series API manual
-----------------------------------------------------
For `/api/v4/timeseries` open `Google Colab Time Series <https://colab.research.google.com/github/nens/lizard-docs/blob/master/source/files/tutorials/Lizard_Time_Series_API_V4_Tutorial.ipynb>`_,
or download the `Jupyter Notebook Time Series <https://github.com/nens/lizard-docs/blob/master/source/files/tutorials/Lizard_Time_Series_API_V4_Tutorial.ipynb>`_.

2. Interactive Rasters API manual
-----------------------------------------------------
For `/api/v4/rasters` open `Google Colab Rasters <https://colab.research.google.com/github/nens/lizard-docs/blob/master/source/files/tutorials/Lizard_Rasters_API_V4_Tutorial.ipynb>`_,
or download the `Jupyter Notebook Rasters <https://github.com/nens/lizard-docs/blob/master/source/files/tutorials/Lizard_Rasters_API_V4_Tutorial.ipynb>`_.
Aditonally, download script `export_lizard_raster_layers.py <https://demo.lizard.net/media/tutorials/export_lizard_raster_layers.py>`_.

3. Interactive Retrieve Scenarios API manual
-----------------------------------------------------
For retrieving 3Di results / scenarios in Lizard, open `Google Colab Retrieve Scenarios <https://colab.research.google.com/github/nens/lizard-docs/blob/master/source/files/tutorials/Lizard_Retrieve_Scenarios_API_V4_Tutorial.ipynb>`_,
or download the `Jupyter Notebook Retrieve Scenarios <https://github.com/nens/lizard-docs/blob/master/source/files/tutorials/Lizard_Retrieve_Scenarios_API_V4_Tutorial.ipynb>`_.

.. note::
API v4 is the stable API version. API v3 is deprecated since june 2023.
2 changes: 2 additions & 0 deletions source/files/tutorials/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.ipynb_checkpoints
.venv
Loading
Loading