@@ -181,7 +181,7 @@ def __init__(
181
181
self .cs = []
182
182
self .cs_sl = []
183
183
self .cfg = {}
184
- self .cfgbb = {}
184
+ self .cfgBB = {}
185
185
self .hdr = {}
186
186
self .f = lib .bin_reader (self .fname )
187
187
@@ -191,17 +191,17 @@ def __init__(
191
191
self ._npings = self ._filesize // space
192
192
if self ._debug_level > - 1 :
193
193
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 ))
196
196
self .f .seek (self ._pos , 0 )
197
197
self .n_avg = navg
198
198
199
199
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" ])
202
202
203
203
self .vars_read = lib ._variable_setlist (["time" ])
204
- if self ._bb :
204
+ if self ._BB :
205
205
self .vars_readBB = lib ._variable_setlist (["time" ])
206
206
207
207
def code_spacing (self , iternum = 50 ):
@@ -214,7 +214,7 @@ def code_spacing(self, iternum=50):
214
214
# Get basic header data and check dual profile
215
215
if not self .read_hdr ():
216
216
raise RuntimeError ("No header in this file" )
217
- self ._bb = self .check_for_double_buffer ()
217
+ self ._BB = self .check_for_double_buffer ()
218
218
219
219
# Turn off debugging to check code spacing
220
220
debug_level = self ._debug_level
@@ -305,21 +305,21 @@ def load_data(self, nens=None):
305
305
self .remove_end (iens )
306
306
break
307
307
self .ensemble .clean_data ()
308
- if self ._bb :
308
+ if self ._BB :
309
309
self .ensembleBB .clean_data ()
310
310
ens = [self .ensemble ]
311
311
vars = [self .vars_read ]
312
312
datl = [self .outd ]
313
313
cfgl = [self .cfg ]
314
- if self ._bb :
314
+ if self ._BB :
315
315
ens += [self .ensembleBB ]
316
316
vars += [self .vars_readBB ]
317
317
datl += [self .outdBB ]
318
- cfgl += [self .cfgbb ]
318
+ cfgl += [self .cfgBB ]
319
319
320
- for var , en , dat in zip (vars , ens , datl ):
320
+ for var , en , dat , cfg in zip (vars , ens , datl , cfgl ):
321
321
for nm in var :
322
- dat = self .save_profiles (dat , nm , en , iens )
322
+ dat = self .save_profiles (dat , cfg , nm , en , iens )
323
323
# reset flag after all variables run
324
324
self .n_cells_diff = 0
325
325
@@ -343,14 +343,14 @@ def load_data(self, nens=None):
343
343
else :
344
344
dat ["coords" ]["time" ][iens ] = np .median (dates )
345
345
346
- # Finalize dataset (runs through both nb and bb )
346
+ # Finalize dataset (runs through both NB and BB )
347
347
for dat , cfg in zip (datl , cfgl ):
348
348
dat , cfg = self .cleanup (dat , cfg )
349
349
dat = self .finalize (dat , cfg )
350
350
if "vel_bt" in dat ["data_vars" ]:
351
351
cfg ["rotate_vars" ].append ("vel_bt" )
352
352
353
- datbb = self .outdBB if self ._bb else None
353
+ datbb = self .outdBB if self ._BB else None
354
354
return dat , datbb
355
355
356
356
def init_data (self ):
@@ -363,7 +363,7 @@ def init_data(self):
363
363
"standard_name" : {},
364
364
"sys" : {},
365
365
}
366
- if self ._bb :
366
+ if self ._BB :
367
367
outdbb = {
368
368
"data_vars" : {},
369
369
"coords" : {},
@@ -380,25 +380,25 @@ def init_data(self):
380
380
)
381
381
self .outd = outd
382
382
383
- if self ._bb :
383
+ if self ._BB :
384
384
for nm in defs .data_defs :
385
385
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" ])
387
387
)
388
388
self .outdBB = outdbb
389
389
if self ._debug_level > 1 :
390
390
logging .info (np .shape (outdbb ["data_vars" ]["vel" ]))
391
391
392
392
if self ._debug_level > 1 :
393
393
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" ]))
396
396
397
397
def read_buffer (self ):
398
398
"""Read through the file"""
399
399
fd = self .f
400
400
self .ensemble .k = - 1 # so that k+=1 gives 0 on the first loop.
401
- if self ._bb :
401
+ if self ._BB :
402
402
self .ensembleBB .k = - 1 # so that k+=1 gives 0 on the first loop.
403
403
self .print_progress ()
404
404
hdr = self .hdr
@@ -758,7 +758,7 @@ def remove_end(self, iens):
758
758
for nm in self .vars_read :
759
759
lib ._setd (dat , nm , lib ._get (dat , nm )[..., :iens ])
760
760
761
- def save_profiles (self , dat , nm , en , iens ):
761
+ def save_profiles (self , dat , cfg , nm , en , iens ):
762
762
"""
763
763
Reformats profile measurements in the retrieved measurements.
764
764
@@ -769,7 +769,11 @@ def save_profiles(self, dat, nm, en, iens):
769
769
Parameters
770
770
----------
771
771
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`.
773
777
nm : str
774
778
The name of the profile variable
775
779
en : dict
@@ -836,10 +840,11 @@ def cleanup(self, dat, cfg):
836
840
Parameters
837
841
----------
838
842
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`.
840
845
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` .
843
848
844
849
Returns
845
850
-------
@@ -965,9 +970,11 @@ def finalize(self, dat, cfg):
965
970
Parameters
966
971
----------
967
972
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`.
971
978
972
979
Returns
973
980
-------
0 commit comments