fameio 3.1.1__tar.gz → 3.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fameio-3.1.1 → fameio-3.3.0}/CHANGELOG.md +22 -0
- {fameio-3.1.1 → fameio-3.3.0}/PKG-INFO +50 -34
- {fameio-3.1.1 → fameio-3.3.0}/README.md +42 -29
- {fameio-3.1.1 → fameio-3.3.0}/pyproject.toml +33 -22
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/cli/convert_results.py +10 -10
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/cli/make_config.py +9 -9
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/cli/options.py +6 -4
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/cli/parser.py +87 -51
- fameio-3.3.0/src/fameio/cli/reformat.py +58 -0
- fameio-3.3.0/src/fameio/input/__init__.py +19 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/loader/__init__.py +13 -13
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/loader/controller.py +64 -18
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/loader/loader.py +25 -16
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/metadata.py +57 -38
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/resolver.py +9 -10
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/scenario/agent.py +62 -26
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/scenario/attribute.py +93 -40
- fameio-3.3.0/src/fameio/input/scenario/contract.py +313 -0
- fameio-3.3.0/src/fameio/input/scenario/exception.py +58 -0
- fameio-3.3.0/src/fameio/input/scenario/fameiofactory.py +90 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/scenario/generalproperties.py +22 -12
- fameio-3.3.0/src/fameio/input/scenario/scenario.py +196 -0
- fameio-3.3.0/src/fameio/input/scenario/stringset.py +66 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/schema/agenttype.py +27 -10
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/schema/attribute.py +108 -45
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/schema/java_packages.py +14 -12
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/schema/schema.py +39 -15
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/validator.py +198 -54
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/writer.py +137 -46
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/logs.py +28 -47
- fameio-3.3.0/src/fameio/output/__init__.py +7 -0
- fameio-3.3.0/src/fameio/output/agent_type.py +153 -0
- fameio-3.3.0/src/fameio/output/conversion.py +113 -0
- fameio-3.3.0/src/fameio/output/csv_writer.py +190 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/output/data_transformer.py +17 -24
- fameio-3.3.0/src/fameio/output/execution_dao.py +170 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/output/input_dao.py +71 -33
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/output/output_dao.py +33 -11
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/output/reader.py +64 -21
- fameio-3.3.0/src/fameio/output/yaml_writer.py +35 -0
- fameio-3.3.0/src/fameio/scripts/__init__.py +38 -0
- fameio-3.3.0/src/fameio/scripts/convert_results.py +175 -0
- fameio-3.3.0/src/fameio/scripts/convert_results.py.license +3 -0
- fameio-3.3.0/src/fameio/scripts/exception.py +7 -0
- fameio-3.3.0/src/fameio/scripts/make_config.py +55 -0
- fameio-3.3.0/src/fameio/scripts/make_config.py.license +3 -0
- fameio-3.3.0/src/fameio/scripts/reformat.py +71 -0
- fameio-3.3.0/src/fameio/scripts/reformat.py.license +3 -0
- fameio-3.3.0/src/fameio/series.py +305 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/time.py +79 -25
- fameio-3.3.0/src/fameio/tools.py +68 -0
- fameio-3.1.1/src/fameio/input/__init__.py +0 -19
- fameio-3.1.1/src/fameio/input/scenario/contract.py +0 -209
- fameio-3.1.1/src/fameio/input/scenario/exception.py +0 -35
- fameio-3.1.1/src/fameio/input/scenario/fameiofactory.py +0 -39
- fameio-3.1.1/src/fameio/input/scenario/scenario.py +0 -117
- fameio-3.1.1/src/fameio/input/scenario/stringset.py +0 -48
- fameio-3.1.1/src/fameio/output/__init__.py +0 -3
- fameio-3.1.1/src/fameio/output/agent_type.py +0 -92
- fameio-3.1.1/src/fameio/output/conversion.py +0 -98
- fameio-3.1.1/src/fameio/output/csv_writer.py +0 -110
- fameio-3.1.1/src/fameio/output/yaml_writer.py +0 -27
- fameio-3.1.1/src/fameio/scripts/__init__.py +0 -20
- fameio-3.1.1/src/fameio/scripts/convert_results.py +0 -101
- fameio-3.1.1/src/fameio/scripts/convert_results.py.license +0 -3
- fameio-3.1.1/src/fameio/scripts/make_config.py +0 -34
- fameio-3.1.1/src/fameio/scripts/make_config.py.license +0 -3
- fameio-3.1.1/src/fameio/series.py +0 -190
- fameio-3.1.1/src/fameio/tools.py +0 -28
- {fameio-3.1.1 → fameio-3.3.0}/LICENSE.txt +0 -0
- {fameio-3.1.1 → fameio-3.3.0}/LICENSES/Apache-2.0.txt +0 -0
- {fameio-3.1.1 → fameio-3.3.0}/LICENSES/CC-BY-4.0.txt +0 -0
- {fameio-3.1.1 → fameio-3.3.0}/LICENSES/CC0-1.0.txt +0 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/__init__.py +0 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/cli/__init__.py +0 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/scenario/__init__.py +0 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/input/schema/__init__.py +0 -0
- {fameio-3.1.1 → fameio-3.3.0}/src/fameio/scripts/__init__.py.license +0 -0
@@ -2,6 +2,28 @@
|
|
2
2
|
|
3
3
|
SPDX-License-Identifier: CC0-1.0 -->
|
4
4
|
|
5
|
+
## [3.3.0](https://gitlab.com/fame-framework/fame-io/-/tags/v3.3.0) - 2025-5-09
|
6
|
+
### Changed
|
7
|
+
- Expose static methods to read, convert, and write time series #245 (@dlr-cjs)
|
8
|
+
- Improve docstrings of SchemaValidator !219 (@dlr-cjs)
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- Add command-line script to reformat time series #246 (@dlr-cjs)
|
12
|
+
- Read execution metadata from protobuf file #193 (@dlr-cjs)
|
13
|
+
|
14
|
+
## [3.2.0](https://gitlab.com/fame-framework/fame-io/-/tags/v3.2.0) - 2025-04-22
|
15
|
+
### Changed
|
16
|
+
- Suppress detailed Exception traceback in console #239 (@dlr_fn, @dlr-cjs)
|
17
|
+
- Improve speed of time series data conversion #240 (@dlr-cjs)
|
18
|
+
- Warn if large time series data files need conversion #241 (@dlr-cjs)
|
19
|
+
- Adapt pyproject.toml to latest standard #238 (@dlr-cjs)
|
20
|
+
|
21
|
+
### Added
|
22
|
+
- Add warning if unexpected keys are found at agent top level definition #233 (@dlr_fn)
|
23
|
+
- Add error if contract product name is empty #221 (@dlr_fn, @dlr-cjs)
|
24
|
+
- Add link to best practices and tools in Contributing !209 (@dlr-cjs)
|
25
|
+
- Add static type checking to CI and pre-commit #236 (@dlr-cjs)
|
26
|
+
|
5
27
|
## [3.1.1](https://gitlab.com/fame-framework/fame-io/-/tags/v3.1.1) - 2025-03-21
|
6
28
|
### Added
|
7
29
|
- Add static code analysis to CI pipeline #231 (@dlr-cjs)
|
@@ -1,8 +1,7 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: fameio
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.3.0
|
4
4
|
Summary: Tools for input preparation and output digestion of FAME models
|
5
|
-
Home-page: https://gitlab.com/fame-framework/wiki/-/wikis/home
|
6
5
|
License: Apache-2.0
|
7
6
|
Keywords: FAME,fameio,agent-based modelling,energy systems
|
8
7
|
Author: Felix Nitsch
|
@@ -20,32 +19,35 @@ Classifier: Programming Language :: Python :: 3.9
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
22
21
|
Classifier: Programming Language :: Python :: 3.12
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
23
23
|
Classifier: Topic :: Scientific/Engineering
|
24
|
-
Requires-Dist: fameprotobuf (>=2.0.2,<3.0
|
24
|
+
Requires-Dist: fameprotobuf (>=2.0.2,<3.0)
|
25
25
|
Requires-Dist: pandas (>=1.0,<3.0)
|
26
26
|
Requires-Dist: pyyaml (>=6.0,<7.0)
|
27
|
-
Project-URL:
|
27
|
+
Project-URL: Changelog, https://gitlab.com/fame-framework/fame-io/-/blob/main/CHANGELOG.md
|
28
|
+
Project-URL: Homepage, https://helmholtz.software/software/fame
|
29
|
+
Project-URL: Issue Tracking, https://gitlab.com/fame-framework/fame-io/-/issues
|
30
|
+
Project-URL: Repository, https://gitlab.com/fame-framework/fame-io
|
28
31
|
Description-Content-Type: text/markdown
|
29
32
|
|
30
33
|
<!-- SPDX-FileCopyrightText: 2025 German Aerospace Center <fame@dlr.de>
|
31
34
|
|
32
35
|
SPDX-License-Identifier: Apache-2.0 -->
|
33
36
|
|
34
|
-
| |
|
35
|
-
|
36
|
-
| **Package** |
|
37
|
-
| **
|
38
|
-
| **Activity** |  
|
39
|
-
| **Style** | [](https://github.com/psf/black) [](https://doi.org/10.21105/joss.04958) [](https://doi.org/10.5281/zenodo.4314337)
|
37
|
+
| | |
|
38
|
+
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
39
|
+
| **Package** |   [](https://badge.fury.io/py/fameio) [](https://api.reuse.software/info/gitlab.com/fame-framework/fame-io) |
|
40
|
+
| **Test** | [](https://gitlab.com/fame-framework/fame-io/commits/main) [](https://gitlab.com/fame-framework/fame-io/-/commits/main) |
|
41
|
+
| **Activity** |   |
|
42
|
+
| **Style** | [](https://github.com/psf/black) [](https://common-changelog.org/)  [](https://github.com/pylint-dev/pylint) |
|
43
|
+
| **Reference** | [](https://doi.org/10.21105/joss.04958) [](https://doi.org/10.5281/zenodo.4314337) |
|
41
44
|
|
42
45
|
# FAME-Io
|
43
46
|
|
44
47
|
*Tools for input preparation and output digestion of FAME models*
|
45
48
|
|
46
49
|
FAME-Io compiles input for FAME models in protobuf format and extracts model outputs to human-readable files.
|
47
|
-
Please visit the [FAME-Wiki](https://gitlab.com/fame-framework/wiki/-/wikis/home) to get an explanation of FAME and its
|
48
|
-
components.
|
50
|
+
Please visit the [FAME-Wiki](https://gitlab.com/fame-framework/wiki/-/wikis/home) to get an explanation of FAME and its components.
|
49
51
|
|
50
52
|
# Installation
|
51
53
|
|
@@ -53,30 +55,26 @@ We recommend installing `fameio` using PyPI:
|
|
53
55
|
|
54
56
|
pip install fameio
|
55
57
|
|
56
|
-
You may also use `pipx`. For detailed information please refer to the
|
57
|
-
official `pipx` [documentation](https://github.com/pypa/pipx).
|
58
|
+
You may also use `pipx`. For detailed information please refer to the official `pipx` [documentation](https://github.com/pypa/pipx).
|
58
59
|
|
59
60
|
pipx install fameio
|
60
61
|
|
61
|
-
`fameio` is currently developed and tested for Python 3.
|
62
|
+
`fameio` is currently developed and tested for Python 3.9 or higher.
|
62
63
|
See the `pyproject.toml` for a complete listing of dependencies.
|
63
64
|
|
64
65
|
# Usage
|
65
66
|
|
66
|
-
FAME-Io currently offers two main scripts `makeFameRunConfig` and `convertFameResults
|
67
|
-
|
67
|
+
FAME-Io currently offers two main scripts `makeFameRunConfig` and `convertFameResults`, plus a helper script `reformatTimeSeries`
|
68
|
+
All are automatically installed with the package.
|
68
69
|
The first one creates a protobuf file for FAME applications using YAML definition files and CSV files.
|
69
|
-
The
|
70
|
+
The second one reads output files from FAME applications in protobuf format and converts them to CSV files.
|
71
|
+
The third script reformats time series CSV files to FAME format.
|
70
72
|
|
71
|
-
You may use the [example data](https://gitlab.com/dlr-ve/esy/amiris/examples) provided for
|
72
|
-
the [AMIRIS](https://gitlab.com/dlr-ve/esy/amiris/amiris) model which can be used to simulate electricity markets
|
73
|
-
in [Germany](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Germany2019), [Austria](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Austria2019),
|
74
|
-
and a simple [proof-of-concept model](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Simple).
|
73
|
+
You may use the [example data](https://gitlab.com/dlr-ve/esy/amiris/examples) provided for the [AMIRIS](https://gitlab.com/dlr-ve/esy/amiris/amiris) model which can be used to simulate electricity markets in [Germany](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Germany2019), [Austria](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Austria2019), and a simple [proof-of-concept model](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Simple).
|
75
74
|
|
76
75
|
## Make a FAME run configuration
|
77
76
|
|
78
|
-
Digests configuration files in YAML format, combines them with CSV data files and creates a single input file for FAME
|
79
|
-
applications in protobuf format.
|
77
|
+
Digests configuration files in YAML format, combines them with CSV data files and creates a single input file for FAME applications in protobuf format.
|
80
78
|
Call structure:
|
81
79
|
|
82
80
|
makeFameRunConfig -f <path/to/scenario.yaml>
|
@@ -362,7 +360,9 @@ Agent Parameters:
|
|
362
360
|
* `Attributes` Optional; if the agent has any attributes, specify them here in the format "AttributeName: value"; please
|
363
361
|
see attribute table above
|
364
362
|
* `Metadata` Optional; can be assigned to each instance of an Agent, as well as to each of its Attributes
|
363
|
+
* `Ext` Optional; Reserved key for parameters not used by fameio but its extensions, e.g., FAME-Gui
|
365
364
|
|
365
|
+
A warning is logged for any other key at this level.
|
366
366
|
The specified `Attributes` for each agent must match the specified `Attributes` options in the linked Schema (see
|
367
367
|
above).
|
368
368
|
For better structure and readability of the `scenario.yaml`, `Attributes` may also be specified in a nested way as
|
@@ -639,10 +639,8 @@ TIME_SERIES inputs are not directly fed into the Scenario YAML file.
|
|
639
639
|
Instead, TIME_SERIES reference a CSV file that can be stored some place else.
|
640
640
|
These CSV files follow a specific structure:
|
641
641
|
|
642
|
-
* They should contain exactly two columns - any other columns are ignored.
|
643
|
-
|
644
|
-
* The first column must be a time stamp in form `YYYY-MM-DD_hh:mm:ss` or
|
645
|
-
a [FAME-Timestamp](https://gitlab.com/fame-framework/wiki/-/wikis/architecture/decisions/TimeStamp) integer value
|
642
|
+
* They should contain exactly two columns - any other columns are ignored. A warning is raised if more than two non-empty columns are detected.
|
643
|
+
* The first column must be a time stamp in form `YYYY-MM-DD_hh:mm:ss` or a [FAME-Timestamp](https://gitlab.com/fame-framework/wiki/-/wikis/architecture/decisions/TimeStamp) integer value.
|
646
644
|
* The second column must be a numerical value (either integer or floating-point)
|
647
645
|
* The separator of the two columns is a semicolon
|
648
646
|
* The data must **not** have headers, except for comments marked with `#`
|
@@ -658,10 +656,10 @@ Exemplary content of a valid CSV file:
|
|
658
656
|
2016-01-01_00:00:00;42 # optional comment on this particular data point
|
659
657
|
2017-01-01_00:00:00;0.1
|
660
658
|
|
661
|
-
Please refer also to the detailed article about `TimeStamps` in
|
662
|
-
the
|
663
|
-
|
664
|
-
|
659
|
+
Please refer also to the detailed article about `TimeStamps` in the [FAME-Wiki](https://gitlab.com/fame-framework/wiki/-/wikis/TimeStamp).
|
660
|
+
For large CSV files (with more than 20,000 rows) we recommend using the integer representation of FAME-Timestamps in the first column (instead of text representation) to improve conversion speed.
|
661
|
+
A warning will be raised for very large files (exceeding 50,000 rows) that require time stamp conversion.
|
662
|
+
Use `reformatTimeSeries` to convert one or multiple timeseries CSV files into FAME format to improve conversion speed and avoid this warning.
|
665
663
|
|
666
664
|
### Split and join multiple YAML files
|
667
665
|
|
@@ -930,6 +928,24 @@ run_config = handle_args(my_arg_string, my_defaults)
|
|
930
928
|
convert_results(run_config)
|
931
929
|
```
|
932
930
|
|
931
|
+
## Reformat time series
|
932
|
+
|
933
|
+
Takes CSV time series files and reformats them into FAME time format.
|
934
|
+
This improves speed of run configuration creation but also reduces readability of the CSV files' content.
|
935
|
+
Thus, we recommend to apply this reformatting only for CSV time series files with more than 20,000 lines.
|
936
|
+
|
937
|
+
Call structure:
|
938
|
+
|
939
|
+
reformatTimeSeries -fp <file_or_file_pattern*.csv>
|
940
|
+
|
941
|
+
You may also specify any of the following arguments:
|
942
|
+
|
943
|
+
| Command | Action |
|
944
|
+
|-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
945
|
+
| `-l` or `--log` <option> | Sets the logging level. Default is `WARNING`. Options are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`. |
|
946
|
+
| `-lf` or `--logfile` <file> | Sets the logging file. Default is `None`. If `None` is provided, all logs get only printed to the console. |
|
947
|
+
| `--replace` or `--no-replace` | If `--replace` is specified, existing csv files are replaced with the new content. Otherwise and by default, new files are created extending the original file name by "_reformatted". |
|
948
|
+
|
933
949
|
## Cite FAME-Io
|
934
950
|
|
935
951
|
If you use FAME-Io for academic work, please cite as follows.
|
@@ -2,21 +2,20 @@
|
|
2
2
|
|
3
3
|
SPDX-License-Identifier: Apache-2.0 -->
|
4
4
|
|
5
|
-
| |
|
6
|
-
|
7
|
-
| **Package** |
|
8
|
-
| **
|
9
|
-
| **Activity** |  
|
10
|
-
| **Style** | [](https://github.com/psf/black) [](https://doi.org/10.21105/joss.04958) [](https://doi.org/10.5281/zenodo.4314337)
|
5
|
+
| | |
|
6
|
+
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
7
|
+
| **Package** |   [](https://badge.fury.io/py/fameio) [](https://api.reuse.software/info/gitlab.com/fame-framework/fame-io) |
|
8
|
+
| **Test** | [](https://gitlab.com/fame-framework/fame-io/commits/main) [](https://gitlab.com/fame-framework/fame-io/-/commits/main) |
|
9
|
+
| **Activity** |   |
|
10
|
+
| **Style** | [](https://github.com/psf/black) [](https://common-changelog.org/)  [](https://github.com/pylint-dev/pylint) |
|
11
|
+
| **Reference** | [](https://doi.org/10.21105/joss.04958) [](https://doi.org/10.5281/zenodo.4314337) |
|
12
12
|
|
13
13
|
# FAME-Io
|
14
14
|
|
15
15
|
*Tools for input preparation and output digestion of FAME models*
|
16
16
|
|
17
17
|
FAME-Io compiles input for FAME models in protobuf format and extracts model outputs to human-readable files.
|
18
|
-
Please visit the [FAME-Wiki](https://gitlab.com/fame-framework/wiki/-/wikis/home) to get an explanation of FAME and its
|
19
|
-
components.
|
18
|
+
Please visit the [FAME-Wiki](https://gitlab.com/fame-framework/wiki/-/wikis/home) to get an explanation of FAME and its components.
|
20
19
|
|
21
20
|
# Installation
|
22
21
|
|
@@ -24,30 +23,26 @@ We recommend installing `fameio` using PyPI:
|
|
24
23
|
|
25
24
|
pip install fameio
|
26
25
|
|
27
|
-
You may also use `pipx`. For detailed information please refer to the
|
28
|
-
official `pipx` [documentation](https://github.com/pypa/pipx).
|
26
|
+
You may also use `pipx`. For detailed information please refer to the official `pipx` [documentation](https://github.com/pypa/pipx).
|
29
27
|
|
30
28
|
pipx install fameio
|
31
29
|
|
32
|
-
`fameio` is currently developed and tested for Python 3.
|
30
|
+
`fameio` is currently developed and tested for Python 3.9 or higher.
|
33
31
|
See the `pyproject.toml` for a complete listing of dependencies.
|
34
32
|
|
35
33
|
# Usage
|
36
34
|
|
37
|
-
FAME-Io currently offers two main scripts `makeFameRunConfig` and `convertFameResults
|
38
|
-
|
35
|
+
FAME-Io currently offers two main scripts `makeFameRunConfig` and `convertFameResults`, plus a helper script `reformatTimeSeries`
|
36
|
+
All are automatically installed with the package.
|
39
37
|
The first one creates a protobuf file for FAME applications using YAML definition files and CSV files.
|
40
|
-
The
|
38
|
+
The second one reads output files from FAME applications in protobuf format and converts them to CSV files.
|
39
|
+
The third script reformats time series CSV files to FAME format.
|
41
40
|
|
42
|
-
You may use the [example data](https://gitlab.com/dlr-ve/esy/amiris/examples) provided for
|
43
|
-
the [AMIRIS](https://gitlab.com/dlr-ve/esy/amiris/amiris) model which can be used to simulate electricity markets
|
44
|
-
in [Germany](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Germany2019), [Austria](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Austria2019),
|
45
|
-
and a simple [proof-of-concept model](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Simple).
|
41
|
+
You may use the [example data](https://gitlab.com/dlr-ve/esy/amiris/examples) provided for the [AMIRIS](https://gitlab.com/dlr-ve/esy/amiris/amiris) model which can be used to simulate electricity markets in [Germany](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Germany2019), [Austria](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Austria2019), and a simple [proof-of-concept model](https://gitlab.com/dlr-ve/esy/amiris/examples/-/tree/main/Simple).
|
46
42
|
|
47
43
|
## Make a FAME run configuration
|
48
44
|
|
49
|
-
Digests configuration files in YAML format, combines them with CSV data files and creates a single input file for FAME
|
50
|
-
applications in protobuf format.
|
45
|
+
Digests configuration files in YAML format, combines them with CSV data files and creates a single input file for FAME applications in protobuf format.
|
51
46
|
Call structure:
|
52
47
|
|
53
48
|
makeFameRunConfig -f <path/to/scenario.yaml>
|
@@ -333,7 +328,9 @@ Agent Parameters:
|
|
333
328
|
* `Attributes` Optional; if the agent has any attributes, specify them here in the format "AttributeName: value"; please
|
334
329
|
see attribute table above
|
335
330
|
* `Metadata` Optional; can be assigned to each instance of an Agent, as well as to each of its Attributes
|
331
|
+
* `Ext` Optional; Reserved key for parameters not used by fameio but its extensions, e.g., FAME-Gui
|
336
332
|
|
333
|
+
A warning is logged for any other key at this level.
|
337
334
|
The specified `Attributes` for each agent must match the specified `Attributes` options in the linked Schema (see
|
338
335
|
above).
|
339
336
|
For better structure and readability of the `scenario.yaml`, `Attributes` may also be specified in a nested way as
|
@@ -610,10 +607,8 @@ TIME_SERIES inputs are not directly fed into the Scenario YAML file.
|
|
610
607
|
Instead, TIME_SERIES reference a CSV file that can be stored some place else.
|
611
608
|
These CSV files follow a specific structure:
|
612
609
|
|
613
|
-
* They should contain exactly two columns - any other columns are ignored.
|
614
|
-
|
615
|
-
* The first column must be a time stamp in form `YYYY-MM-DD_hh:mm:ss` or
|
616
|
-
a [FAME-Timestamp](https://gitlab.com/fame-framework/wiki/-/wikis/architecture/decisions/TimeStamp) integer value
|
610
|
+
* They should contain exactly two columns - any other columns are ignored. A warning is raised if more than two non-empty columns are detected.
|
611
|
+
* The first column must be a time stamp in form `YYYY-MM-DD_hh:mm:ss` or a [FAME-Timestamp](https://gitlab.com/fame-framework/wiki/-/wikis/architecture/decisions/TimeStamp) integer value.
|
617
612
|
* The second column must be a numerical value (either integer or floating-point)
|
618
613
|
* The separator of the two columns is a semicolon
|
619
614
|
* The data must **not** have headers, except for comments marked with `#`
|
@@ -629,10 +624,10 @@ Exemplary content of a valid CSV file:
|
|
629
624
|
2016-01-01_00:00:00;42 # optional comment on this particular data point
|
630
625
|
2017-01-01_00:00:00;0.1
|
631
626
|
|
632
|
-
Please refer also to the detailed article about `TimeStamps` in
|
633
|
-
the
|
634
|
-
|
635
|
-
|
627
|
+
Please refer also to the detailed article about `TimeStamps` in the [FAME-Wiki](https://gitlab.com/fame-framework/wiki/-/wikis/TimeStamp).
|
628
|
+
For large CSV files (with more than 20,000 rows) we recommend using the integer representation of FAME-Timestamps in the first column (instead of text representation) to improve conversion speed.
|
629
|
+
A warning will be raised for very large files (exceeding 50,000 rows) that require time stamp conversion.
|
630
|
+
Use `reformatTimeSeries` to convert one or multiple timeseries CSV files into FAME format to improve conversion speed and avoid this warning.
|
636
631
|
|
637
632
|
### Split and join multiple YAML files
|
638
633
|
|
@@ -901,6 +896,24 @@ run_config = handle_args(my_arg_string, my_defaults)
|
|
901
896
|
convert_results(run_config)
|
902
897
|
```
|
903
898
|
|
899
|
+
## Reformat time series
|
900
|
+
|
901
|
+
Takes CSV time series files and reformats them into FAME time format.
|
902
|
+
This improves speed of run configuration creation but also reduces readability of the CSV files' content.
|
903
|
+
Thus, we recommend to apply this reformatting only for CSV time series files with more than 20,000 lines.
|
904
|
+
|
905
|
+
Call structure:
|
906
|
+
|
907
|
+
reformatTimeSeries -fp <file_or_file_pattern*.csv>
|
908
|
+
|
909
|
+
You may also specify any of the following arguments:
|
910
|
+
|
911
|
+
| Command | Action |
|
912
|
+
|-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
913
|
+
| `-l` or `--log` <option> | Sets the logging level. Default is `WARNING`. Options are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`. |
|
914
|
+
| `-lf` or `--logfile` <file> | Sets the logging file. Default is `None`. If `None` is provided, all logs get only printed to the console. |
|
915
|
+
| `--replace` or `--no-replace` | If `--replace` is specified, existing csv files are replaced with the new content. Otherwise and by default, new files are created extending the original file name by "_reformatted". |
|
916
|
+
|
904
917
|
## Cite FAME-Io
|
905
918
|
|
906
919
|
If you use FAME-Io for academic work, please cite as follows.
|
@@ -2,27 +2,46 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
[build-system]
|
5
|
-
requires = ["poetry-core>=
|
5
|
+
requires = ["poetry-core>=2.0.0"]
|
6
6
|
build-backend = "poetry.core.masonry.api"
|
7
7
|
|
8
|
-
[
|
8
|
+
[project]
|
9
9
|
name = "fameio"
|
10
|
-
version = "3.
|
10
|
+
version = "3.3.0"
|
11
11
|
description = "Tools for input preparation and output digestion of FAME models"
|
12
12
|
license = "Apache-2.0"
|
13
|
+
readme = "README.md"
|
14
|
+
requires-python = ">=3.9,<4.0"
|
13
15
|
authors = [
|
14
|
-
"Felix Nitsch
|
15
|
-
"Christoph Schimeczek
|
16
|
-
"Ulrich Frey
|
17
|
-
"Benjamin Fuchs
|
16
|
+
{ name = "Felix Nitsch", email = "fame@dlr.de" },
|
17
|
+
{ name = "Christoph Schimeczek", email = "fame@dlr.de" },
|
18
|
+
{ name = "Ulrich Frey", email = "fame@dlr.de" },
|
19
|
+
{ name = "Benjamin Fuchs", email = "fame@dlr.de" },
|
18
20
|
]
|
19
21
|
maintainers = [
|
20
|
-
"Felix Nitsch
|
22
|
+
{ name = "Felix Nitsch", email = "fame@dlr.de" },
|
23
|
+
{ name = "Christoph Schimeczek", email = "fame@dlr.de" },
|
21
24
|
]
|
22
|
-
readme = "README.md"
|
23
|
-
homepage = "https://gitlab.com/fame-framework/wiki/-/wikis/home"
|
24
|
-
repository = "https://gitlab.com/fame-framework/fame-io/"
|
25
25
|
keywords = ["FAME", "fameio", "agent-based modelling", "energy systems"]
|
26
|
+
dynamic = ["classifiers"]
|
27
|
+
dependencies = [
|
28
|
+
"fameprotobuf>=2.0.2,<3.0",
|
29
|
+
"pandas>= 1.0,<3.0",
|
30
|
+
"pyyaml>=6.0,<7.0",
|
31
|
+
]
|
32
|
+
|
33
|
+
[project.urls]
|
34
|
+
homepage = "https://helmholtz.software/software/fame"
|
35
|
+
repository = "https://gitlab.com/fame-framework/fame-io"
|
36
|
+
"Changelog" = "https://gitlab.com/fame-framework/fame-io/-/blob/main/CHANGELOG.md"
|
37
|
+
"Issue Tracking" = "https://gitlab.com/fame-framework/fame-io/-/issues"
|
38
|
+
|
39
|
+
[project.scripts]
|
40
|
+
makeFameRunConfig = "fameio.scripts:makeFameRunConfig"
|
41
|
+
convertFameResults = "fameio.scripts:convertFameResults"
|
42
|
+
reformatTimeSeries = "fameio.scripts:reformatTimeSeries"
|
43
|
+
|
44
|
+
[tool.poetry]
|
26
45
|
classifiers = [
|
27
46
|
"Development Status :: 5 - Production/Stable",
|
28
47
|
"Operating System :: OS Independent",
|
@@ -33,12 +52,6 @@ classifiers = [
|
|
33
52
|
packages = [{ include = "fameio", from = "src" }]
|
34
53
|
include = ["CHANGELOG.md"]
|
35
54
|
|
36
|
-
[tool.poetry.dependencies]
|
37
|
-
python = "^3.9"
|
38
|
-
fameprotobuf = "^2.0.2"
|
39
|
-
pandas = ">= 1.0, <3.0"
|
40
|
-
pyyaml = "^6.0"
|
41
|
-
|
42
55
|
[tool.poetry.group.dev]
|
43
56
|
optional = true
|
44
57
|
|
@@ -48,11 +61,8 @@ mockito = "^1.5"
|
|
48
61
|
pre-commit = "^3.8"
|
49
62
|
coverage = { version = "^7.6", extras = ["toml"] }
|
50
63
|
black = "^24.8"
|
51
|
-
prospector = "^1.
|
52
|
-
|
53
|
-
[tool.poetry.scripts]
|
54
|
-
makeFameRunConfig = "fameio.scripts:makeFameRunConfig"
|
55
|
-
convertFameResults = "fameio.scripts:convertFameResults"
|
64
|
+
prospector = { version = "^1.16", extras = ["with_mypy"] }
|
65
|
+
types-PyYAML = "^6.0"
|
56
66
|
|
57
67
|
[tool.black]
|
58
68
|
line-length = 120
|
@@ -69,6 +79,7 @@ skip_covered = true
|
|
69
79
|
skip_empty = true
|
70
80
|
precision = 2
|
71
81
|
sort = "Cover"
|
82
|
+
exclude_also = ['@overload']
|
72
83
|
|
73
84
|
[tool.coverage.xml]
|
74
85
|
output = "coverage.xml"
|
@@ -1,8 +1,10 @@
|
|
1
|
-
# SPDX-FileCopyrightText:
|
1
|
+
# SPDX-FileCopyrightText: 2025 German Aerospace Center <fame@dlr.de>
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
|
+
from __future__ import annotations
|
5
|
+
|
4
6
|
import argparse
|
5
|
-
from typing import Any
|
7
|
+
from typing import Any
|
6
8
|
|
7
9
|
from fameio.cli.options import Options, ResolveOptions, TimeOptions
|
8
10
|
from fameio.cli.parser import (
|
@@ -24,8 +26,8 @@ CLI_DEFAULTS = {
|
|
24
26
|
Options.FILE: None,
|
25
27
|
Options.LOG_LEVEL: "WARN",
|
26
28
|
Options.LOG_FILE: None,
|
27
|
-
Options.AGENT_LIST: None,
|
28
29
|
Options.OUTPUT: None,
|
30
|
+
Options.AGENT_LIST: None,
|
29
31
|
Options.SINGLE_AGENT_EXPORT: False,
|
30
32
|
Options.MEMORY_SAVING: False,
|
31
33
|
Options.RESOLVE_COMPLEX_FIELD: ResolveOptions.SPLIT,
|
@@ -38,9 +40,8 @@ _INFILE_PATH_HELP = "Provide path to protobuf file"
|
|
38
40
|
_OUTFILE_PATH_HELP = "Provide path to folder to store output .csv files"
|
39
41
|
|
40
42
|
|
41
|
-
def handle_args(args: list[str], defaults:
|
42
|
-
"""
|
43
|
-
Handles command line arguments and returns `run_config` for convert_results script
|
43
|
+
def handle_args(args: list[str], defaults: dict[Options, Any] | None = None) -> dict[Options, Any]:
|
44
|
+
"""Handles command line arguments and returns `run_config` for convert_results script.
|
44
45
|
|
45
46
|
Args:
|
46
47
|
args: list of (command line) arguments, e.g., ['-f', 'my_file']; arg values take precedence over defaults
|
@@ -54,9 +55,8 @@ def handle_args(args: list[str], defaults: Optional[dict[Options, Any]] = None)
|
|
54
55
|
return map_namespace_to_options_dict(parsed)
|
55
56
|
|
56
57
|
|
57
|
-
def _prepare_parser(defaults:
|
58
|
-
"""
|
59
|
-
Creates a parser with given defaults to handle `make_config` configuration arguments
|
58
|
+
def _prepare_parser(defaults: dict[Options, Any] | None) -> argparse.ArgumentParser:
|
59
|
+
"""Creates a parser with given defaults to handle `make_config` configuration arguments.
|
60
60
|
|
61
61
|
Returns:
|
62
62
|
new parser using given defaults for its arguments; if a default is not specified, hard-coded defaults are used
|
@@ -80,5 +80,5 @@ def _prepare_parser(defaults: Optional[dict[Options, Any]]) -> argparse.Argument
|
|
80
80
|
|
81
81
|
|
82
82
|
def _get_default(defaults: dict, option: Options) -> Any:
|
83
|
-
"""Returns default for given `option` or its cli default"""
|
83
|
+
"""Returns default for given `option` or its cli default."""
|
84
84
|
return defaults.get(option, CLI_DEFAULTS[option])
|
@@ -1,9 +1,11 @@
|
|
1
|
-
# SPDX-FileCopyrightText:
|
1
|
+
# SPDX-FileCopyrightText: 2025 German Aerospace Center <fame@dlr.de>
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
|
+
from __future__ import annotations
|
5
|
+
|
4
6
|
import argparse
|
5
7
|
from pathlib import Path
|
6
|
-
from typing import Any
|
8
|
+
from typing import Any
|
7
9
|
|
8
10
|
from fameio.cli.options import Options
|
9
11
|
from fameio.cli.parser import (
|
@@ -31,9 +33,8 @@ _ENCODING_HELP = (
|
|
31
33
|
)
|
32
34
|
|
33
35
|
|
34
|
-
def handle_args(args: list[str], defaults:
|
35
|
-
"""
|
36
|
-
Converts given `arguments` and returns a configuration for the make_config script
|
36
|
+
def handle_args(args: list[str], defaults: dict[Options, Any] | None = None) -> dict[Options, Any]:
|
37
|
+
"""Converts given `args` and returns a configuration for the make_config script.
|
37
38
|
|
38
39
|
Args:
|
39
40
|
args: list of (command line) arguments, e.g., ['-f', 'my_file']; arg values take precedence over defaults
|
@@ -47,9 +48,8 @@ def handle_args(args: list[str], defaults: Optional[dict[Options, Any]] = None)
|
|
47
48
|
return map_namespace_to_options_dict(parsed)
|
48
49
|
|
49
50
|
|
50
|
-
def _prepare_parser(defaults:
|
51
|
-
"""
|
52
|
-
Creates a parser with given defaults to handle `make_config` configuration arguments
|
51
|
+
def _prepare_parser(defaults: dict[Options, Any] | None) -> argparse.ArgumentParser:
|
52
|
+
"""Creates a parser with given defaults to handle `make_config` configuration arguments.
|
53
53
|
|
54
54
|
Returns:
|
55
55
|
new parser using given defaults for its arguments; if a default is not specified, hard-coded defaults are used
|
@@ -65,5 +65,5 @@ def _prepare_parser(defaults: Optional[dict[Options, Any]]) -> argparse.Argument
|
|
65
65
|
|
66
66
|
|
67
67
|
def _get_default(defaults: dict, option: Options) -> Any:
|
68
|
-
"""Returns default for given `option` or, if missing, its cli default"""
|
68
|
+
"""Returns default for given `option` or, if missing, its cli default."""
|
69
69
|
return defaults.get(option, CLI_DEFAULTS[option])
|
@@ -6,7 +6,7 @@ from enum import Enum, auto
|
|
6
6
|
|
7
7
|
|
8
8
|
class ParsableEnum(Enum):
|
9
|
-
"""Extend this to create an enum that can be parsed with argparse"""
|
9
|
+
"""Extend this to create an enum that can be parsed with argparse."""
|
10
10
|
|
11
11
|
@classmethod
|
12
12
|
def instantiate(cls, name: str) -> Enum:
|
@@ -20,7 +20,7 @@ class ParsableEnum(Enum):
|
|
20
20
|
|
21
21
|
|
22
22
|
class Options(Enum):
|
23
|
-
"""Specifies command line configuration options"""
|
23
|
+
"""Specifies command line configuration options."""
|
24
24
|
|
25
25
|
FILE = auto()
|
26
26
|
LOG_LEVEL = auto()
|
@@ -34,10 +34,12 @@ class Options(Enum):
|
|
34
34
|
TIME_MERGING = auto()
|
35
35
|
INPUT_RECOVERY = auto()
|
36
36
|
INPUT_ENCODING = auto()
|
37
|
+
FILE_PATTERN = auto()
|
38
|
+
REPLACE = auto()
|
37
39
|
|
38
40
|
|
39
41
|
class TimeOptions(ParsableEnum, Enum):
|
40
|
-
"""Specifies options for conversion of time in output"""
|
42
|
+
"""Specifies options for conversion of time in output."""
|
41
43
|
|
42
44
|
INT = auto()
|
43
45
|
UTC = auto()
|
@@ -45,7 +47,7 @@ class TimeOptions(ParsableEnum, Enum):
|
|
45
47
|
|
46
48
|
|
47
49
|
class ResolveOptions(ParsableEnum, Enum):
|
48
|
-
"""Specifies options for resolving complex fields in output files"""
|
50
|
+
"""Specifies options for resolving complex fields in output files."""
|
49
51
|
|
50
52
|
IGNORE = auto()
|
51
53
|
SPLIT = auto()
|