Skip to content

Commit

Permalink
Merge pull request #42 from UW-SASWE/pritam-patch-2
Browse files Browse the repository at this point in the history
patch fixing date referenced before assignment
  • Loading branch information
SanchitMinocha authored May 16, 2023
2 parents 5bbcefc + bcacaf2 commit 4762505
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rat/data_processing/newdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ def process_precip(basin_bounds, srcpath, dstpath, secrets=None, temp_datadir=No
ASCII grid file and saved at `dstpath`. All of this is done in a temporarily created directory
which can be controlled by the `datadir` path
"""
date = pd.to_datetime(src_fn.stem.split('_')[0])

if temp_datadir is not None and not os.path.isdir(temp_datadir):
log.warning(f"ERROR: {temp_datadir} directory doesn't exist")
STATUS='FAILED'
Expand Down Expand Up @@ -420,7 +422,6 @@ def process_precip(basin_bounds, srcpath, dstpath, secrets=None, temp_datadir=No

except subprocess.CalledProcessError as e:
src_fn = Path(srcpath)
date = pd.to_datetime(src_fn.stem.split('_')[0])
log.error(f"subprocess.CalledProcessError in {date}: ", e)
# delete old precipitation file and redownload. retry once
try:
Expand Down

0 comments on commit 4762505

Please sign in to comment.