Skip to content

Commit

Permalink
Patch issue #214
Browse files Browse the repository at this point in the history
  • Loading branch information
BSchilperoort committed Apr 13, 2024
1 parent 7561c48 commit f456563
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
Changelog
=========

3.0.1 (2024-04-13)
---

Fixed

* Oryx v4 double ended could have the backward measurements incorrectly cut off during loading.

3.0.0 (2023-11-05)
---

Expand Down
6 changes: 6 additions & 0 deletions src/dtscalibration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importlib.metadata
import warnings

from dtscalibration.dts_accessor import DtsAccessor # noqa: F401
from dtscalibration.dts_accessor_utils import get_netcdf_encoding
Expand All @@ -23,3 +24,8 @@
"shift_double_ended",
"suggest_cable_shift_double_ended",
]

warnings.filterwarnings(
"ignore",
message="Converting non-nanosecond precision timedelta values to nanosecond",
)
18 changes: 8 additions & 10 deletions src/dtscalibration/dts_accessor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,17 +845,15 @@ def merge_double_ended_times(
elif direction == "bw" and direction_next == "fw":
pass

elif direction == "fw" and direction_next == "fw":
if verbose:
print(
f"Missing backward measurement beween {ds_fw.time.values[ind]} and {ds_fw.time.values[ind_next]}"
)
elif direction == "fw" and direction_next == "fw" and verbose:
print(
f"Missing backward measurement beween {ds_fw.time.values[ind]} and {ds_fw.time.values[ind_next]}"
)

elif direction == "bw" and direction_next == "bw":
if verbose:
print(
f"Missing forward measurement beween {ds_bw.time.values[ind]} and {ds_bw.time.values[ind_next]}"
)
elif direction == "bw" and direction_next == "bw" and verbose:
print(
f"Missing forward measurement beween {ds_bw.time.values[ind]} and {ds_bw.time.values[ind_next]}"
)

# throw out is dt differs from its neighbors
if verify_timedeltas:
Expand Down
16 changes: 12 additions & 4 deletions src/dtscalibration/io/sensornet.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ def read_sensornet_files(
or fnmatch.fnmatch(ddf_version, "Sentinel DTS v5*")
):
flip_reverse_measurements = True
elif fnmatch.fnmatch(ddf_version, "ORYX F/W v4*"):
flip_reverse_measurements = False
else:
flip_reverse_measurements = False
warnings.warn(
f"Sensornet .dff version {ddf_version}"
" has not been tested.\nPlease open an issue on github"
f"\n Sensornet .dff version {ddf_version}"
" has not been tested.\n Please open an issue on github"
" and provide an example file"
)

Expand Down Expand Up @@ -398,8 +400,14 @@ def read_sensornet_files_routine_v3(
[0, fiber_bw_1_index - fiber_n_indices - fiber_n_indices_internal]
)

REV_ST = REV_ST[fiber_bw_start_index:fiber_bw_end_index]
REV_AST = REV_AST[fiber_bw_start_index:fiber_bw_end_index]
if (fiber_end_index - fiber_start_index) == (
fiber_bw_end_index - fiber_bw_start_index
):
REV_ST = REV_ST[fiber_bw_start_index:fiber_bw_end_index]
REV_AST = REV_AST[fiber_bw_start_index:fiber_bw_end_index]
else:
REV_ST = REV_ST[fiber_start_index:fiber_end_index]
REV_AST = REV_AST[fiber_start_index:fiber_end_index]

else:
# Use the fiber indices from the forward channel
Expand Down

0 comments on commit f456563

Please sign in to comment.