MCPcopy Index your code
hub / github.com/pydata/xarray / _is_likely_dap_url

Function _is_likely_dap_url

xarray/backends/common.py:838–869  ·  view source on GitHub ↗

Determines if a URL is likely an OPeNDAP (DAP) endpoint based on known protocols, server software path patterns, and file extensions. Parameters ---------- url : str Returns ------- True if the URL matches common DAP patterns, False otherwise.

(url: str)

Source from the content-addressed store, hash-verified

836
837
838def _is_likely_dap_url(url: str) -> bool:
839 """
840 Determines if a URL is likely an OPeNDAP (DAP) endpoint based on
841 known protocols, server software path patterns, and file extensions.
842
843 Parameters
844 ----------
845 url : str
846
847 Returns
848 -------
849 True if the URL matches common DAP patterns, False otherwise.
850 """
851 if not url:
852 return False
853
854 url_lower = url.lower()
855
856 # For remote URIs, check for DAP server software path patterns
857 if is_remote_uri(url_lower):
858 dap_path_patterns = (
859 "/dodsc/", # THREDDS Data Server (TDS) DAP endpoint (case-insensitive)
860 "/dods/", # GrADS Data Server (GDS) DAP endpoint
861 "/opendap/", # Generic OPeNDAP/Hyrax server
862 "/erddap/", # ERDDAP data server
863 "/dap2/", # Explicit DAP2 version in path
864 "/dap4/", # Explicit DAP4 version in path
865 "/dap/",
866 )
867 return any(pattern in url_lower for pattern in dap_path_patterns)
868
869 return False

Callers 1

guess_can_openMethod · 0.90

Calls 2

is_remote_uriFunction · 0.90
lowerMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…