Skip to content

Commit

Permalink
Merge pull request #21 from jgieseler/main
Browse files Browse the repository at this point in the history
Catch missing ephin-5/15 file
  • Loading branch information
jgieseler authored Dec 14, 2022
2 parents 6f2d550 + 4eb3c92 commit aef98b1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions seppy/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,17 @@ def load_data(self, spacecraft, sensor, viewing, data_level,

self.update_viewing(viewing)
return df, meta

if self.sensor in ("ephin-5", "ephin-15"):

dataset = "ephin_flux_2020-2022.csv"
datacols = ["date", "E5", "E15"]

df = pd.read_csv(f"{self.data_path}{os.sep}{dataset}", usecols=datacols,
index_col="date", parse_dates=True)
if os.path.isfile(f"{self.data_path}{dataset}"):
df = pd.read_csv(f"{self.data_path}{dataset}", usecols=datacols,
index_col="date", parse_dates=True)
else:
raise Warning(f"File {dataset} not found at {self.data_path}! Please verify that 'data_path' is correct.")
meta = {"E5": "0.45 - 0.50 MeV",
"E15": "0.70 - 1.10 MeV"}

Expand Down Expand Up @@ -390,7 +393,6 @@ def load_all_viewing(self):
self.current_df_e = self.df
self.current_energies = self.meta


if self.spacecraft.lower() == 'wind':
if self.sensor.lower() == '3dp':
self.df_omni_i, self.df_omni_e, self.df_i, self.df_e, self.meta_i, self.meta_e = \
Expand Down Expand Up @@ -2156,7 +2158,7 @@ def print_energies(self):

if self.sensor == "ephin":
channel_numbers = np.array([int(name.split('E')[-1]) for name in channel_names])

if self.sensor in ["ephin-5", "ephin-15"]:
channel_numbers = [5, 15]

Expand Down

0 comments on commit aef98b1

Please sign in to comment.