Skip to content

Commit

Permalink
cleaning mvp
Browse files Browse the repository at this point in the history
  • Loading branch information
rwegener2 committed Nov 7, 2023
1 parent c1a0f99 commit 7801b33
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions icepyx/core/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import warnings

import earthaccess
import h5py
import numpy as np
import xarray as xr
Expand Down Expand Up @@ -340,6 +341,10 @@ def __init__(

if data_source is None:
raise ValueError("data_source is a required arguemnt")

# initialize authentication properties
EarthdataAuthMixin.__init__(self)

# Raise warnings for deprecated arguments
if filename_pattern:
warnings.warn(
Expand Down Expand Up @@ -368,7 +373,7 @@ def __init__(
assert pattern_ck
self._filelist = filelist
elif isinstance(data_source, str) and data_source.startswith('s3'):
self._filelist = list(data_source)
self._filelist = [data_source]
elif isinstance(data_source, list):
self._filelist = data_source
elif os.path.isdir(data_source):
Expand All @@ -378,11 +383,13 @@ def __init__(
self._filelist = glob.glob(data_source, **glob_kwargs)
# Remove any directories from the list
self._filelist = [f for f in self._filelist if not os.path.isdir(f)]

print('FILELIST', self._filelist)
# Create a dictionary of the products as read from the metadata
product_dict = {}
for file_ in self._filelist:
product_dict[file_] = is2ref.extract_product(file_)
# TODO not addressed: If user gives a list of s3 paths, or mixed s3 with local path
print("FILE", file_)
product_dict[file_] = is2ref.extract_product(file_, auth=self.auth)

# Raise warnings or errors for multiple products or products not matching the user-specified product
all_products = list(set(product_dict.values()))
Expand Down Expand Up @@ -434,9 +441,6 @@ def __init__(
"no other output types are implemented yet"
)
self._out_obj = xr.Dataset

# initialize authentication properties
EarthdataAuthMixin.__init__(self)

# ----------------------------------------------------------------------
# Properties
Expand Down

0 comments on commit 7801b33

Please sign in to comment.