Datasets:

ArXiv:
License:
maximilianherde commited on
Commit
cc2671e
·
verified ·
1 Parent(s): b93c353

Upload assemble_data.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. assemble_data.py +12 -5
assemble_data.py CHANGED
@@ -54,11 +54,18 @@ def assemble_data(input_dir, output_file):
54
  variable = nc.variables[nc_file.split("_")[0]]
55
  out_nc[nc_file.split("_")[0]][samples[i] : samples[i + 1]] = variable[:]
56
 
57
- for i, c_file in enumerate(c_files):
58
- with Dataset(os.path.join(input_dir, c_file), "r") as nc:
59
- print(f"Processing {os.path.join(input_dir, c_file)}")
60
- variable = nc.variables[c_file.split("_")[0]]
61
- out_nc[c_file.split("_")[0]][samples[i] : samples[i + 1]] = variable[:]
 
 
 
 
 
 
 
62
 
63
  print(f"Saved data to {output_file}")
64
 
 
54
  variable = nc.variables[nc_file.split("_")[0]]
55
  out_nc[nc_file.split("_")[0]][samples[i] : samples[i + 1]] = variable[:]
56
 
57
+ samples = [0]
58
+ for nc_file in c_files[]:
59
+ with Dataset(os.path.join(input_dir, nc_file), "r") as nc:
60
+ samples.append(nc.dimensions["sample"].size)
61
+ for i in range(1, len(samples)):
62
+ samples[i] += samples[i - 1]
63
+
64
+ for i, c_file in enumerate(c_files):
65
+ with Dataset(os.path.join(input_dir, c_file), "r") as nc:
66
+ print(f"Processing {os.path.join(input_dir, c_file)}")
67
+ variable = nc.variables[c_file.split("_")[0]]
68
+ out_nc[c_file.split("_")[0]][samples[i] : samples[i + 1]] = variable[:]
69
 
70
  print(f"Saved data to {output_file}")
71