Skip to content

Commit

Permalink
BUG: Fix dataset parsing for Hyrax catalogs (Fixes #759)
Browse files Browse the repository at this point in the history
Due to the way parsing is done, we look backwards (on when a dataset tag
is encountered) to handle datasets with embedded access tags.
Unfortunately, this left us not handling the last such dataset
encountered if it contained such tags, like is done on NASA's Hyrax
server.
  • Loading branch information
dopplershift committed Apr 25, 2024
1 parent 7c24f40 commit 7bd7afd
Show file tree
Hide file tree
Showing 3 changed files with 1,044 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/siphon/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,11 @@ def __init__(self, catalog_url):
current_dataset = child.attrib['name']
self._process_dataset(child)

if previous_dataset:
# see if the previously processed dataset has access elements as children
# if so, these datasets need to be processed specially when making
# access_urls
if self.datasets[previous_dataset].access_element_info:
self.ds_with_access_elements_to_process.append(previous_dataset)
# see if the previously processed dataset has access elements as children
# if so, these datasets need to be processed specially when making
# access_urls
if previous_dataset and self.datasets[previous_dataset].access_element_info:
self.ds_with_access_elements_to_process.append(previous_dataset)

previous_dataset = current_dataset

Expand All @@ -346,6 +345,11 @@ def __init__(self, catalog_url):
service_skip = self.services[-1].number_of_subservices
service_skip_count = 0

# Needed if the last dataset had such info, since it's only processed looking backwards
# when a new dataset is encountered.
if previous_dataset and self.datasets[previous_dataset].access_element_info:
self.ds_with_access_elements_to_process.append(previous_dataset)

self._process_datasets()

def __str__(self):
Expand Down
Loading

0 comments on commit 7bd7afd

Please sign in to comment.