Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
npikall committed Aug 7, 2024
0 parents commit 26c6fe3
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/binder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Binder
on: [push]

jobs:
Create-MyBinderOrg-Cache:
runs-on: ubuntu-latest
steps:
- name: cache binder build on mybinder.org
uses: jupyterhub/repo2docker-action@master
with:
NO_PUSH: true
MYBINDERORG_TAG: ${{ github.event.ref }} # This builds the container on mybinder.org with the branch that was pushed on.
55 changes: 55 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Temporary and binary files
*~
*.py[cod]
*.so
*.cfg
!.isort.cfg
!setup.cfg
*.orig
*.log
*.pot
__pycache__/*
.cache/*
.*.swp
*/.ipynb_checkpoints/*
.DS_Store

# Project files
.ropeproject
.project
.pydevproject
.settings
.idea
.vscode
tags

# Package files
*.egg
*.eggs/
.installed.cfg
*.egg-info

# Unittest and coverage
htmlcov/*
.coverage
.tox
junit.xml
coverage.xml
.pytest_cache/

# Build and docs folder/files
build/*
dist/*
sdist/*
docs/api/*
docs/_rst/*
docs/_build/*
cover/*
MANIFEST

# Per-project virtualenvs
.venv*/
venv

# make file markers
.install*
88 changes: 88 additions & 0 deletions 01_eo-discover-eodag.ipynb

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions 01_eo-discover-eodag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 01_eo-discover-eodag
channels:
- conda-forge
dependencies:
- python=3.10
- pip
- mamba
- jupyter
- numpy
- scipy
- xarray
- zarr
- netcdf4
- pip:
- eodag
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.ONESHELL:
SHELL = /bin/bash
.PHONY: help clean environment kernel post-render data

YML = $(wildcard *.yml)
REQ = $(basename $(notdir $(YML)))

CONDA_ENV_DIR := $(foreach i,$(REQ),$(shell conda info --base)/envs/$(i))
KERNEL_DIR := $(foreach i,$(REQ),$(shell jupyter --data-dir)/kernels/$(i))
CONDA_ACTIVATE = source $$(conda info --base)/etc/profile.d/conda.sh ; conda activate ; conda activate


help:
@echo "Makefile for setting up environment, kernel, and pulling notebooks"
@echo ""
@echo "Usage:"
@echo " make environment - Create Conda environments"
@echo " make kernel - Create Conda environments and Jupyter kernels"
@echo " "
@echo " make teardown - Remove Conda environments and Jupyter kernels"
@echo " make clean - Removes ipynb_checkpoints"
@echo " make help - Display this help message"

clean:
rm --force --recursive .ipynb_checkpoints/

teardown:
for i in $(REQ); do conda remove -n $$i --all -y ; jupyter kernelspec uninstall -y $$i ; done

$(CONDA_ENV_DIR):
for i in $(YML); do conda env create -f $$i; done

environment: $(CONDA_ENV_DIR)
@echo -e "conda environments are ready."

$(KERNEL_DIR): $(CONDA_ENV_DIR)
pip install --upgrade pip
pip install jupyter
for i in $(REQ); do $(CONDA_ACTIVATE) $$i ; python -m ipykernel install --user --name $$i --display-name $$i ; conda deactivate; done

kernel: $(KERNEL_DIR)
@echo -e "conda jupyter kernel is ready."
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/TU Wien GEO MRS group/microwave_remote_sensing/main)

TODO: Add you lecture description.

# Generate Jupyter Conda environment and Jupyter Kernel from `yml`

To re-create the environment as a Jupyter kernel for execution of the notebooks, do the following:

- Open a Terminal from the same level as this Markdown README file.
- Type the following into the terminal.

```
make kernel
```

Select the kernel with the equivalent name as the `.ipynb` notebook to execute the notebook. For example, `01_lecture.ipynb` requires the kernel `01_lecture` for execution of the code blocks.

# Clean-up

To remove Jupyter checkpoints run:

```
make clean
```

In order to remove the Conda environments and Jupyter kernels runL

```
make teardown
```
30 changes: 30 additions & 0 deletions setup/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.ONESHELL:
SHELL = /bin/bash
.PHONY: help

GIT_ACCOUNT = TUW-GEO
REPO_NAME = microwave-remote-sensing
GIT_BRANCH = main
GIT_REPO = https://github.com/$(GIT_ACCOUNT)/$(REPO_NAME).git
ROOT = ~/$(REPO_NAME)


help:
@echo "Makefile for setting up environment, kernel, and pulling notebooks"
@echo ""
@echo "Usage:"
@echo " make notebooks - Clone notebooks to JupyterLab, install Conda environments and Jupyter kernels"
@echo " "
@echo " make delete - Remove Jupyter notebooks, Conda environments and Jupyter kernels"
@echo " make help - Display this help message"

notebooks:
git clone $(GIT_REPO) -b $(GIT_BRANCH) $(ROOT)
cd $(ROOT) && make kernel
@echo "Repository cloned to $(ROOT) and Jupyter kernels installed."

delete:
@echo "Deleting all files in $(ROOT)..."
cd $(ROOT) && make teardown
rm -rf $(ROOT)
@echo "$(ROOT) has been deleted."
27 changes: 27 additions & 0 deletions setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# DataLab JupyterHub

## Information for TU Wien Lecturers

This Makefile automatizes the process of cloning your GitHub repository to the student's JupyterLab Home folder. Before sharing this Makefile make sure that the account name, repository name, and branch name, are entered correctly. Place the Makefile in the Datalab Jupyter `shared` folder in order to make the notebooks available for students, or share the Makefile by any other means with the students.

## Information for TU Wien Students

To clone the lecturer's notebooks to your JupyterLab Home directory, do the following.

- Open a Terminal from the same level as this Markdown README file.
- Type the following into the terminal.

```
make notebooks
```

Select the kernel with the equivalent name as the `.ipynb` notebook to execute the notebook. For example, `01_lecture.ipynb` requires the kernel `01_lecture` for execution of the code blocks.

To remove the notebooks as well as the Jupyter kernels, do the following.

- Open a Terminal from the same level as this Markdown README file.
- Type the following into the terminal.

```
make delete
```

0 comments on commit 26c6fe3

Please sign in to comment.