Skip to content

Commit c6b4c26

Browse files
committed
implement banker's rounding workaround in L1 processing script
1 parent f343c7a commit c6b4c26

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pycurrents_ADCP_processing/ADCP_processing_L1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def convert_time_var(time_var, number_of_profiles, meta_dict: dict, origin_year:
128128
median_period = pd.Timedelta(np.nanmedian(np.diff(time_var))).round('s').total_seconds()
129129
# List of accepted units here (use secondly):
130130
# https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timeseries-offset-aliases
131-
median_period = f'{int(np.round(median_period))}S' # convert to string
131+
median_period = f'{utils.round_to_int(median_period)}S' # convert to string
132132

133133
# Assume the first timestamp is correct
134134
date_range = pd.date_range(
@@ -1111,7 +1111,7 @@ def split_ds_by_pressure(input_ds: xr.Dataset, segment_starts: list, segment_end
11111111
input_ds.station.lower(),
11121112
utils.numpy_datetime_to_str_utc(input_ds.time.data[st_idx])[:10].replace('-', ''),
11131113
utils.numpy_datetime_to_str_utc(input_ds.time.data[en_idx])[:10].replace('-', ''),
1114-
f'000{int(np.round(segment_instr_depths[i]))}'[-4:]
1114+
f'000{utils.round_to_int(segment_instr_depths[i])}'[-4:]
11151115
)
11161116

11171117
# File name

0 commit comments

Comments
 (0)