Skip to content

Commit

Permalink
ensure only numeric characters are found from leadtime
Browse files Browse the repository at this point in the history
  • Loading branch information
khintz committed Mar 11, 2024
1 parent 32596fe commit 4d960c9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dlotter/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pygrib
import numpy as np
import datetime as dt
import re
from dmit import regrot
from typing import Union

Expand Down Expand Up @@ -180,6 +181,9 @@ def read(self, args:argparse.Namespace, files_to_read:list) -> xr.Dataset:

leadtimes.append(lead)

# Ensure we only have numeric characters
lead = int(re.findall(r'\d+', lead)[0])

forecast = analysis + dt.timedelta(minutes=lead)
Nt_coords[k] = forecast

Expand Down

0 comments on commit 4d960c9

Please sign in to comment.