import xarray as xr
import numpy as np
# Create coordinate arrays
x = np.arange(0, 10, 1) # 10 points along X
y = np.arange(0, 5, 1) # 5 points along Y
# Create some example 2D data (here we'll use a simple grid pattern)
data = np.random.rand(len(y), len(x)) # 5x10 grid of random values
# Create the dataset
ds = xr.Dataset(
data_vars={
'DATA': (['Y', 'X/var'], data) # Define data with dimensions
},
coords={
'X/var': x,
'Y': y
}
)
# Print the dataset to see its structure
print(ds)
ds.to_zarr("test.zarr")
Sample program of the behavior MDIO should follow.
Updating hello_mdio with variable X updated to have the name X/var generates the .zmetadata file under dir X.