Skip to content

Commit

Permalink
Coord bugfix (#97)
Browse files Browse the repository at this point in the history
* Fix for ADV amp/cor coordinates
* Fix for RDI bottom track amp/cor coordinates
  • Loading branch information
jmcvey3 authored Apr 15, 2022
1 parent 3fbf1ce commit ade3396
Show file tree
Hide file tree
Showing 30 changed files with 63 additions and 60 deletions.
12 changes: 8 additions & 4 deletions dolfyn/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,22 @@ def _create_dataset(data):
'dim_1': 'time_echo'})
ds[key] = ds[key].assign_coords({'range_echo': data['coords']['range_echo'],
'time_echo': data['coords']['time_echo']})
# 3- & 4-beam instrument vector data, bottom tracking
# ADV/ADCP instrument vector data, bottom tracking
elif shp[0] == vshp[0] and not any(val in key for val in tag[:2]):
# b/c rdi time
if 'bt' in key and 'time_bt' in data['coords']:
tg = '_bt'
else:
tg = ''
ds[key] = ds[key].rename({'dim_0': 'dir',
if 'amp' in key or 'corr' in key:
dim0 = 'beam'
else:
dim0 = 'dir'
ds[key] = ds[key].rename({'dim_0': dim0,
'dim_1': 'time'+tg})
ds[key] = ds[key].assign_coords({'dir': beam,
ds[key] = ds[key].assign_coords({dim0: beam,
'time'+tg: data['coords']['time'+tg]})
# 4-beam instrument IMU data
# ADCP IMU data
elif shp[0] == vshp[0]-1:
if not any(val in key for val in tag):
tg = ''
Expand Down
1 change: 0 additions & 1 deletion dolfyn/io/rdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def _remove_gps_duplicates(dat):
"""

dat['data_vars']['hdwtime_gps'] = dat['coords']['time']
dat['units']['hdwtime'] = 'seconds since 1970-01-01 00:00:00'

# Remove duplicate timestamp values, if applicable
dat['coords']['time_gps'], idx = np.unique(dat['coords']['time_gps'],
Expand Down
4 changes: 2 additions & 2 deletions dolfyn/tests/data/RDI_withBT.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/burst_mode01.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01.repr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
- roll ('time',)
- temp ('time',)
- pressure ('time',)
- amp ('dir', 'time')
- corr ('dir', 'time')
- amp ('beam', 'time')
- corr ('beam', 'time')
... and others (see `<obj>.variables`)
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01_GN.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01_avg.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01_bin.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01_rclean.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01_rotate_earth2principal.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01_rotate_inst2beam.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01_rotate_inst2earth.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data01_sclean.nc
Git LFS file not shown
2 changes: 1 addition & 1 deletion dolfyn/tests/data/vector_data01_u.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01-json.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01-json_mc.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01_GN.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01_head_pitch_roll.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01_mc.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01_mcDeclin10.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01_mcsp.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01_rotate_earth2principal.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01_rotate_inst2beam.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vector_data_imu01_rotate_inst2earth.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/vmdas01.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/winriver01.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/winriver02.nc
Git LFS file not shown
4 changes: 2 additions & 2 deletions dolfyn/tests/data/winriver02_rotate_ship2earth.nc
Git LFS file not shown

0 comments on commit ade3396

Please sign in to comment.