From 2bde9ee9879e0784e278402db927d9195c3824b5 Mon Sep 17 00:00:00 2001 From: chauvetige Date: Tue, 17 Sep 2024 11:16:53 +0200 Subject: [PATCH] fix bug for timezone Let the choise to select the timezone #15 --- xdas/io/terra15.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xdas/io/terra15.py b/xdas/io/terra15.py index 2ddedc5..84e5ffc 100644 --- a/xdas/io/terra15.py +++ b/xdas/io/terra15.py @@ -7,13 +7,13 @@ from ..virtual import VirtualSource -def read(fname): +def read(fname,tz=timezone.utc): with h5py.File(fname, "r") as file: ti = np.datetime64( - datetime.fromtimestamp(file["data_product"]["gps_time"][0]), timezone.utc + datetime.fromtimestamp(file["data_product"]["gps_time"][0],tz=tz) ).astype("datetime64[ms]") tf = np.datetime64( - datetime.fromtimestamp(file["data_product"]["gps_time"][-1]), timezone.utc + datetime.fromtimestamp(file["data_product"]["gps_time"][-1],tz=tz) ).astype("datetime64[ms]") d0 = file.attrs["sensing_range_start"] dx = file.attrs["dx"] @@ -21,4 +21,4 @@ def read(fname): nt, nd = data.shape t = {"tie_indices": [0, nt - 1], "tie_values": [ti, tf]} d = {"tie_indices": [0, nd - 1], "tie_values": [d0, d0 + (nd - 1) * dx]} - return DataArray(data, {"time": t, "distance": d}) + return DataArray(data, {"time": t, "distance": d}) \ No newline at end of file