Skip to content

Commit

Permalink
Merge pull request #276 from blaylockbk/275-eoferror-no-valid-message…
Browse files Browse the repository at this point in the history
…-found

Check that curl is in system path; warn if it is not
  • Loading branch information
blaylockbk authored Jan 25, 2024
2 parents 27ddddd + 3234876 commit 94c6034
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ MANIFEST
$TMPDIR/

$TMPDIR/
data/

herbie/_version.py
32 changes: 19 additions & 13 deletions herbie/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,16 @@

log = logging.getLogger(__name__)

# Location of wgrib2 command, if it exists
# Location of wgrib2 command, if it exists. Required to make missing idx files.
wgrib2 = which("wgrib2")

# Location of curl command. Required to download data.
curl = which("curl")
if curl is None:
warnings.warn(
"Curl is not in system Path. Herbie won't be able to download GRIB files."
)


def wgrib2_idx(grib2filepath):
"""
Expand Down Expand Up @@ -324,17 +331,16 @@ def help(self):
HELP = self.HELP.strip().replace("\n", "\n│ ")
else:
HELP = "│"
print(
"╭─Herbie────────────────────────────────\n"
f"│ Help for model='{self.model}'\n"
f"│ \n"
f"│ {self.DESCRIPTION}\n"
f"│ {str(self.DETAILS).replace(',', '\n│')}\n"
f"│ \n"
f"│ {HELP}\n"
f"│ \n"
"╰───────────────────────────────────────\n"
)
print("╭─ Herbie ────────────────────────────────")
print(f"│ Help for model='{self.model}'")
print("│ ")
print(f"│ {self.DESCRIPTION}")
for key, value in self.DETAILS.items():
print(f"│ {key}: {value}")
print("│")
print(f"│ {HELP}")
print("│")
print("╰─────────────────────────────────────────")

def tell_me_everything(self):
"""Print all the attributes of the Herbie object."""
Expand Down Expand Up @@ -666,7 +672,7 @@ def index_as_dataframe(self):
df["reference_time"] = pd.to_datetime(
df.reference_time, format="d=%Y%m%d%H"
)
df["valid_time"] = df["reference_time"] + pd.to_timedelta(f"{self.fxx}H")
df["valid_time"] = df["reference_time"] + pd.to_timedelta(f"{self.fxx}h")
df["start_byte"] = df["start_byte"].astype(int)
df["end_byte"] = df["start_byte"].shift(-1) - 1
df["range"] = df.apply(
Expand Down

0 comments on commit 94c6034

Please sign in to comment.