In the mailing list I raised the question about data being aligned.
I provided a small code example that showed how data could be misaligned (code in python with a recent version of netcdf4-python)
Code Example
import xarray as xr
import numpy as np
import netCDF4
from pathlib import Path
basic_filename = "basic_file_netcdf4.nc"
if Path(basic_filename).exists():
Path(basic_filename).unlink()
dataset = xr.DataArray(
np.zeros((3072, 3072), dtype='uint8'),
dims=("y", "x"),
coords={
"y": np.arange(3072, dtype=int),
"x": np.arange(3072, dtype=int),
},
name='images').to_dataset()
dataset.to_netcdf(basic_filename, format="NETCDF4", engine="netcdf4")
import h5py
h5file = h5py.File(basic_filename)
h5dataset = h5file.get("images")
offset = h5dataset.id.get_offset()
print(offset % 4096)
print(offset % 2048)
print(offset % 1024)
print(offset % 512)
print(offset % 128)
print(offset % 64)
"""
3206
1158
134
134
6
6
"""
We came to the point where we determined that he user should set the File Access Property at Creation time, near:
|
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) |
I'm opening this as an issue to keep track of the conversation on github.
cc: @edhartnett
Mailing list link: https://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2022/msg00000.html
In the mailing list I raised the question about data being aligned.
I provided a small code example that showed how data could be misaligned (code in python with a recent version of netcdf4-python)
Code Example
We came to the point where we determined that he user should set the File Access Property at Creation time, near:
netcdf-c/libhdf5/hdf5open.c
Line 772 in 988e771
I'm opening this as an issue to keep track of the conversation on github.
cc: @edhartnett
Mailing list link: https://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2022/msg00000.html