Skip to content

Commit

Permalink
Load data from file before releasing from context
Browse files Browse the repository at this point in the history
  • Loading branch information
chrowe committed Nov 1, 2024
1 parent 9df8d4b commit ca22dde
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions city_metrix/layers/era_5_hottest_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ def hourly_mean_temperature(image):
# Subset times for the day
times = [valid_time.astype('datetime64[s]').astype(datetime).replace(tzinfo=pytz.UTC) for valid_time in dataarray['valid_time'].values]
indices = [i for i, value in enumerate(times) if value in utc_times]
subset_dataarray = dataarray.isel(valid_time=indices)
subset_dataarray = dataarray.isel(valid_time=indices).load()

dataarray_list.append(subset_dataarray)
dataarray_list.append(subset_dataarray)

# Remove local file
os.remove(f'download_{i}.nc')
Expand Down

0 comments on commit ca22dde

Please sign in to comment.