Datasets:

ArXiv:
License:
maximilianherde commited on
Commit
d0eadc4
1 Parent(s): 13dea61

Update assemble_data.py

Browse files
Files changed (1) hide show
  1. assemble_data.py +12 -12
assemble_data.py CHANGED
@@ -54,18 +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
- 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
 
 
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