From f8901ade489c8c211658ec13a5757ce1b6259ff9 Mon Sep 17 00:00:00 2001 From: Sherwin Varghese <141290943+Sherwin-14@users.noreply.github.com> Date: Fri, 31 May 2024 21:23:25 +0530 Subject: [PATCH] Update search.py --- earthaccess/results.py | 27 ++++++++++++++++++--------- earthaccess/search.py | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/earthaccess/results.py b/earthaccess/results.py index 0f6a8c58..f94889b7 100644 --- a/earthaccess/results.py +++ b/earthaccess/results.py @@ -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( @@ -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"] @@ -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"] @@ -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: @@ -157,7 +162,8 @@ 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 @@ -165,7 +171,8 @@ def get_data(self) -> List[str]: 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"] @@ -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"] @@ -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 diff --git a/earthaccess/search.py b/earthaccess/search.py index 49235cd7..6dd7f004 100644 --- a/earthaccess/search.py +++ b/earthaccess/search.py @@ -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,