Skip to content

Commit

Permalink
Merge pull request #229 from dstansby/globalatts-line-breaks
Browse files Browse the repository at this point in the history
Fix reading globalatts with multiple entries
  • Loading branch information
dstansby authored Jul 28, 2023
2 parents 635c5b5 + 05a4e78 commit 1763269
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions cdflib/cdfread.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ def globalattsget(self) -> Dict[str, List[Union[str, np.ndarray]]]:
entryData = entryData[0]

entries.append(entryData)
aedr_byte_loc = aedr_info.next_aedr

return_dict[adr_info.name] = entries
byte_loc = adr_info.next_adr_loc
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog
- If the `deflate <https://github.com/dcwatson/deflate>`_ library is installed
it is now used to decompress data, which can lead to around 2x speedups over
the native gzip Python library.
- Fixed reading attributes with multiple entries when using `cdflib.cdfread.CDF.globalattsget`.

1.0.5
=====
Expand Down
6 changes: 5 additions & 1 deletion tests/test_cdfread.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def test_read(cdf_path):
cdf.cdf_info()

# Smoke test global attributes
cdf.globalattsget()
globalatts = cdf.globalattsget()
for att in globalatts:
if len(globalatts[att]) > 1:
# Make sure multiple entries are unique
assert len(globalatts[att]) == len(set(globalatts[att]))


def test_nonexist_file_errors(tmp_path):
Expand Down

0 comments on commit 1763269

Please sign in to comment.