Skip to content

Commit f478383

Browse files
perrymanmdktarbet
andauthored
Fix for reading text records. (#109)
* Fix for reading text records. * update dss library (#110) --------- Co-authored-by: Karl Tarbet <ktarbet@users.noreply.github.com>
1 parent fbe98e2 commit f478383

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "hec-dss-python"
3-
version = "0.1.26"
3+
version = "0.1.28"
44
description = "Python wrapper for the HEC-DSS file database C library."
55
authors = ["Hydrologic Engineering Center"]
66
license = "MIT"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = hecdss
3-
version = 0.1.27
3+
version = 0.1.28
44
author = Hydrologic Engineering Center
55
author_email =hec.dss@usace.army.mil
66
description = Python wrapper for the HEC-DSS file database C library.

src/hecdss/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
from hecdss.regular_timeseries import RegularTimeSeries
77
from hecdss.array_container import ArrayContainer
88
from hecdss.paired_data import PairedData
9+
from hecdss.text import Text
910

src/hecdss/download_hecdss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def download_and_unzip(url, zip_file, destination_dir):
3636
print(f"Failed to download zip file. Status code: {response.status_code}")
3737

3838
base_url = "https://www.hec.usace.army.mil/nexus/repository/maven-public/mil/army/usace/hec/hecdss/"
39-
version = "7-IW-3"
39+
version = "7-IW-4"
4040

4141
destination_dir = Path(__file__).parent.joinpath("lib")
4242
zip_url = f"{base_url}{version}-win-x86_64/hecdss-{version}-win-x86_64.zip"

src/hecdss/hecdss.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,16 @@ def _get_text(self, pathname: str):
138138
textLength = 1024
139139

140140

141-
BUFFER_TOO_SMALL = -1
141+
BUFFER_TOO_SMALL = -17
142142
textArray = []
143143
status = self._native.hec_dss_textRetrieve(pathname, textArray, textLength)
144144
while status == BUFFER_TOO_SMALL:
145145
textLength *= 2
146-
status = self._native.hec_dss_textRetrieve(pathname, textArray, textLength)
147146
if textLength > 2*1048576: # 2 MB
148147
print(f"Text record too large to read from '{pathname}'")
149148
return None
149+
textArray = [] # otherwise we get an entry for each attempt
150+
status = self._native.hec_dss_textRetrieve(pathname, textArray, textLength)
150151

151152
if status != 0:
152153
print(f"Error reading text from '{pathname}'")

0 commit comments

Comments
 (0)