Skip to content

Commit

Permalink
fix(filenames): Remove deprecated errors=ignore (#303)
Browse files Browse the repository at this point in the history
* fix(filenames): Remove edeprecated errors=ignore

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
devsjc and pre-commit-ci[bot] authored Oct 10, 2024
1 parent 3b5bc50 commit eb73d2a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions satip/filenames.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ def get_datetime_from_filename(filename: str, strip_hrv: bool = False) -> pd.Tim
filename = filename.split(".zarr.zip")[0]
date = filename.split("/")[-1]

file_time = pd.to_datetime(
date,
format="%Y%m%d%H%M",
errors="ignore",
utc=True
)
try:
file_time = pd.to_datetime(
date,
format="%Y%m%d%H%M",
utc=True
)
except Exception:
# Replicating deprecated "errors=ignore" behaviour
# Probably want to actually do something about this
file_time = date

return file_time

0 comments on commit eb73d2a

Please sign in to comment.