Merge branch 'master' into scenario-management

This commit is contained in:
Fabian Neumann 2024-02-14 10:45:43 +01:00
commit dbbfbaf1f3
7 changed files with 24 additions and 24 deletions

View File

@ -2,8 +2,8 @@
#
# SPDX-License-Identifier: MIT
from os.path import normpath, exists
from shutil import copyfile, move, rmtree
from os.path import normpath
from shutil import move, rmtree
from pathlib import Path
import yaml
from snakemake.remote.HTTP import RemoteProvider as HTTPRemoteProvider
@ -15,12 +15,8 @@ from scripts._helpers import path_provider
min_version("7.7")
HTTP = HTTPRemoteProvider()
conf_file = os.path.join(workflow.current_basedir, "config/config.yaml")
conf_default_file = os.path.join(workflow.current_basedir, "config/config.default.yaml")
if not exists(conf_file) and exists(conf_default_file):
copyfile(conf_default_file, conf_file)
configfile: "config/config.default.yaml"
configfile: "config/config.yaml"

8
config/config.yaml Normal file
View File

@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: : 2024 The PyPSA-Eur Authors
#
# SPDX-License-Identifier: CC0-1.0
# add your own configuration overrides here, for instance
version: 0.9.0
# enable:
# retrieve: false

View File

@ -9,7 +9,7 @@
Configuration
##########################################
PyPSA-Eur has several configuration options which are documented in this section and are collected in a ``config/config.yaml`` file located in the root directory. Users should copy the provided default configuration (``config/config.default.yaml``) and amend their own modifications and assumptions in the user-specific configuration file (``config/config.yaml``); confer installation instructions at :ref:`defaultconfig`.
PyPSA-Eur has several configuration options which are documented in this section and are collected in a ``config/config.yaml`` file. This file defines deviations from the default configuration (``config/config.default.yaml``); confer installation instructions at :ref:`defaultconfig`.
.. _toplevel_cf:

View File

@ -118,11 +118,10 @@ Nevertheless, you can still use open-source solvers for smaller problems.
Handling Configuration Files
============================
PyPSA-Eur has several configuration options that must be specified in a
``config/config.yaml`` file located in the root directory. An example configuration
``config/config.default.yaml`` is maintained in the repository, which will be used to
automatically create your customisable ``config/config.yaml`` on first use. More
details on the configuration options are in :ref:`config`.
PyPSA-Eur has several configuration options that users can specify in a
``config/config.yaml`` file. The default configuration
``config/config.default.yaml`` is maintained in the repository. More details on
the configuration options are in :ref:`config`.
You can also use ``snakemake`` to specify another file, e.g.
``config/config.mymodifications.yaml``, to update the settings of the ``config/config.yaml``.
@ -130,8 +129,3 @@ You can also use ``snakemake`` to specify another file, e.g.
.. code:: bash
.../pypsa-eur % snakemake -call --configfile config/config.mymodifications.yaml
.. warning::
Users are advised to regularly check their own ``config/config.yaml`` against changes
in the ``config/config.default.yaml`` when pulling a new version from the remote
repository.

View File

@ -74,7 +74,7 @@ what data to retrieve and what files to produce. Details are explained in
:ref:`wildcards` and :ref:`scenario`.
The model also has several further configuration options collected in the
``config/config.yaml`` file located in the root directory, which that are not part of
``config/config.default.yaml`` file located in the root directory, which that are not part of
the scenarios. Options are explained in :ref:`config`.
Folder Structure

View File

@ -17,6 +17,11 @@ Upcoming Release
names to run under ``run: name:`` in the configuration file. The latter must
be a subset of toplevel keys in the scenario file.
* The default configuration ``config/config.default.yaml`` is now automatically
used as a base configuration file and no longer copied to
``config/config.yaml`` on first use. The file ``config/config.yaml`` should be
used to define deviations from the default configuration.
* Merged two OPSD time series data versions into such that the option ``load:
power_statistics:`` becomes superfluous and was hence removed.

View File

@ -7,11 +7,8 @@ from functools import partial, lru_cache
import os, sys, glob
helper_source_path = [match for match in glob.glob("**/_helpers.py", recursive=True)]
for path in helper_source_path:
path = os.path.dirname(os.path.abspath(path))
sys.path.insert(0, os.path.abspath(path))
path = workflow.source_path("../scripts/_helpers.py")
sys.path.insert(0, os.path.dirname(path))
from _helpers import validate_checksum