Skip to content
Snippets Groups Projects
Commit 4f7178e9 authored by tomrink's avatar tomrink
Browse files

snapshot

parent 9fa27fc6
No related branches found
No related tags found
No related merge requests found
......@@ -5,16 +5,16 @@ import numpy as np
def split_dataset(input_file, output_pattern, dim_name, chunk_size):
# Load the input dataset
ds = nc.Dataset(input_file, 'r', format='NETCDF4')
dim_size = len(ds.dimensions[dim_name])
outer_dim_size = len(ds.dimensions[dim_name])
# Calculate the number of chunks
num_chunks = int(np.ceil(dim_size / chunk_size))
num_chunks = int(np.ceil(outer_dim_size / chunk_size))
# Loop through each chunk
for i in range(num_chunks-1):
# Determine the start and end indices of this chunk
start = i * chunk_size
end = min((i + 1) * chunk_size, dim_size)
end = min((i + 1) * chunk_size, outer_dim_size)
# Slicing along our dimension of interest
slice_indices = slice(start, end)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment