Skip to content

Commit 261d28a

Browse files
authored
Merge pull request #115 from TGSAI/feature/timezone
ISO 8601 creation time with time-zone information when ingesting SEG-Y
2 parents dd1c7ca + 6d57d32 commit 261d28a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mdio/converters/segy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from __future__ import annotations
55

66
from datetime import datetime
7+
from datetime import timezone
78
from importlib import metadata
89
from typing import Any
910
from typing import Sequence
@@ -197,7 +198,10 @@ def segy_to_mdio(
197198
overwrite=overwrite,
198199
)
199200

200-
write_attribute(name="created", zarr_group=zarr_root, attribute=str(datetime.now()))
201+
# Get UTC time, then add local timezone information offset.
202+
iso_datetime = datetime.now(timezone.utc).isoformat()
203+
204+
write_attribute(name="created", zarr_group=zarr_root, attribute=iso_datetime)
201205
write_attribute(name="api_version", zarr_group=zarr_root, attribute=API_VERSION)
202206

203207
dimensions_dict = [dim.to_dict() for dim in dimensions]

0 commit comments

Comments
 (0)