Skip to content

Commit f76df1b

Browse files
committed
Fix docstrings
1 parent fabb035 commit f76df1b

File tree

2 files changed

+37
-30
lines changed

2 files changed

+37
-30
lines changed

examples/data/dolfyn/test_data/RDI_withBT.dolfyn.log

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ root - INFO - id 768 offset 352
1515
root - INFO - id 1024 offset 422
1616
root - INFO - id 1536 offset 492
1717
root - INFO - Done: {'prog_ver': 51.41, 'inst_make': 'TRDI', 'inst_type': 'ADCP', 'rotate_vars': ['vel'], 'has_imu': 0, 'inst_model': 'Workhorse', 'beam_angle': 20, 'freq': 600, 'beam_pattern': 'convex', 'orientation': 'down', 'n_beams': 4, 'n_cells': 17, 'pings_per_ensemble': 1, 'cell_size': 1.0, 'blank_dist': 0.88, 'profiling_mode': 1, 'min_corr_threshold': 64, 'n_code_reps': 5, 'min_prcnt_gd': 0, 'max_error_vel': 2.0, 'sec_between_ping_groups': 0.5, 'coord_sys': 'earth', 'use_pitchroll': 'yes', 'use_3beam': 'yes', 'bin_mapping': 'yes', 'heading_misalign_deg': 0.0, 'magnetic_var_deg': 0.0, 'sensors_src': '01111101', 'sensors_avail': '00111101', 'bin1_dist_m': 2.09, 'transmit_pulse_m': 1.18, 'water_ref_cells': [1, 5], 'false_target_threshold': 50, 'transmit_lag_m': 0.24, 'bandwidth': 0, 'power_level': 255, 'serialnum': 18655}
18-
root - INFO - self._bb False
19-
root - INFO - self.cfgbb: {}
18+
root - INFO - self._BB False
19+
root - INFO - self.cfgBB: {}
2020
root - INFO - taking data from pings 0 - 1721
2121
root - INFO - 1721 ensembles will be produced.
2222

mhkit/dolfyn/io/rdi.py

