Skip to content

Commit a7397e5

Browse files
committed
reduce hourly_timeseries memory usage
1 parent b3a467a commit a7397e5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

aodntools/timeseries_products/hourly_timeseries.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,11 @@ def hourly_aggregator(files_to_aggregate, site_code, qcflags, input_dir='', outp
410410
# https://stackoverflow.com/questions/55786995/converting-cftime-datetimejulian-to-datetime/55787899#55787899
411411
if isinstance(nc_clean.indexes['TIME'], xr.coding.cftimeindex.CFTimeIndex):
412412
nc_clean['TIME'] = nc_clean.indexes['TIME'].to_datetimeindex()
413-
df_temp = nc_clean.to_dataframe()
413+
df_temp = nc_clean[parameter_names].to_dataframe()
414414

415415
## keep TIME as the only index (for ADCP files it would be a MultiIndex at this point)
416-
df_temp = df_temp.reset_index().set_index('TIME')
416+
df_temp.reset_index(inplace=True)
417+
df_temp.set_index('TIME', inplace=True)
417418
df_temp = df_temp[parameter_names]
418419

419420
df_temp = PDresample_by_hour(df_temp, function_dict, function_stats) # do the magic

0 commit comments

Comments
 (0)