toolbox-utils 5.2.1__tar.gz → 5.2.2__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.
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.github/workflows/pypi-package.yml +2 -2
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.github/workflows/tests.yml +2 -2
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/CHANGELOG.md +7 -0
- {toolbox_utils-5.2.1/src/toolbox_utils.egg-info → toolbox_utils-5.2.2}/PKG-INFO +1 -1
- toolbox_utils-5.2.2/VERSION +1 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/pyproject.toml +1 -1
- toolbox_utils-5.2.2/src/toolbox_utils/readers/plotgen.py +45 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2/src/toolbox_utils.egg-info}/PKG-INFO +1 -1
- toolbox_utils-5.2.2/tests/data_plotgen.plt +758 -0
- toolbox_utils-5.2.1/VERSION +0 -1
- toolbox_utils-5.2.1/src/toolbox_utils/readers/plotgen.py +0 -55
- toolbox_utils-5.2.1/tests/data_plotgen.plt +0 -758
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.deepsource.toml +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.github/dependabot.yml +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.github/workflows/clean-workflow-runs.yml +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.gitignore +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.pre-commit-config.yaml +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.sourcery.yaml +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/AUTHORS.rst +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/BADGES.rst +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/CONTRIBUTING.rst +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/LICENSE.txt +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/README.rst +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/Makefile +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/authors.rst +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/conf.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/contributing.rst +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/index.rst +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/license.rst +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/make.bat +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/readme.rst +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/setup.cfg +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/__init__.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/readers/__init__.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/readers/hbn.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/readers/wdm.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/tsutils.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/SOURCES.txt +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/dependency_links.txt +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/requires.txt +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/top_level.txt +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data.wdm +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_bi_daily.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_bivl.hbn +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_end.bivl.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_end.daily.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_end.monthly.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_end.yearly.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_flow_stage.xlsx +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_period.bivl.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_period.daily.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_period.monthly.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_period.yearly.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_simple.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_start.bivl.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_start.daily.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_start.monthly.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_start.yearly.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_wdm_1.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_wdm_2.csv +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_yearly.hbn +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_asbestfreq.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_date_slice.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_dateparse.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_extract.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_hbn.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_make_list.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_period_timestamp.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_plotgen.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_range_to_numlist.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_read.py +0 -0
- {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_wdm.py +0 -0
|
@@ -28,7 +28,7 @@ jobs:
|
|
|
28
28
|
|
|
29
29
|
steps:
|
|
30
30
|
- name: Checkout source
|
|
31
|
-
uses: actions/checkout@
|
|
31
|
+
uses: actions/checkout@v5
|
|
32
32
|
with:
|
|
33
33
|
submodules: recursive
|
|
34
34
|
|
|
@@ -38,7 +38,7 @@ jobs:
|
|
|
38
38
|
python -m build
|
|
39
39
|
|
|
40
40
|
- name: Download artifact
|
|
41
|
-
uses: actions/download-artifact@
|
|
41
|
+
uses: actions/download-artifact@v6
|
|
42
42
|
with:
|
|
43
43
|
path: dist
|
|
44
44
|
merge-multiple: true
|
|
@@ -55,12 +55,12 @@ jobs:
|
|
|
55
55
|
|
|
56
56
|
steps:
|
|
57
57
|
- name: Checkout repository
|
|
58
|
-
uses: actions/checkout@
|
|
58
|
+
uses: actions/checkout@v5
|
|
59
59
|
with:
|
|
60
60
|
submodules: recursive
|
|
61
61
|
|
|
62
62
|
- name: Set up Python ${{ matrix.python-versions }}
|
|
63
|
-
uses: actions/setup-python@
|
|
63
|
+
uses: actions/setup-python@v6
|
|
64
64
|
with:
|
|
65
65
|
python-version: ${{ matrix.python-versions }}
|
|
66
66
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5.2.2
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""For reading HSPF plotgen files."""
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def plotgen_extract(filename):
|
|
7
|
+
"""Reads HSPF PLTGEN files and creates a DataFrame."""
|
|
8
|
+
found_column_names = False
|
|
9
|
+
column_names = []
|
|
10
|
+
with open(filename, encoding="ascii") as fpointer:
|
|
11
|
+
for i, line in enumerate(fpointer):
|
|
12
|
+
if "LINTYP" in line:
|
|
13
|
+
found_column_names = True
|
|
14
|
+
continue
|
|
15
|
+
if line[5:].startswith("Time series"):
|
|
16
|
+
break
|
|
17
|
+
if found_column_names:
|
|
18
|
+
if column_name := line[4:30].strip():
|
|
19
|
+
column_names.append(column_name)
|
|
20
|
+
continue
|
|
21
|
+
|
|
22
|
+
pgdf = pd.read_fwf(
|
|
23
|
+
fpointer,
|
|
24
|
+
colspecs=[(5, 10), (10, 13), (13, 16), (16, 19), (19, 22)]
|
|
25
|
+
+ [(22 + i * 14, 36 + i * 14) for i in range(len(column_names))],
|
|
26
|
+
skiprows=3,
|
|
27
|
+
names=["Year", "Month", "Day", "Hour", "Minute"] + column_names,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# .replace causes RecursionError in 1.5.* versions of pandas and so use
|
|
31
|
+
# .where instead.
|
|
32
|
+
pgdf = pgdf.where(pgdf != -1e30, pd.NA).dropna(how="all", subset=column_names)
|
|
33
|
+
|
|
34
|
+
# Can't let read_fwf parse dates because HSPF can use 24:00 for midnight of
|
|
35
|
+
# the following day, where pandas can't work with that. So we create
|
|
36
|
+
# manually here by creating an HH:MM delta and adding to the date.
|
|
37
|
+
pgdf["delta"] = pd.to_timedelta(
|
|
38
|
+
pgdf["Hour"].astype(int), unit="h"
|
|
39
|
+
) + pd.to_timedelta(pgdf["Minute"].astype(int), unit="m")
|
|
40
|
+
pgdf["Datetime"] = pd.to_datetime(pgdf[["Year", "Month", "Day"]]) + pgdf["delta"]
|
|
41
|
+
|
|
42
|
+
pgdf = pgdf.drop(columns=["Year", "Month", "Day", "Hour", "Minute", "delta"])
|
|
43
|
+
pgdf = pgdf.set_index(["Datetime"])
|
|
44
|
+
|
|
45
|
+
return pgdf
|