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.
Files changed (72) hide show
  1. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.github/workflows/pypi-package.yml +2 -2
  2. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.github/workflows/tests.yml +2 -2
  3. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/CHANGELOG.md +7 -0
  4. {toolbox_utils-5.2.1/src/toolbox_utils.egg-info → toolbox_utils-5.2.2}/PKG-INFO +1 -1
  5. toolbox_utils-5.2.2/VERSION +1 -0
  6. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/pyproject.toml +1 -1
  7. toolbox_utils-5.2.2/src/toolbox_utils/readers/plotgen.py +45 -0
  8. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2/src/toolbox_utils.egg-info}/PKG-INFO +1 -1
  9. toolbox_utils-5.2.2/tests/data_plotgen.plt +758 -0
  10. toolbox_utils-5.2.1/VERSION +0 -1
  11. toolbox_utils-5.2.1/src/toolbox_utils/readers/plotgen.py +0 -55
  12. toolbox_utils-5.2.1/tests/data_plotgen.plt +0 -758
  13. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.deepsource.toml +0 -0
  14. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.github/dependabot.yml +0 -0
  15. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.github/workflows/clean-workflow-runs.yml +0 -0
  16. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.gitignore +0 -0
  17. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.pre-commit-config.yaml +0 -0
  18. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/.sourcery.yaml +0 -0
  19. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/AUTHORS.rst +0 -0
  20. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/BADGES.rst +0 -0
  21. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/CONTRIBUTING.rst +0 -0
  22. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/LICENSE.txt +0 -0
  23. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/README.rst +0 -0
  24. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/Makefile +0 -0
  25. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/authors.rst +0 -0
  26. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/conf.py +0 -0
  27. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/contributing.rst +0 -0
  28. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/index.rst +0 -0
  29. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/license.rst +0 -0
  30. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/make.bat +0 -0
  31. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/docs/readme.rst +0 -0
  32. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/setup.cfg +0 -0
  33. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/__init__.py +0 -0
  34. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/readers/__init__.py +0 -0
  35. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/readers/hbn.py +0 -0
  36. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/readers/wdm.py +0 -0
  37. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils/tsutils.py +0 -0
  38. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/SOURCES.txt +0 -0
  39. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/dependency_links.txt +0 -0
  40. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/requires.txt +0 -0
  41. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/src/toolbox_utils.egg-info/top_level.txt +0 -0
  42. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data.wdm +0 -0
  43. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_bi_daily.csv +0 -0
  44. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_bivl.hbn +0 -0
  45. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_end.bivl.csv +0 -0
  46. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_end.daily.csv +0 -0
  47. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_end.monthly.csv +0 -0
  48. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_end.yearly.csv +0 -0
  49. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_flow_stage.xlsx +0 -0
  50. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_period.bivl.csv +0 -0
  51. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_period.daily.csv +0 -0
  52. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_period.monthly.csv +0 -0
  53. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_period.yearly.csv +0 -0
  54. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_simple.csv +0 -0
  55. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_start.bivl.csv +0 -0
  56. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_start.daily.csv +0 -0
  57. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_start.monthly.csv +0 -0
  58. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_start.yearly.csv +0 -0
  59. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_wdm_1.csv +0 -0
  60. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_wdm_2.csv +0 -0
  61. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/data_yearly.hbn +0 -0
  62. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_asbestfreq.py +0 -0
  63. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_date_slice.py +0 -0
  64. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_dateparse.py +0 -0
  65. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_extract.py +0 -0
  66. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_hbn.py +0 -0
  67. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_make_list.py +0 -0
  68. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_period_timestamp.py +0 -0
  69. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_plotgen.py +0 -0
  70. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_range_to_numlist.py +0 -0
  71. {toolbox_utils-5.2.1 → toolbox_utils-5.2.2}/tests/test_read.py +0 -0
  72. {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@v4
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@v4
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@v4
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@v5
63
+ uses: actions/setup-python@v6
64
64
  with:
65
65
  python-version: ${{ matrix.python-versions }}
66
66
 
@@ -1,3 +1,10 @@
1
+ ## v5.2.2 (2025-11-13)
2
+
3
+ ### Fix
4
+
5
+ - use .where instead of .replace to avoid RecursionError in pandas 1.5.x
6
+ - fixed PLTGEN reader
7
+
1
8
  ## v5.2.1 (2025-07-20)
2
9
 
3
10
  ### Fix
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolbox_utils
3
- Version: 5.2.1
3
+ Version: 5.2.2
4
4
  Summary: Python toolbox for common utilities
5
5
  Author-email: Tim Cera <tim@cerazone.net>
6
6
  License: BSD-3-Clause
@@ -0,0 +1 @@
1
+ 5.2.2
@@ -65,7 +65,7 @@ bitbucket = "https://bitbucket.org/timcera/toolbox_utils/src/main/"
65
65
  name = "cz_conventional_commits"
66
66
  tag_format = "v$version"
67
67
  update_changelog_on_bump = true
68
- version = "5.2.1"
68
+ version = "5.2.2"
69
69
  version_files = ["VERSION"]
70
70
 
71
71
  [tool.isort]
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolbox_utils
3
- Version: 5.2.1
3
+ Version: 5.2.2
4
4
  Summary: Python toolbox for common utilities
5
5
  Author-email: Tim Cera <tim@cerazone.net>
6
6
  License: BSD-3-Clause