Skip to content

Commit 871cf52

Browse files
committed
update download waveform
1 parent e18aed3 commit 871cf52

File tree

7 files changed

+488
-5
lines changed

7 files changed

+488
-5
lines changed

scripts/args.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@
33

44
def parse_args():
55
parser = argparse.ArgumentParser()
6-
parser.add_argument("root_path", nargs="?", type=str, default="local", help="root path")
7-
parser.add_argument("region", nargs="?", type=str, default="demo", help="region")
6+
parser.add_argument("--region", type=str, default="demo", help="region")
7+
parser.add_argument("--root_path", type=str, default="local", help="root path")
8+
9+
## Cloud
10+
parser.add_argument("--protocol", type=str, default="file", help="protocol (file, gs, s3)")
11+
parser.add_argument("--bucket", type=str, default=None, help="bucket name")
12+
parser.add_argument("--token", type=str, default=None, help="token")
13+
14+
# parser.add_argument("--bucket", type=str, default="quakeflow_catalog", help="bucket name")
15+
# parser.add_argument("--protocol", type=str, default="gs", help="protocol (file, gs, s3)")
16+
# parser.add_argument("--token", type=str, default="application_default_credentials.json", help="token")
17+
18+
## Parallel
19+
parser.add_argument("--num_nodes", type=int, default=1, help="number of nodes")
20+
parser.add_argument("--node_rank", type=int, default=0, help="node rank")
821

922
## CCTorch
1023
parser.add_argument("--dtct_pair", action="store_true", help="run convert_dtcc.py")

scripts/download_catalog.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,12 @@ def visulization(config, events=None, stations=None, fig_name="catalog.png"):
181181
args = parse_args()
182182
root_path = args.root_path
183183
region = args.region
184+
protocol = args.protocol
185+
bucket = args.bucket
186+
token = args.token
187+
184188

185189
with open(f"{root_path}/{region}/config.json", "r") as fp:
186190
config = json.load(fp)
187191

188-
download_catalog(root_path, region=region, config=config, protocol="file", bucket="", token=None)
192+
download_catalog(root_path, region=region, config=config, protocol=protocol, bucket=bucket, token=token)

scripts/download_station.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,13 @@ def visulization(config, events=None, stations=None, fig_name="catalog.png"):
329329
args = parse_args()
330330
root_path = args.root_path
331331
region = args.region
332+
protocol = args.protocol
333+
bucket = args.bucket
334+
token = args.token
332335

333336
with open(f"{root_path}/{region}/config.json", "r") as fp:
334337
config = json.load(fp)
335338

336339
config.update(config["obspy"])
337340

338-
download_station(root_path=root_path, region=region, config=config, protocol="file", bucket="", token=None)
341+
download_station(root_path=root_path, region=region, config=config, protocol=protocol, bucket=bucket, token=token)

scripts/download_waveform_v2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ def download_waveform(
318318
args = parse_args()
319319
root_path = args.root_path
320320
region = args.region
321+
protocol = args.protocol
322+
bucket = args.bucket
323+
token = args.token
321324

322325
with open(f"{root_path}/{region}/config.json", "r") as fp:
323326
config = json.load(fp)

0 commit comments

Comments
 (0)