Skip to content

Commit

Permalink
Update search.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherwin-14 committed Jun 5, 2024
1 parent 17ffb90 commit f8901ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
27 changes: 18 additions & 9 deletions earthaccess/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,16 @@ def get_umm(self, umm_field: str) -> Union[str, Dict[str, Any]]:
def concept_id(self) -> str:
"""Placeholder.
Returns: A collection's `concept_id`.This id is the most relevant search field on granule queries.
Returns:
A collection's `concept_id`.This id is the most relevant search field on granule queries.
"""
return self["meta"]["concept-id"]

def data_type(self) -> str:
"""Placeholder.
Returns: The collection data type, i.e. HDF5, CSV etc., if available.
Returns:
The collection data type, i.e. HDF5, CSV etc., if available.
"""
if "ArchiveAndDistributionInformation" in self["umm"]:
return str(
Expand All @@ -129,7 +131,8 @@ def data_type(self) -> str:
def version(self) -> str:
"""Placeholder.
Returns: The collection's version.
Returns:
The collection's version.
"""
if "Version" in self["umm"]:
return self["umm"]["Version"]
Expand All @@ -138,7 +141,8 @@ def version(self) -> str:
def abstract(self) -> str:
"""Placeholder.
Returns:The abstract of a collection.
Returns:
The abstract of a collection.
"""
if "Abstract" in self["umm"]:
return self["umm"]["Abstract"]
Expand All @@ -147,7 +151,8 @@ def abstract(self) -> str:
def landing_page(self) -> str:
"""Placeholder.
Returns: The first landing page for the collection (can be many), if available.
Returns:
The first landing page for the collection (can be many), if available.
"""
links = self._filter_related_links("LANDING PAGE")
if len(links) > 0:
Expand All @@ -157,15 +162,17 @@ def landing_page(self) -> str:
def get_data(self) -> List[str]:
"""Placeholder.
Returns: The GET DATA links (usually a landing page link, a DAAC portal, or an FTP location).
Returns:
The GET DATA links (usually a landing page link, a DAAC portal, or an FTP location).
"""
links = self._filter_related_links("GET DATA")
return links

def s3_bucket(self) -> Dict[str, Any]:
"""Placeholder.
Returns: The S3 bucket information if the collection has it.(**cloud hosted collections only**).
Returns:
The S3 bucket information if the collection has it.(**cloud hosted collections only**).
"""
if "DirectDistributionInformation" in self["umm"]:
return self["umm"]["DirectDistributionInformation"]
Expand Down Expand Up @@ -244,7 +251,8 @@ def get_s3_credentials_endpoint(self) -> Union[str, None]:
def size(self) -> float:
"""Placeholder.
Returns: The total size for the granule in MB.
Returns:
The total size for the granule in MB.
"""
try:
data_granule = self["umm"]["DataGranule"]
Expand Down Expand Up @@ -328,7 +336,8 @@ def data_links(
def dataviz_links(self) -> List[str]:
"""Placeholder.
Returns: The data visualization links, usually the browse images.
Returns:
The data visualization links, usually the browse images.
"""
links = self._filter_related_links("GET RELATED VISUALIZATION")
return links
2 changes: 1 addition & 1 deletion earthaccess/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_results(

class DataCollections(CollectionQuery):
"""Placeholder.
???+ Info
The DataCollection class queries against
https://cmr.earthdata.nasa.gov/search/collections.umm_json,
Expand Down

0 comments on commit f8901ad

Please sign in to comment.