Merge branch 'master' into cluster-m

This commit is contained in:
Fabian Neumann 2023-02-22 18:57:21 +01:00 committed by GitHub
commit 8512129f2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 13 deletions

View File

@ -39,7 +39,7 @@ repos:
# Make docstrings PEP 257 compliant # Make docstrings PEP 257 compliant
- repo: https://github.com/PyCQA/docformatter - repo: https://github.com/PyCQA/docformatter
rev: v1.6.0.rc1 rev: v1.5.1
hooks: hooks:
- id: docformatter - id: docformatter
args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"] args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"]
@ -67,7 +67,7 @@ repos:
# Do YAML formatting (before the linter checks it for misses) # Do YAML formatting (before the linter checks it for misses)
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.6.0 rev: v2.7.0
hooks: hooks:
- id: pretty-format-yaml - id: pretty-format-yaml
args: [--autofix, --indent, "2", --preserve-quotes] args: [--autofix, --indent, "2", --preserve-quotes]

View File

@ -33,7 +33,6 @@ dependencies:
- networkx - networkx
- scipy - scipy
- shapely>=2.0 - shapely>=2.0
- progressbar2
- pyomo - pyomo
- matplotlib<3.6 - matplotlib<3.6
- proj - proj

View File

@ -3,9 +3,11 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
import urllib
from pathlib import Path from pathlib import Path
import pandas as pd import pandas as pd
from tqdm import tqdm
REGION_COLS = ["geometry", "name", "x", "y", "country"] REGION_COLS = ["geometry", "name", "x", "y", "country"]
@ -251,16 +253,14 @@ def aggregate_costs(n, flatten=False, opts=None, existing_only=False):
def progress_retrieve(url, file): def progress_retrieve(url, file):
import urllib with tqdm(unit="B", unit_scale=True, unit_divisor=1024, miniters=1) as t:
from progressbar import ProgressBar def update_to(b=1, bsize=1, tsize=None):
if tsize is not None:
t.total = tsize
t.update(b * bsize - t.n)
pbar = ProgressBar(0, 100) urllib.request.urlretrieve(url, file, reporthook=update_to)
def dlProgress(count, blockSize, totalSize):
pbar.update(int(count * blockSize * 100 / totalSize))
urllib.request.urlretrieve(url, file, reporthook=dlProgress)
def get_aggregation_strategies(aggregation_strategies): def get_aggregation_strategies(aggregation_strategies):

View File

@ -187,7 +187,6 @@ import time
import atlite import atlite
import geopandas as gpd import geopandas as gpd
import numpy as np import numpy as np
import progressbar as pgb
import xarray as xr import xarray as xr
from _helpers import configure_logging from _helpers import configure_logging
from dask.distributed import Client, LocalCluster from dask.distributed import Client, LocalCluster
@ -203,7 +202,6 @@ if __name__ == "__main__":
snakemake = mock_snakemake("build_renewable_profiles", technology="solar") snakemake = mock_snakemake("build_renewable_profiles", technology="solar")
configure_logging(snakemake) configure_logging(snakemake)
pgb.streams.wrap_stderr()
nprocesses = int(snakemake.threads) nprocesses = int(snakemake.threads)
noprogress = not snakemake.config["atlite"].get("show_progress", False) noprogress = not snakemake.config["atlite"].get("show_progress", False)