rename
Browse files- .gitignore +2 -2
- merge_hdf5.py +56 -0
- upload.py +11 -0
- waveform.h5 +2 -2
- waveform_test.h5 +2 -2
- waveform_train.h5 +2 -2
.gitignore
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
|
2 |
-
|
|
|
1 |
+
waveform_h5/2019.h5
|
2 |
+
waveform_h5/2020.h5
|
merge_hdf5.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# %%
|
2 |
+
import os
|
3 |
+
|
4 |
+
import h5py
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
from tqdm import tqdm
|
7 |
+
|
8 |
+
# %%
|
9 |
+
h5_dir = "waveform_h5"
|
10 |
+
h5_out = "waveform.h5"
|
11 |
+
h5_train = "waveform_train.h5"
|
12 |
+
h5_test = "waveform_test.h5"
|
13 |
+
|
14 |
+
h5_files = sorted(os.listdir(h5_dir))
|
15 |
+
h5_files = [x for x in h5_files if (x not in ["2019.h5", "2020.h5"])]
|
16 |
+
train_files = h5_files[:-1]
|
17 |
+
test_files = h5_files[-1:]
|
18 |
+
print(f"train files: {train_files}")
|
19 |
+
print(f"test files: {test_files}")
|
20 |
+
|
21 |
+
# %%
|
22 |
+
with h5py.File(h5_out, "w") as fp:
|
23 |
+
# external linked file
|
24 |
+
for h5_file in h5_files:
|
25 |
+
with h5py.File(os.path.join(h5_dir, h5_file), "r") as f:
|
26 |
+
for event in tqdm(f.keys(), desc=h5_file, total=len(f.keys())):
|
27 |
+
if event not in fp:
|
28 |
+
fp[event] = h5py.ExternalLink(os.path.join(h5_dir, h5_file), event)
|
29 |
+
else:
|
30 |
+
print(f"{event} already exists")
|
31 |
+
continue
|
32 |
+
|
33 |
+
# %%
|
34 |
+
with h5py.File(h5_train, "w") as fp:
|
35 |
+
# external linked file
|
36 |
+
for h5_file in train_files:
|
37 |
+
with h5py.File(os.path.join(h5_dir, h5_file), "r") as f:
|
38 |
+
for event in tqdm(f.keys(), desc=h5_file, total=len(f.keys())):
|
39 |
+
if event not in fp:
|
40 |
+
fp[event] = h5py.ExternalLink(os.path.join(h5_dir, h5_file), event)
|
41 |
+
else:
|
42 |
+
print(f"{event} already exists")
|
43 |
+
continue
|
44 |
+
|
45 |
+
# %%
|
46 |
+
with h5py.File(h5_test, "w") as fp:
|
47 |
+
# external linked file
|
48 |
+
for h5_file in test_files:
|
49 |
+
with h5py.File(os.path.join(h5_dir, h5_file), "r") as f:
|
50 |
+
for event in tqdm(f.keys(), desc=h5_file, total=len(f.keys())):
|
51 |
+
if event not in fp:
|
52 |
+
fp[event] = h5py.ExternalLink(os.path.join(h5_dir, h5_file), event)
|
53 |
+
else:
|
54 |
+
print(f"{event} already exists")
|
55 |
+
continue
|
56 |
+
|
upload.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import HfApi
|
2 |
+
|
3 |
+
api = HfApi()
|
4 |
+
|
5 |
+
# Upload all the content from the local folder to your remote Space.
|
6 |
+
# By default, files are uploaded at the root of the repo
|
7 |
+
api.upload_folder(
|
8 |
+
folder_path="./",
|
9 |
+
repo_id="AI4EPS/quakeflow_nc",
|
10 |
+
repo_type="space",
|
11 |
+
)
|
waveform.h5
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c8aceba0ca300b9538cc80d0c458b339321e1a282f78a848ad7ceb18d89ba57a
|
3 |
+
size 21532195
|
waveform_test.h5
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2a82025d34cd04c30d190ad0a9b9a70001871c20df30c16f51edc0f7e5e0af5c
|
3 |
+
size 839809
|
waveform_train.h5
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:01e595178d29d519fb37dfde14d759173523e834fbdd15ae0e05135d6256983f
|
3 |
+
size 20711586
|