+35-28
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def __init__(
181181
self.cs = []
182182
self.cs_sl = []
183183
self.cfg = {}
184-
self.cfgbb = {}
184+
self.cfgBB = {}
185185
self.hdr = {}
186186
self.f = lib.bin_reader(self.fname)
187187

@@ -191,17 +191,17 @@ def __init__(
191191
self._npings = self._filesize // space
192192
if self._debug_level > -1:
193193
logging.info("Done: {}".format(self.cfg))
194-
logging.info("self._bb {}".format(self._bb))
195-
logging.info("self.cfgbb: {}".format(self.cfgbb))
194+
logging.info("self._BB {}".format(self._BB))
195+
logging.info("self.cfgBB: {}".format(self.cfgBB))
196196
self.f.seek(self._pos, 0)
197197
self.n_avg = navg
198198

199199
self.ensemble = lib._ensemble(self.n_avg, self.cfg["n_cells"])
200-
if self._bb:
201-
self.ensembleBB = lib._ensemble(self.n_avg, self.cfgbb["n_cells"])
200+
if self._BB:
201+
self.ensembleBB = lib._ensemble(self.n_avg, self.cfgBB["n_cells"])
202202

203203
self.vars_read = lib._variable_setlist(["time"])
204-
if self._bb:
204+
if self._BB:
205205
self.vars_readBB = lib._variable_setlist(["time"])
206206

207207
def code_spacing(self, iternum=50):
@@ -214,7 +214,7 @@ def code_spacing(self, iternum=50):
214214
# Get basic header data and check dual profile
215215
if not self.read_hdr():
216216
raise RuntimeError("No header in this file")
217-
self._bb = self.check_for_double_buffer()
217+
self._BB = self.check_for_double_buffer()
218218

219219
# Turn off debugging to check code spacing
220220
debug_level = self._debug_level
@@ -305,21 +305,21 @@ def load_data(self, nens=None):
305305
self.remove_end(iens)
306306
break
307307
self.ensemble.clean_data()
308-
if self._bb:
308+
if self._BB:
309309
self.ensembleBB.clean_data()
310310
ens = [self.ensemble]
311311
vars = [self.vars_read]
312312
datl = [self.outd]
313313
cfgl = [self.cfg]
314-
if self._bb:
314+
if self._BB:
315315
ens += [self.ensembleBB]
316316
vars += [self.vars_readBB]
317317
datl += [self.outdBB]
318-
cfgl += [self.cfgbb]
318+
cfgl += [self.cfgBB]
319319

320-
for var, en, dat in zip(vars, ens, datl):
320+
for var, en, dat, cfg in zip(vars, ens, datl, cfgl):
321321
for nm in var:
322-
dat = self.save_profiles(dat, nm, en, iens)
322+
dat = self.save_profiles(dat, cfg, nm, en, iens)
323323
# reset flag after all variables run
324324
self.n_cells_diff = 0
325325

@@ -343,14 +343,14 @@ def load_data(self, nens=None):
343343
else:
344344
dat["coords"]["time"][iens] = np.median(dates)
345345

346-
# Finalize dataset (runs through both nb and bb)
346+
# Finalize dataset (runs through both NB and BB)
347347
for dat, cfg in zip(datl, cfgl):
348348
dat, cfg = self.cleanup(dat, cfg)
349349
dat = self.finalize(dat, cfg)
350350
if "vel_bt" in dat["data_vars"]:
351351
cfg["rotate_vars"].append("vel_bt")
352352

353-
datbb = self.outdBB if self._bb else None
353+
datbb = self.outdBB if self._BB else None
354354
return dat, datbb
355355

356356
def init_data(self):
@@ -363,7 +363,7 @@ def init_data(self):
363363
"standard_name": {},
364364
"sys": {},
365365
}
366-
if self._bb:
366+
if self._BB:
367367
outdbb = {
368368
"data_vars": {},
369369
"coords": {},
@@ -380,25 +380,25 @@ def init_data(self):
380380
)
381381
self.outd = outd
382382

383-
if self._bb:
383+
if self._BB:
384384
for nm in defs.data_defs:
385385
outdbb = lib._idata(
386-
outdbb, nm, sz=lib._get_size(nm, self._nens, self.cfgbb["n_cells"])
386+
outdbb, nm, sz=lib._get_size(nm, self._nens, self.cfgBB["n_cells"])
387387
)
388388
self.outdBB = outdbb
389389
if self._debug_level > 1:
390390
logging.info(np.shape(outdbb["data_vars"]["vel"]))
391391

392392
if self._debug_level > 1:
393393
logging.info("{} ncells, not BB".format(self.cfg["n_cells"]))
394-
if self._bb:
395-
logging.info("{} ncells, BB".format(self.cfgbb["n_cells"]))
394+
if self._BB:
395+
logging.info("{} ncells, BB".format(self.cfgBB["n_cells"]))
396396

397397
def read_buffer(self):
398398
"""Read through the file"""
399399
fd = self.f
400400
self.ensemble.k = -1 # so that k+=1 gives 0 on the first loop.
401-
if self._bb:
401+
if self._BB:
402402
self.ensembleBB.k = -1 # so that k+=1 gives 0 on the first loop.
403403
self.print_progress()
404404
hdr = self.hdr
@@ -758,7 +758,7 @@ def remove_end(self, iens):
758758
for nm in self.vars_read:
759759
lib._setd(dat, nm, lib._get(dat, nm)[..., :iens])
760760

761-
def save_profiles(self, dat, nm, en, iens):
761+
def save_profiles(self, dat, cfg, nm, en, iens):
762762
"""
763763
Reformats profile measurements in the retrieved measurements.
764764
@@ -769,7 +769,11 @@ def save_profiles(self, dat, nm, en, iens):
769769
Parameters
770770
----------
771771
dat : dict
772-
Raw data dictionary
772+
Contains data for the final dataset. This variable has the same pointer
773+
as the data dictionary `self.outd` or `self.outdBB`.
774+
cfg : dict
775+
Global attributes for the final dataset. This variable has the same pointer
776+
as the configuration dictionary `self.cfg` or `self.cfgBB`.
773777
nm : str
774778
The name of the profile variable
775779
en : dict
@@ -836,10 +840,11 @@ def cleanup(self, dat, cfg):
836840
Parameters
837841
----------
838842
dat : dict
839-
The dataset dictionary containing data variables and coordinates to be cleaned up.
843+
Contains data for the final dataset. This variable has the same pointer
844+
as the data dictionary `self.outd` or `self.outdBB`.
840845
cfg : dict
841-
Configuration dictionary, which is updated with cell size, range, and additional
842-
attributes after cleanup.
846+
Global attributes for the final dataset. This variable has the same pointer
847+
as the configuration dictionary `self.cfg` or `self.cfgBB`.
843848
844849
Returns
845850
-------
@@ -965,9 +970,11 @@ def finalize(self, dat, cfg):
965970
Parameters
966971
----------
967972
dat : dict
968-
The dataset dictionary to be finalized. This dictionary is modified
969-
in place by removing unused attributes, setting configuration values
970-
as attributes, and calculating `fs`.
973+
Contains data for the final dataset. This variable has the same pointer
974+
as the data dictionary `self.outd` or `self.outdBB`.
975+
cfg : dict
976+
Global attributes for the final dataset. This variable has the same pointer
977+
as the configuration dictionary `self.cfg` or `self.cfgBB`.
971978
972979
Returns
973980
-------

0 commit comments

Comments
 (0)