Skip to content

Commit

Permalink
Merge pull request #856 from dopplershift/fix-724
Browse files Browse the repository at this point in the history
Fix oceandata hyrax catalog issues
  • Loading branch information
lesserwhirls authored Dec 13, 2024
2 parents 337f581 + b4350d5 commit 97aedbf
Show file tree
Hide file tree
Showing 3 changed files with 919 additions and 17 deletions.
30 changes: 14 additions & 16 deletions src/siphon/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,18 +582,18 @@ def make_access_urls(self, catalog_url, all_services, metadata=None):
if isinstance(service, CompoundService):
for subservice in service.services:
server_base = urljoin(server_url, subservice.base)
access_urls[subservice.service_type] = urljoin(server_base,
self.url_path)
access_urls[subservice.service_type] = server_base + self.url_path
else:
server_base = urljoin(server_url, service.base)
access_urls[service.service_type] = urljoin(server_base, self.url_path)
access_urls[service.service_type] = server_base + self.url_path

# process access children of dataset elements
for service_type in self.access_element_info:
url_path = self.access_element_info[service_type]
if service_type in all_service_dict:
server_base = urljoin(server_url, all_service_dict[service_type].base)
access_urls[service_type] = urljoin(server_base, url_path)
for sname in self.access_element_info:
if sname in all_service_dict:
service = all_service_dict[sname]
url_path = self.access_element_info[sname]
server_base = urljoin(server_url, service.base)
access_urls[service.service_type] = server_base + url_path

self.access_urls = access_urls

Expand Down Expand Up @@ -670,7 +670,8 @@ def remote_access(self, service=None, use_xarray=None):
if service is None:
service = 'CdmRemote' if 'CdmRemote' in self.access_urls else 'OPENDAP'

if service not in (CaseInsensitiveStr('CdmRemote'), CaseInsensitiveStr('OPENDAP')):
if service not in (CaseInsensitiveStr('CdmRemote'), CaseInsensitiveStr('OPENDAP'),
CaseInsensitiveStr('DODS')):
raise ValueError(service + ' is not a valid service for remote_access')

return self.access_with_service(service, use_xarray)
Expand Down Expand Up @@ -735,7 +736,7 @@ def access_with_service(self, service, use_xarray=None):
else:
from .cdmr import Dataset as CDMRDataset
provider = CDMRDataset
elif service == 'OPENDAP':
elif service == 'OPENDAP' or service == 'DODS':
if use_xarray:
try:
import xarray as xr
Expand All @@ -753,7 +754,7 @@ def access_with_service(self, service, use_xarray=None):
elif service in self.ncss_service_names:
from .ncss import NCSS
provider = NCSS
elif service == 'HTTPServer':
elif service == 'HTTPServer' or service == CaseInsensitiveStr('http'):
provider = session_manager.urlopen
else:
raise ValueError(service + ' is not an access method supported by Siphon')
Expand Down Expand Up @@ -851,11 +852,8 @@ def _find_base_tds_url(catalog_url):
Will retain URL scheme, host, port and username/password when present.
"""
url_components = urlparse(catalog_url)
if url_components.path:
return catalog_url.split(url_components.path)[0]
else:
return catalog_url
scheme, netloc, *_ = urlparse(catalog_url)
return scheme + '://' + netloc


def get_latest_access_url(catalog_url, access_method):
Expand Down
Loading

0 comments on commit 97aedbf

Please sign in to comment.