Skip to content

Commit

Permalink
Moving instake kwarg unpacking.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysrevans3 committed Apr 4, 2024
1 parent b48be58 commit be25733
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions stac_generator/plugins/inputs/intake_esm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
- Optional kwargs to pass to `esm_datastore.search
<https://intake-esm.readthedocs.io/en/latest
/api.html#intake_esm.core.esm_datastore.search>`_
* - ``skip``
- ``int``
- Optional value to skip the first n rows
Example Configuration:
Expand Down Expand Up @@ -81,13 +84,11 @@ def __init__(self, **kwargs):
def open_catalog(self, uri, intake_kwargs):
"""Open the ESM catalog."""
LOGGER.info(f"Opening catalog {uri}")
catalog = intake.open_esm_datastore(uri, **intake_kwargs)

return catalog
return intake.open_esm_datastore(uri, **intake_kwargs)

def search_catalog(self, catalog, search_kwargs):
"""Perform a search ESM catalog."""
LOGGER.info(f"Searching catalog")
LOGGER.info("Searching catalog")

if self.search_kwargs:
catalog = catalog.search(**search_kwargs)
Expand All @@ -99,10 +100,10 @@ def run(self, generator: BaseGenerator):
total_files = 0
start = datetime.now()

catalog = self.open_catalog(self.uri, **self.intake_kwargs)
catalog = self.open_catalog(self.uri, self.intake_kwargs)

if self.search_kwargs:
catalog = self.open_catalog(catalog, **self.intake_kwargs)
catalog = self.open_catalog(catalog, self.search_kwargs)

count = 0
for _, row in catalog.df.iterrows():
Expand Down

0 comments on commit be25733

Please sign in to comment.