Created
July 7, 2025 15:02
-
-
Save d-v-b/4b1cc363d95e2bb2b958e7c7e106666a to your computer and use it in GitHub Desktop.
Create a Zarr V3 array with a datetime64 data type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # dependencies = [ | |
| # "zarr@git+https://github.com/zarr-developers/zarr-python.git@main", | |
| # ] | |
| # /// | |
| import numpy as np | |
| import zarr | |
| arr = zarr.create_array(store={}, dtype='datetime64[s]', shape=(3,), zarr_format=3) | |
| arr[:] = np.datetime64('now', 's') | |
| print(arr[:]) | |
| # ['2025-07-07T14:59:01' '2025-07-07T14:59:01' '2025-07-07T14:59:01'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment