Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
betolink committed Feb 14, 2025
2 parents ee3152a + ddab53b commit 65d365a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 27 deletions.
2 changes: 1 addition & 1 deletion icepyx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from _icepyx_version import version as __version__
from icepyx.core.base_query import BaseQuery, GenQuery, LegacyQuery
from icepyx.core.base_query import BaseQuery, GenQuery
from icepyx.core.query import Query
from icepyx.core.read import Read
from icepyx.core.variables import Variables
Expand Down
8 changes: 3 additions & 5 deletions icepyx/core/base_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ def __init__(
auth=None,
**kwargs,
):

self._prod = is2ref._validate_product(product)

super().__init__(spatial_extent, date_range, start_time, end_time, **kwargs)
Expand Down Expand Up @@ -448,9 +447,9 @@ def concept_id(self) -> Union[str, None]:
version = self._version
else:
version = is2ref.latest_version(short_name)
collections = earthaccess.search_datasets(short_name=short_name,
version=version,
cloud_hosted=True)
collections = earthaccess.search_datasets(
short_name=short_name, version=version, cloud_hosted=True
)
if collections:
return collections[0].concept_id()
else:
Expand Down Expand Up @@ -901,7 +900,6 @@ def granules(self):
# ----------------------------------------------------------------------
# Methods - Get and display neatly information at the product level


# ----------------------------------------------------------------------
# Methods - Granules (NSIDC-API)

Expand Down
4 changes: 1 addition & 3 deletions icepyx/core/granules.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ def get_avail(
query.Query.avail_granules
"""

assert (
CMRparams is not None
), "Missing required input parameter dictionaries"
assert CMRparams is not None, "Missing required input parameter dictionaries"

# if not hasattr(self, 'avail'):
self.avail = []
Expand Down
7 changes: 4 additions & 3 deletions icepyx/core/is2ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@

# ICESat-2 specific reference functions


def _get_concept_id(product, version):
collections = earthaccess.search_datasets(short_name=product,
version=version,
cloud_hosted=True)
collections = earthaccess.search_datasets(
short_name=product, version=version, cloud_hosted=True
)
if collections:
return collections[0].concept_id()

Expand Down
22 changes: 8 additions & 14 deletions icepyx/core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def download(self, path, overwrite=False):
return earthaccess.download(self.granules, local_path=path)



class Query(BaseQuery):
_temporal: Union[tp.Temporal, None]
_CMRparams: apifmt.CMRParameters
Expand Down Expand Up @@ -118,7 +117,6 @@ def __init__(self, *args, **kwargs):
self._prod, cycles=self.cycles, tracks=self.tracks
)


@property
def cycles(self):
"""
Expand Down Expand Up @@ -159,11 +157,10 @@ def tracks(self):
else:
return sorted(set(self._tracks))


def _get_concept_id(self, product, version) -> Union[str, None]:
collections = earthaccess.search_datasets(short_name=product,
version=version,
cloud_hosted=True)
collections = earthaccess.search_datasets(
short_name=product, version=version, cloud_hosted=True
)
if collections:
return collections[0].concept_id()
else:
Expand All @@ -190,12 +187,10 @@ def show_custom_options(self) -> None:
"""
if self.concept_id:

capabilities = self.harmony_api.get_capabilities(concept_id=self.concept_id)
print(json.dumps(capabilities, indent=2))
return None


@property
def CMRparams(self) -> CMRParams:
"""
Expand All @@ -214,7 +209,6 @@ def CMRparams(self) -> CMRParams:
self._CMRparams = apifmt.Parameters("CMR")
# print(self._CMRparams)
# print(self._CMRparams.fmted_keys)


# dictionary of optional CMR parameters
kwargs = {}
Expand All @@ -239,7 +233,7 @@ def CMRparams(self) -> CMRParams:
)

return self._CMRparams.fmted_keys

@property
def granules(self):
"""
Expand Down Expand Up @@ -328,8 +322,6 @@ def avail_granules(self, ids=False, cycles=False, tracks=False, cloud=False):
else:
return self.granules.avail



def _order_subset_granules(self) -> str:
concept_id = self._get_concept_id(
product=self._prod,
Expand All @@ -338,7 +330,9 @@ def _order_subset_granules(self) -> str:


if concept_id is None:
raise ValueError(f"Could not find concept ID for {self._prod} v{self._version}")
raise ValueError(
f"Could not find concept ID for {self._prod} v{self._version}"
)

readable_granule_name = self.CMRparams.get("readable_granule_name[]", [])
harmony_temporal = None
Expand Down Expand Up @@ -410,7 +404,7 @@ def _order_whole_granules(self, cloud_hosted=False, path="./") -> list[str]:
The local directory to download the granules to.
"""

links = self.get_granule_links(cloud_hosted=cloud_hosted)
files = earthaccess.download(links, local_path=path)
return files
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
backoff
dask[dataframe]
datashader
deprecated
earthaccess>=0.12.0
fiona
geopandas
Expand All @@ -15,4 +16,3 @@ requests
s3fs
shapely
xarray
deprecated

0 comments on commit 65d365a

Please sign in to comment.