I have a combined zarr named bigzarrno5.zarr,it has dimensions valid_time, longitude, latitude, pressure_level,and it contain day 1,2,3,4,6 and the valid_time format is datatime64 like ‘2020-11-01T00:00:00.000000000’,each day have 24 hours.Now I have a day5.zarr,it has the same dimensions with bigzarrno5.zarr except valid time becase its time is from 2020-11-05T00:00:00.000000000 to 2020-11-05T23:00:00.000000000, i want to insert the day4.zarr to the bigzarrno5.zarr without rewrite the whole zarr, because i think the zarr file store data in chunk, i just need to store the day4.zarr’s chunk in a proper location and update the metadata, that’s means I didn’t need to change the original chunk.
What is your question? Yes, you can write new data into the middle of a zarr dataset, probably best by using xarray. It will only rewrite affected chunks, not the whole of the data. How many chunks that is, depends on the chunking in the data you already have.
Thank you. What I mean is that I want to insert data between the 4th and 6th days. Should I use the region
parameter of the to_zarr()
function for this? How should I set the region
parameter, considering that this is inserting into the position where the 6th day’s data originally was?
I think region
is the one, yes. I use the lower-level zarr API for most things, where you can use index slices like x[10:20] = ...
, so I am not sure for you.