CLI+MPI Tutorial

CLI+MPI Tutorial#

import os
from datetime import datetime
from datetimerange import DateTimeRange
import pandas as pd

from noisepy.seis.io.asdfstore import ASDFCCStore        # Object to store ASDF data within noisepy
from noisepy.seis.io.datatypes import FreqNorm           # Main configuration object

# create directory to store data locally
path = "~/s3tmp/data"
# path = "../../data/" # for local runs
os.makedirs(path, exist_ok=True)
cc_data_path = os.path.join(path, "CCF")
stack_data_path = os.path.join(path, "STACK")
os.makedirs(cc_data_path, exist_ok=True)
os.makedirs(stack_data_path, exist_ok=True)
freq_norm = FreqNorm.RMA
cc_store = ASDFCCStore(cc_data_path) # Store for writing CC data

DATE_FORMAT = "%Y_%m_%d"
NPROC = 3

Read the station information

sta=",".join(list(pd.read_csv("example_data/full_socal.csv")["station"]))
print(sta)
start = datetime(2002, 1, 2)
end = datetime(2002, 1, 4)
timerange = DateTimeRange(start, end)
print(timerange)

date_start=start.strftime(DATE_FORMAT)
date_end=end.strftime(DATE_FORMAT)
print(date_start)
print((f'mpiexec -n {NPROC} noisepy cross_correlate \
--raw_data_path s3://scedc-pds/continuous_waveforms/ \
--xml_path s3://scedc-pds/FDSNstationXML/CI/ \
--ccf_path {cc_data_path} --freq_norm {freq_norm} --stations "SBC,RIO,DEV" \
--channels "BHE,BHN,BHZ" --start {date_start} --end {date_end}'))
os.system(f'mpiexec -n {NPROC} noisepy cross_correlate \
--raw_data_path s3://scedc-pds/continuous_waveforms/ \
--xml_path s3://scedc-pds/FDSNstationXML/CI/ \
--ccf_path {cc_data_path} --freq_norm {freq_norm} --stations "SBC,RIO,DEV" \
--channels "BHE,BHN,BHZ"  --start {date_start} --end {date_end}')