Datasets:
ArXiv:
DOI:
License:
add station_id event_id
Browse files- example.py +3 -3
- quakeflow_nc.py +11 -7
example.py
CHANGED
|
@@ -9,7 +9,7 @@ quakeflow_nc = datasets.load_dataset(
|
|
| 9 |
split="train",
|
| 10 |
# name="station_test",
|
| 11 |
# split="test",
|
| 12 |
-
download_mode="force_redownload",
|
| 13 |
trust_remote_code=True,
|
| 14 |
num_proc=36,
|
| 15 |
)
|
|
@@ -30,7 +30,7 @@ for example in quakeflow_nc:
|
|
| 30 |
print(example)
|
| 31 |
print(example.keys())
|
| 32 |
for key in example.keys():
|
| 33 |
-
if key == "
|
| 34 |
print(key, np.array(example[key]).shape)
|
| 35 |
else:
|
| 36 |
print(key, example[key])
|
|
@@ -45,7 +45,7 @@ for batch in dataloader:
|
|
| 45 |
print(f"Batch size: {len(batch)}")
|
| 46 |
print(batch[0].keys())
|
| 47 |
for key in batch[0].keys():
|
| 48 |
-
if key == "
|
| 49 |
print(key, np.array(batch[0][key]).shape)
|
| 50 |
else:
|
| 51 |
print(key, batch[0][key])
|
|
|
|
| 9 |
split="train",
|
| 10 |
# name="station_test",
|
| 11 |
# split="test",
|
| 12 |
+
# download_mode="force_redownload",
|
| 13 |
trust_remote_code=True,
|
| 14 |
num_proc=36,
|
| 15 |
)
|
|
|
|
| 30 |
print(example)
|
| 31 |
print(example.keys())
|
| 32 |
for key in example.keys():
|
| 33 |
+
if key == "waveform":
|
| 34 |
print(key, np.array(example[key]).shape)
|
| 35 |
else:
|
| 36 |
print(key, example[key])
|
|
|
|
| 45 |
print(f"Batch size: {len(batch)}")
|
| 46 |
print(batch[0].keys())
|
| 47 |
for key in batch[0].keys():
|
| 48 |
+
if key == "waveform":
|
| 49 |
print(key, np.array(batch[0][key]).shape)
|
| 50 |
else:
|
| 51 |
print(key, batch[0][key])
|
quakeflow_nc.py
CHANGED
|
@@ -290,16 +290,19 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
|
|
| 290 |
):
|
| 291 |
waveform = np.zeros([3, self.nt], dtype="float32")
|
| 292 |
|
| 293 |
-
for i,
|
| 294 |
-
waveform[:, : self.nt] = event[
|
| 295 |
-
attrs = event[
|
| 296 |
phase_type = attrs["phase_type"]
|
| 297 |
phase_time = attrs["phase_time"]
|
| 298 |
phase_index = attrs["phase_index"]
|
| 299 |
phase_polarity = attrs["phase_polarity"]
|
| 300 |
station_location = [attrs["longitude"], attrs["latitude"], -attrs["elevation_m"] / 1e3]
|
| 301 |
|
| 302 |
-
yield f"{event_id}/{
|
|
|
|
|
|
|
|
|
|
| 303 |
"waveform": waveform,
|
| 304 |
"phase_time": phase_time,
|
| 305 |
"phase_index": phase_index,
|
|
@@ -326,9 +329,9 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
|
|
| 326 |
phase_polarity = []
|
| 327 |
station_location = []
|
| 328 |
|
| 329 |
-
for i,
|
| 330 |
-
waveform[i, :, : self.nt] = event[
|
| 331 |
-
attrs = event[
|
| 332 |
phase_type.append(list(attrs["phase_type"]))
|
| 333 |
phase_time.append(list(attrs["phase_time"]))
|
| 334 |
phase_index.append(list(attrs["phase_index"]))
|
|
@@ -337,6 +340,7 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
|
|
| 337 |
[attrs["longitude"], attrs["latitude"], -attrs["elevation_m"] / 1e3]
|
| 338 |
)
|
| 339 |
yield event_id, {
|
|
|
|
| 340 |
"waveform": waveform,
|
| 341 |
"phase_time": phase_time,
|
| 342 |
"phase_index": phase_index,
|
|
|
|
| 290 |
):
|
| 291 |
waveform = np.zeros([3, self.nt], dtype="float32")
|
| 292 |
|
| 293 |
+
for i, station_id in enumerate(station_ids):
|
| 294 |
+
waveform[:, : self.nt] = event[station_id][:, : self.nt]
|
| 295 |
+
attrs = event[station_id].attrs
|
| 296 |
phase_type = attrs["phase_type"]
|
| 297 |
phase_time = attrs["phase_time"]
|
| 298 |
phase_index = attrs["phase_index"]
|
| 299 |
phase_polarity = attrs["phase_polarity"]
|
| 300 |
station_location = [attrs["longitude"], attrs["latitude"], -attrs["elevation_m"] / 1e3]
|
| 301 |
|
| 302 |
+
yield f"{event_id}/{station_id}", {
|
| 303 |
+
"id": f"{event_id}/{station_id}",
|
| 304 |
+
"event_id": event_id,
|
| 305 |
+
"station_id": station_id,
|
| 306 |
"waveform": waveform,
|
| 307 |
"phase_time": phase_time,
|
| 308 |
"phase_index": phase_index,
|
|
|
|
| 329 |
phase_polarity = []
|
| 330 |
station_location = []
|
| 331 |
|
| 332 |
+
for i, station_id in enumerate(station_ids):
|
| 333 |
+
waveform[i, :, : self.nt] = event[station_id][:, : self.nt]
|
| 334 |
+
attrs = event[station_id].attrs
|
| 335 |
phase_type.append(list(attrs["phase_type"]))
|
| 336 |
phase_time.append(list(attrs["phase_time"]))
|
| 337 |
phase_index.append(list(attrs["phase_index"]))
|
|
|
|
| 340 |
[attrs["longitude"], attrs["latitude"], -attrs["elevation_m"] / 1e3]
|
| 341 |
)
|
| 342 |
yield event_id, {
|
| 343 |
+
"event_id": event_id,
|
| 344 |
"waveform": waveform,
|
| 345 |
"phase_time": phase_time,
|
| 346 |
"phase_index": phase_index,
|