Skip to content

Commit

Permalink
Add files
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-tomasini committed Dec 9, 2024
1 parent 28d4564 commit 56577ea
Show file tree
Hide file tree
Showing 93 changed files with 132,797 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

# This is a basic workflow to help you get started with Actions

name: Build-sphinx-docs

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ luca ]
pull_request:
branches: [ luca ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
PYTHONPATH: $(pwd)/src # Define the environment variable here
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: "3.12"

# WORKFLOW FOR SPHINX WITH PIP
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install sphinx nbsphinx myst_parser sphinx-copybutton sphinx_rtd_theme sphinx_rtd_size ghp-import pyomo
# - name: Build HTML
# run: |
# cd docs/
# make html
# - name: Run ghp-import
# run: |
# ghp-import -n -p -f docs/_build/html

# WORKFLOW FOR SPHINX WITH POETRY
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
poetry --version
- name: Install dependencies with Poetry
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry install
- name: Build HTML
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry run sphinx-build -b html docs/ docs/_build/html
- name: Run ghp-import
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry run ghp-import -n -p -f docs/_build/html
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
164 changes: 164 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
.envrc
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Ignore dynaconf secret files
.secrets.*
42 changes: 42 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"terminal.integrated.commandsToSkipShell": [
// Ensure the toggle sidebar visibility keybinding skips the shell
"workbench.action.toggleSidebarVisibility",
// Send quick open's keybinding to the shell
"-workbench.action.quickOpen",
],
"typescript.inlayHints.parameterTypes.enabled": true,
"typescript.inlayHints.propertyDeclarationTypes.enabled":true,
"terminal.integrated.env.osx": {
"PYTHONPATH": "${workspaceFolder}/src",
},
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}/src",
},
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder}/src",
},
// "python.terminal.launchArgs": [
// "-i"
// ],
"terminal.integrated.fontSize": 12,
"explorer.autoReveal": false,
"workbench.action.terminal.setDimension": 1000,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.analysis.extraPaths": [
"src/"
],
"python.analysis.autoImportCompletions": true,
"jupyter.notebookFileRoot": "${workspaceFolder}/src",
"pylint.args": [
"--max-line-length=450",
"--max-module-lines=10000",
],
"python.analysis.typeCheckingMode": "basic",
"files.autoSave": "afterDelay",
"editor.defaultFormatter": "njpwerner.autodocstring",
"autoDocstring.docstringFormat": "numpy",
"jupyter.runStartupCommands": [direnv allow .]
}
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
grid-synthesizer
=============

(Description to come...)

## Grid-synthesizer

### 1. Install pipx on wsl

```bash
sudo apt update
sudo apt install pipx
pipx ensurepath --force
```

### 2. Install python 3.12 on wsl (if not installed)

```bash
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.12
sudo apt install python3.12-venv
```

Reference: [Tutorial is the following link](https://www.linuxtuto.com/how-to-install-python-3-12-on-ubuntu-22-04/)

### 3. Install Poetry

```bash
pipx install poetry
```

### 4. Create virtual environment

```bash
python3.12 -m venv .venv
poetry env use .venv/bin/python3.12
```

### 5. Update .venv library

```bash
poetry update
```

> [!IMPORTANT]
> If psycopg-c installation raise the [error](https://stackoverflow.com/questions/77727508/problem-installing-psycopg2-for-python-venv-through-poetry): _psycopg-c (3.1.18) not supporting PEP 517 builds_
```bash
sudo apt install libpq-dev gcc
```

### 6. [Download docker](https://www.docker.com/)

### 7. Create docker container

```bash
docker compose up
```

## Other command

### Check which python is installed

```bash
which python3.12
```

### Check python version

```bash
/usr/bin/python3 --version
```

or

```bash
python3.12 --version
```
### Check the poetry linked environment

```bash
poetry3.12 env info
```

### Check the Ubuntu

```bash
lsb_release -a
```

### Initialize pyproject.toml

```bash
poetry init
```
10 changes: 10 additions & 0 deletions data/input_file_names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"market_price_metadata": ".cache/input/alpiq_input_data/metadata.json",
"greis_wsl_data": ".cache/input/gries_wsl_input_data",
"aegina_pve_data": ".cache/input/pve_input_data/Aegina",
"merezenbach_pve_data": ".cache/input/pve_input_data/Merezenbach/HPT_Results_Simulation_Zup_1842.7masl_Zdown_1337.7masl.txt",
"morel_pve_data": ".cache/input/pve_input_data/Morel",
"aegina_water_volume_table": ".cache/input/greis_fmv_input_data/water_volume_table.csv",
"aegina_basin_height_data": ".cache/input/greis_fmv_input_data/KWA_Seeniveau_2018-2023.csv",
"aegina_wind_turbine_production" : ".cache/input/greis_fmv_input_data/wind_turbine_timeseries"
}
Loading

0 comments on commit 56577ea

Please sign in to comment.