@@ -52,30 +52,29 @@ def get_resampled_values(nc_cell, ds, slice_start, varlist, binning_function, ep
5252 :param is_WCUR: flag indicating if WCUR is present
5353 :return: end index of the slice
5454 """
55- nc_cell = nc_cell [varlist ].squeeze ()
56- nc_cell = nc_cell .to_dataframe ()
55+ df_cell = nc_cell [varlist ].squeeze ().to_dataframe ()
5756 ## back the index 30min
58- nc_cell .index = nc_cell .index - pd .Timedelta (minutes = 30 )
57+ df_cell .index = df_cell .index - pd .Timedelta (minutes = 30 )
5958 # TODO: shift timestamps to centre of sampling interval
6059
61- nc_cell_1H = nc_cell .resample ('1H' )
62- slice_end = len (nc_cell_1H ) + slice_start
60+ df_cell_1H = df_cell .resample ('1H' )
61+ slice_end = len (df_cell_1H ) + slice_start
6362
6463 ## move time it forward and get it
65- time_slice = ((np .fromiter (nc_cell_1H .groups .keys (), dtype = 'M8[ns]' ) + np .timedelta64 (1 , 'h' )) - epoch ) / one_day
64+ time_slice = ((np .fromiter (df_cell_1H .groups .keys (), dtype = 'M8[ns]' ) + np .timedelta64 (1 , 'h' )) - epoch ) / one_day
6665 ds ['TIME' ][slice_start :slice_end ] = time_slice
6766
6867 # take the mean of the variables
6968 ds ['UCUR' ][slice_start :slice_end ], \
7069 ds ['VCUR' ][slice_start :slice_end ], \
7170 ds ['WCUR' ][slice_start :slice_end ], \
72- ds ['DEPTH' ][slice_start :slice_end ] = cell_velocity_resample (nc_cell_1H , 'mean' , is_WCUR )
71+ ds ['DEPTH' ][slice_start :slice_end ] = cell_velocity_resample (df_cell_1H , 'mean' , is_WCUR )
7372
7473 for method in binning_function :
7574 ds ['UCUR_' + method ][slice_start :slice_end ], \
7675 ds ['VCUR_' + method ][slice_start :slice_end ], \
7776 ds ['WCUR_' + method ][slice_start :slice_end ], \
78- ds ['DEPTH_' + method ][slice_start :slice_end ] = cell_velocity_resample (nc_cell_1H , method , is_WCUR )
77+ ds ['DEPTH_' + method ][slice_start :slice_end ] = cell_velocity_resample (df_cell_1H , method , is_WCUR )
7978
8079 return slice_end
8180
0 commit comments