From 77638bacb55ba62218c3d0b441ab3abd3bea2f37 Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 14:58:36 -0800 Subject: [PATCH 01/17] Improve logging level Signed-off-by: Yiyu Ni --- src/noisepy/seis/__init__.py | 2 +- src/noisepy/seis/correlate.py | 12 ++++++------ src/noisepy/seis/fdsn_download.py | 4 ++-- src/noisepy/seis/noise_module.py | 6 +++--- src/noisepy/seis/stack.py | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/noisepy/seis/__init__.py b/src/noisepy/seis/__init__.py index c2d572e2..5383e159 100644 --- a/src/noisepy/seis/__init__.py +++ b/src/noisepy/seis/__init__.py @@ -27,6 +27,6 @@ """ logging.basicConfig( - level=logging.INFO, format="%(asctime)s %(thread)d %(levelname)s %(module)s.%(funcName)s(): %(message)s" + level=logging.INFO, format="%(asctime)s | %(levelname)s | %(module)s.%(funcName)s() | %(message)s" ) logger = logging.getLogger(__name__) diff --git a/src/noisepy/seis/correlate.py b/src/noisepy/seis/correlate.py index dc099451..8b15ca12 100644 --- a/src/noisepy/seis/correlate.py +++ b/src/noisepy/seis/correlate.py @@ -84,9 +84,9 @@ def filter_by_lat(s: Channel, d: Channel) -> bool: # Force config validation fft_params = ConfigParameters.model_validate(dict(fft_params), strict=True) - tlog = TimeLogger(logger, logging.INFO, prefix="CC Main") + tlog = TimeLogger(logger, logging.DEBUG, prefix="CC Main") t_s1_total = tlog.reset() - logger.info(f"Starting Cross-Correlation with {os.cpu_count()} cores") + logger.info(f"Starting cross-correlation with {os.cpu_count()} cores") def init() -> List: # set variables to broadcast @@ -120,7 +120,7 @@ def cc_timespan( pair_filter: Callable[[Channel, Channel], bool] = lambda src, rec: True, ) -> List[Tuple[Station, Station]]: executor = ThreadPoolExecutor() - tlog = TimeLogger(logger, logging.INFO, prefix="CC Main") + tlog = TimeLogger(logger, logging.DEBUG, prefix="CC Main") """ LOADING NOISE DATA AND DO FFT """ @@ -503,9 +503,9 @@ def _filter_channel_data( return [] if single_freq: closest_freq = _get_closest_freq(frequencies, sampling_rate) - logger.info(f"Picked {closest_freq} as the closest sampling_rate to {sampling_rate}. ") + logger.debug(f"Picked {closest_freq} as the closest sampling_rate to {sampling_rate}. ") filtered_tuples = list(filter(lambda tup: tup[1].sampling_rate == closest_freq, tuples)) - logger.info(f"Filtered to {len(filtered_tuples)}/{len(tuples)} channels with sampling rate == {closest_freq}") + logger.debug(f"Filtered to {len(filtered_tuples)}/{len(tuples)} channels with sampling rate == {closest_freq}") else: filtered_tuples = list(filter(lambda tup: tup[1].sampling_rate >= sampling_rate, tuples)) # for each station, pick the closest >= to sampling_rate @@ -545,5 +545,5 @@ def check_memory(params: ConfigParameters, nsta: int) -> int: "Require %5.3fG memory but only %5.3fG provided)! Reduce inc_hours to avoid this issue!" % (memory_size, MAX_MEM) ) - logger.info(f"Require {memory_size:5.2f}gb memory for cross correlations") + logger.info(f"Require {memory_size:5.2f}GB memory for correlations") return nseg_chunk diff --git a/src/noisepy/seis/fdsn_download.py b/src/noisepy/seis/fdsn_download.py index fb0e7152..8d55b7e3 100644 --- a/src/noisepy/seis/fdsn_download.py +++ b/src/noisepy/seis/fdsn_download.py @@ -82,7 +82,7 @@ def download(direc: str, prepro_para: ConfigParameters) -> None: client = Client(prepro_para.client_url_key) executor = ThreadPoolExecutor() - tlog = TimeLogger(logger, logging.INFO) + tlog = TimeLogger(logger, logging.DEBUG) t_tot = tlog.reset() dlist = os.path.join(direc, "station.csv") # CSV file for station location info prepro_para.respdir = os.path.join( @@ -161,7 +161,7 @@ def download(direc: str, prepro_para: ConfigParameters) -> None: tlog.log("Getting inventory") # rough estimation on memory needs (assume float32 dtype) nsec_chunk = prepro_para.inc_hours / 24 * 86400 - nseg_chunk = int(np.floor((nsec_chunk - prepro_para.cc_len) / prepro_para.step)) + 1 + nseg_chunk = int(np.floor((nsec_chunk - prepro_para.cc_len) / prepro_para.step)) npts_chunk = int(nseg_chunk * prepro_para.cc_len * prepro_para.sampling_rate) memory_size = nsta * npts_chunk * 4 / 1024**3 if memory_size > MAX_MEM: diff --git a/src/noisepy/seis/noise_module.py b/src/noisepy/seis/noise_module.py index 5876b6e3..c7057517 100644 --- a/src/noisepy/seis/noise_module.py +++ b/src/noisepy/seis/noise_module.py @@ -179,7 +179,7 @@ def preprocess_raw( raise ValueError("The response found in the inventory is empty (no stages)! abort! %s" % st[0]) else: try: - logger.info("removing response for %s using inv" % st[0]) + logger.debug("removing response for %s using inv" % st[0]) st[0].attach_response(inv) st[0].remove_response(output=rm_resp_out, pre_filt=pre_filt, water_level=60) except Exception as e: @@ -188,14 +188,14 @@ def preprocess_raw( return st elif rm_resp == RmResp.SPECTRUM: # TODO: to be implement - logger.info("remove response using spectrum") + logger.debug("remove response using spectrum") specfile = glob.glob(os.path.join(respdir, "*" + station + "*")) if len(specfile) == 0: raise ValueError("no response sepctrum found for %s" % station) st = resp_spectrum(st, specfile[0], sampling_rate, pre_filt) elif rm_resp == RmResp.RESP: # TODO: to be implement - logger.info("remove response using RESP files") + logger.debug("remove response using RESP files") resp = glob.glob(os.path.join(respdir, "RESP." + station + "*")) if len(resp) == 0: raise ValueError("no RESP files found for %s" % station) diff --git a/src/noisepy/seis/stack.py b/src/noisepy/seis/stack.py index 6d2646e5..dedff732 100644 --- a/src/noisepy/seis/stack.py +++ b/src/noisepy/seis/stack.py @@ -52,7 +52,7 @@ def stack_cross_correlations( # Use 'spawn' to avoid issues with multiprocessing on linux and 'fork' executor = ProcessPoolExecutor(mp_context=get_context("spawn")) - tlog = TimeLogger(logger=logger, level=logging.INFO) + tlog = TimeLogger(logger=logger, level=logging.DEBUG) t_tot = tlog.reset() stations = set(fft_params.stations) @@ -116,7 +116,7 @@ def stack_store_pair( if len(stacks) == 0: logger.warning(f"No stacks for {src_sta}_{rec_sta}") return False - tlog = TimeLogger(logger=logger, level=logging.INFO) + tlog = TimeLogger(logger=logger, level=logging.DEBUG) stack_store.append(ts, src_sta, rec_sta, stacks) tlog.log(f"writing stack pair {(src_sta, rec_sta)}") return True @@ -132,7 +132,7 @@ def stack_pair( cc_store: CrossCorrelationDataStore, fft_params: ConfigParameters, ) -> List[Stack]: - tlog = TimeLogger(logger=logger, level=logging.INFO) + tlog = TimeLogger(logger=logger, level=logging.DEBUG) # check if it is auto-correlation if src_sta == rec_sta: fauto = 1 @@ -169,7 +169,7 @@ def stack_pair( iseg = 0 for ts in timespans: if ts.end_datetime > fft_params.end_date or ts.start_datetime < fft_params.start_date: - logger.warning( + logger.debug( f"Skipping {ts} for {src_sta}-{rec_sta} because it is outside the requested time range " f"({fft_params.start_date} - {fft_params.end_date})" ) From 0406bef78eac00a181e4d0a6854d23ac4213b1b5 Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 16:36:42 -0800 Subject: [PATCH 02/17] Update logging level Signed-off-by: Yiyu Ni --- src/noisepy/seis/correlate.py | 25 ++++++++++++------------- src/noisepy/seis/fdsn_download.py | 4 ++-- src/noisepy/seis/stack.py | 10 +++++----- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/noisepy/seis/correlate.py b/src/noisepy/seis/correlate.py index 8b15ca12..3cf9bbde 100644 --- a/src/noisepy/seis/correlate.py +++ b/src/noisepy/seis/correlate.py @@ -84,7 +84,7 @@ def filter_by_lat(s: Channel, d: Channel) -> bool: # Force config validation fft_params = ConfigParameters.model_validate(dict(fft_params), strict=True) - tlog = TimeLogger(logger, logging.DEBUG, prefix="CC Main") + tlog = TimeLogger(logger=logger, level=logging.DEBUG, prefix="CC MAIN") t_s1_total = tlog.reset() logger.info(f"Starting cross-correlation with {os.cpu_count()} cores") @@ -120,7 +120,7 @@ def cc_timespan( pair_filter: Callable[[Channel, Channel], bool] = lambda src, rec: True, ) -> List[Tuple[Station, Station]]: executor = ThreadPoolExecutor() - tlog = TimeLogger(logger, logging.DEBUG, prefix="CC Main") + tlog = TimeLogger(logger=logger, level=logging.DEBUG, prefix="CC MAIN") """ LOADING NOISE DATA AND DO FFT """ @@ -129,7 +129,7 @@ def cc_timespan( t_chunk = tlog.reset() # for tracking overall chunk processing time all_channels = raw_store.get_channels(ts) all_channel_count = len(all_channels) - tlog.log(f"get {all_channel_count} channels") + tlog.log(f"getting {all_channel_count} channels") all_channels = list(filter(lambda c: c.station.valid(), all_channels)) all_stations = set([c.station for c in all_channels]) if all_channel_count > len(all_channels): @@ -144,7 +144,6 @@ def cc_timespan( stations = set([station for pair in station_pairs for station in pair]) _ = list(executor.map(lambda s: cc_store.contains(s, s, ts), stations)) - tlog.log(f"check for {len(stations)} stations already done (warm up cache)") station_pair_dones = list(executor.map(lambda p: cc_store.contains(p[0], p[1], ts), station_pairs)) missing_pairs = [pair for pair, done in zip(station_pairs, station_pair_dones) if not done] @@ -152,7 +151,7 @@ def cc_timespan( missing_stations = set([station for pair in missing_pairs for station in pair]) # Filter the channels to only the missing stations missing_channels = list(filter(lambda c: c.station in missing_stations, all_channels)) - tlog.log("check for stations already done") + tlog.log("checking for stations already done") logger.info( f"Still need to process: {len(missing_stations)}/{len(all_stations)} stations, " @@ -173,10 +172,10 @@ def cc_timespan( logger.warning(f"No data available for {ts}") return missing_pairs - tlog.log(f"Read channel data: {len(ch_data_tuples)} channels") + tlog.log(f"reading {len(ch_data_tuples)} channels") ch_data_tuples_pre = preprocess_all(executor, ch_data_tuples, raw_store, fft_params, ts) del ch_data_tuples - tlog.log(f"Preprocess: {len(ch_data_tuples_pre)} channels") + tlog.log(f"preprocessing {len(ch_data_tuples_pre)} channels") if len(ch_data_tuples_pre) == 0: logger.warning(f"No data available for {ts} after preprocessing") return missing_pairs @@ -198,7 +197,7 @@ def cc_timespan( ch_data_tuples_pre.clear() del ch_data_tuples_pre gc.collect() - fft_datas = get_results(fft_refs, "Compute ffts") + fft_datas = get_results(fft_refs, "Computing ffts") for ix_ch, fft_data in enumerate(fft_datas): if fft_data.fft.size > 0: ffts[ix_ch] = fft_data @@ -237,10 +236,10 @@ def cc_timespan( save_exec, ) tasks.append(t) - compute_results = get_results(tasks, "Cross correlation") + compute_results = get_results(tasks, "Cross-correlating") _, save_tasks = zip(*compute_results) save_tasks = [t for t in save_tasks if t] - _ = get_results(save_tasks, "Save correlations") + _ = get_results(save_tasks, "Saving correlations") failed_pairs = [ pair[0] for pair, (comp_res, save_task) in zip(work_items, compute_results) @@ -298,7 +297,7 @@ def stations_cross_correlation( cc_store: CrossCorrelationDataStore, executor: Executor, ) -> Tuple[bool, Future]: - tlog = TimeLogger(logger, logging.DEBUG) + tlog = TimeLogger(logger=logger, level=logging.DEBUG, prefix="CC STATION") datas = [] try: if cc_store.contains(src, rec, ts): @@ -378,7 +377,7 @@ def preprocess_all( channels = list(zip(*ch_data))[0] stream_refs = [executor.submit(preprocess, raw_store, t[0], t[1], fft_params, ts) for t in ch_data] del ch_data - new_streams = get_results(stream_refs, "Pre-process") + new_streams = get_results(stream_refs, "Pre-processing") # Log if any streams were removed during pre-processing for ch, st in zip(channels, new_streams): if len(st) == 0: @@ -479,7 +478,7 @@ def _read_channels( single_freq: bool = True, ) -> List[Tuple[Channel, ChannelData]]: ch_data_refs = [executor.submit(_safe_read_data, store, ts, ch) for ch in channels] - ch_data = get_results(ch_data_refs, "Read channel data") + ch_data = get_results(ch_data_refs, "Reading channel data") tuples = list(filter(lambda tup: tup[1].data.size > 0, zip(channels, ch_data))) return _filter_channel_data(tuples, sampling_rate, single_freq) diff --git a/src/noisepy/seis/fdsn_download.py b/src/noisepy/seis/fdsn_download.py index 4c772cdc..ea280f55 100644 --- a/src/noisepy/seis/fdsn_download.py +++ b/src/noisepy/seis/fdsn_download.py @@ -82,7 +82,7 @@ def download(direc: str, prepro_para: ConfigParameters) -> None: client = Client(prepro_para.client_url_key) executor = ThreadPoolExecutor() - tlog = TimeLogger(logger, logging.DEBUG) + tlog = TimeLogger(logger=logger, level=logging.DEBUG, prefix="Download") t_tot = tlog.reset() dlist = os.path.join(direc, "station.csv") # CSV file for station location info prepro_para.respdir = os.path.join( @@ -158,7 +158,7 @@ def download(direc: str, prepro_para: ConfigParameters) -> None: else: location.append("*") nsta += 1 - tlog.log("Getting inventory") + tlog.log("getting inventory") # rough estimation on memory needs (assume float32 dtype) nsec_chunk = prepro_para.inc_hours / 24 * 86400 nseg_chunk = int(np.floor((nsec_chunk - prepro_para.cc_len) / prepro_para.step)) diff --git a/src/noisepy/seis/stack.py b/src/noisepy/seis/stack.py index 333222d0..dd5d124b 100644 --- a/src/noisepy/seis/stack.py +++ b/src/noisepy/seis/stack.py @@ -52,7 +52,7 @@ def stack_cross_correlations( # Use 'spawn' to avoid issues with multiprocessing on linux and 'fork' executor = ProcessPoolExecutor(mp_context=get_context("spawn")) - tlog = TimeLogger(logger=logger, level=logging.DEBUG) + tlog = TimeLogger(logger=logger, level=logging.DEBUG, prefix="STACK MAIN") t_tot = tlog.reset() stations = set(fft_params.stations) @@ -88,7 +88,7 @@ def initializer(): results = get_results(tasks, "Stacking Pairs") executor.shutdown() scheduler.synchronize() - tlog.log("step 2 in total", t_tot) + tlog.log("Step 2 in total", t_tot) if not all(results): failed = [p for p, r in zip(pairs_node, results) if not r] failed_str = "\n".join(map(str, failed)) @@ -116,7 +116,7 @@ def stack_store_pair( if len(stacks) == 0: logger.warning(f"No stacks for {src_sta}_{rec_sta}") return False - tlog = TimeLogger(logger=logger, level=logging.DEBUG) + tlog = TimeLogger(logger=logger, level=logging.DEBUG, prefix="STACK PAIR") stack_store.append(ts, src_sta, rec_sta, stacks) tlog.log(f"writing stack pair {(src_sta, rec_sta)}") return True @@ -132,7 +132,7 @@ def stack_pair( cc_store: CrossCorrelationDataStore, fft_params: ConfigParameters, ) -> List[Stack]: - tlog = TimeLogger(logger=logger, level=logging.DEBUG) + tlog = TimeLogger(logger=logger, level=logging.DEBUG, prefix="STACK PAIR") # check if it is auto-correlation if src_sta == rec_sta: fauto = 1 @@ -307,7 +307,7 @@ def append_stacks(comp: str, tparameters: Dict[str, Any], stack_data: List[Tuple (StackMethod.ROBUST, bigstack_rotated2[icomp]), ] append_stacks(comp, tparameters, stacks) - tlog.log(f"stack/rotate all station pairs {(src_sta,rec_sta)}", t_load) + tlog.log(f"stacking/rotating all station pairs {(src_sta,rec_sta)}", t_load) return stack_results From 8337ac3a07c1ca255e6aaeaa1d0e1e48eb43138e Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 17:07:03 -0800 Subject: [PATCH 03/17] update mpi4py version Signed-off-by: Yiyu Ni --- .github/workflows/test.yaml | 4 ++-- pyproject.toml | 4 ++-- src/noisepy/seis/__init__.py | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 479da204..3769ec54 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -34,8 +34,8 @@ jobs: uses: ./.github/actions/setup with: python-version: ${{env.python_version}} - mpi : 'true' - - name: pytest + mpi: 'true' + - name: Run pytest run: | set PYTHONPATH=src pytest tests/. integration_tests/. diff --git a/pyproject.toml b/pyproject.toml index 8211da54..fc4b9ab9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ dependencies = [ "PyYAML==6.0", "pydantic-yaml==1.0", "psutil>=5.9.5,<6.0.0", - "noisepy-seis-io>=0.3.0", + "noisepy-seis-io>=0.3.4", "scipy==1.12.0" ] @@ -86,7 +86,7 @@ sql = [ "SQLite3-0611", ] mpi = [ - "mpi4py>=3.1.4,<4.0.0", + "mpi4py", ] aws = [ "boto3>=1.26.0,<2.0.0", diff --git a/src/noisepy/seis/__init__.py b/src/noisepy/seis/__init__.py index 6a495729..0c27396d 100644 --- a/src/noisepy/seis/__init__.py +++ b/src/noisepy/seis/__init__.py @@ -26,7 +26,5 @@ - noise_module: Collection of functions used in the cross_correlate and stacking steps """ -logging.basicConfig( - level=logging.INFO, format="%(asctime)s | %(levelname)s | %(module)s.%(funcName)s() | %(message)s" -) +logging.basicConfig(level=logging.INFO, format="%(asctime)s | %(levelname)s | %(module)s.%(funcName)s() | %(message)s") logger = logging.getLogger(__name__) From ef76a1daf01e6d453106dcb535922a42b339df46 Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 17:20:07 -0800 Subject: [PATCH 04/17] Limit setuptools version Signed-off-by: Yiyu Ni --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fc4b9ab9..bfaf650b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,7 +51,8 @@ dependencies = [ "pydantic-yaml==1.0", "psutil>=5.9.5,<6.0.0", "noisepy-seis-io>=0.3.4", - "scipy==1.12.0" + "scipy==1.12.0", + "setuptools<81.0.0" ] @@ -86,7 +87,7 @@ sql = [ "SQLite3-0611", ] mpi = [ - "mpi4py", + "mpi4py>=3.1.4,<4.0.0", ] aws = [ "boto3>=1.26.0,<2.0.0", From 09c497418608bed97d08ef28c29a19aec0d9afe0 Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 18:13:08 -0800 Subject: [PATCH 05/17] Update mpi4py Signed-off-by: Yiyu Ni --- .github/actions/setup/action.yaml | 2 +- pyproject.toml | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 8f5ae756..c7ad75ec 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -22,7 +22,7 @@ runs: python3 -m pip install --upgrade pip - name: Setup MPI if: ${{ inputs.mpi == 'true' }} - uses: mpi4py/setup-mpi@v1 + uses: mpi4py/setup-mpi@v1.4.2 - name: Install project no MPI if: ${{ inputs.mpi == 'false' }} shell: sh diff --git a/pyproject.toml b/pyproject.toml index bfaf650b..fc4b9ab9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,8 +51,7 @@ dependencies = [ "pydantic-yaml==1.0", "psutil>=5.9.5,<6.0.0", "noisepy-seis-io>=0.3.4", - "scipy==1.12.0", - "setuptools<81.0.0" + "scipy==1.12.0" ] @@ -87,7 +86,7 @@ sql = [ "SQLite3-0611", ] mpi = [ - "mpi4py>=3.1.4,<4.0.0", + "mpi4py", ] aws = [ "boto3>=1.26.0,<2.0.0", From 07d0f7862b513372e55a79685a3b329494451083 Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 18:19:52 -0800 Subject: [PATCH 06/17] Add mpi Signed-off-by: Yiyu Ni --- .github/actions/setup/action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index c7ad75ec..5e9f97c9 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -23,6 +23,8 @@ runs: - name: Setup MPI if: ${{ inputs.mpi == 'true' }} uses: mpi4py/setup-mpi@v1.4.2 + with: + mpi: openmpi - name: Install project no MPI if: ${{ inputs.mpi == 'false' }} shell: sh From c466ef92a68c28dc3210a5c1cf10a8202c8b41ff Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 18:26:15 -0800 Subject: [PATCH 07/17] Update mpi Signed-off-by: Yiyu Ni --- .github/actions/setup/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 5e9f97c9..8a9cab74 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -22,7 +22,7 @@ runs: python3 -m pip install --upgrade pip - name: Setup MPI if: ${{ inputs.mpi == 'true' }} - uses: mpi4py/setup-mpi@v1.4.2 + uses: mpi4py/setup-mpi@v1 with: mpi: openmpi - name: Install project no MPI From bc950f2e340772a4195fe9c636cc9ed817d7616c Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 18:28:02 -0800 Subject: [PATCH 08/17] Update Mpi Signed-off-by: Yiyu Ni --- .github/actions/setup/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 8a9cab74..ba0b50e8 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -24,7 +24,7 @@ runs: if: ${{ inputs.mpi == 'true' }} uses: mpi4py/setup-mpi@v1 with: - mpi: openmpi + mpi: "openmpi" - name: Install project no MPI if: ${{ inputs.mpi == 'false' }} shell: sh From 01085b6d66dd4f870b736326fd4d9cf42f45c44f Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 18:32:27 -0800 Subject: [PATCH 09/17] Remove mpi implementation Signed-off-by: Yiyu Ni --- .github/actions/setup/action.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index ba0b50e8..8f5ae756 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -23,8 +23,6 @@ runs: - name: Setup MPI if: ${{ inputs.mpi == 'true' }} uses: mpi4py/setup-mpi@v1 - with: - mpi: "openmpi" - name: Install project no MPI if: ${{ inputs.mpi == 'false' }} shell: sh From 89115262e74f986a4554d7d04a4960d609d7418f Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 18:46:14 -0800 Subject: [PATCH 10/17] Update Signed-off-by: Yiyu Ni --- .github/workflows/test.yaml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3769ec54..4acbd2b4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,7 +19,7 @@ jobs: with: python-version: ${{env.python_version}} mpi: 'true' - - name: pytest + - name: Run pytest run: pytest tests/. integration_tests/. --cov=noisepy.seis --cov=noisepy.monitoring - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 diff --git a/pyproject.toml b/pyproject.toml index fc4b9ab9..76e76ee2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,7 +86,7 @@ sql = [ "SQLite3-0611", ] mpi = [ - "mpi4py", + "mpi4py>=3.1.4,<4.0.0", ] aws = [ "boto3>=1.26.0,<2.0.0", From 0ee251f36cc76f74e092b8e5702d7e92ca9dc1bb Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 18:56:57 -0800 Subject: [PATCH 11/17] Update --- .github/actions/setup/action.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 8f5ae756..e93b8069 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -30,4 +30,6 @@ runs: - name: Install project MPI if: ${{ inputs.mpi == 'true' }} shell: sh - run: pip install ".[dev,mpi,aws]" + run: | + pip list | grep setuptools + pip install ".[dev,mpi,aws]" From 6dbe51396a640e8c91d7180e6ed278691346b861 Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 19:13:52 -0800 Subject: [PATCH 12/17] Revert --- .github/actions/setup/action.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index e93b8069..8f5ae756 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -30,6 +30,4 @@ runs: - name: Install project MPI if: ${{ inputs.mpi == 'true' }} shell: sh - run: | - pip list | grep setuptools - pip install ".[dev,mpi,aws]" + run: pip install ".[dev,mpi,aws]" From f16059a1421a6a40a89101780917270fb9459f64 Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 19:20:44 -0800 Subject: [PATCH 13/17] Update --- .github/actions/setup/action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 8f5ae756..8a9cab74 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -23,6 +23,8 @@ runs: - name: Setup MPI if: ${{ inputs.mpi == 'true' }} uses: mpi4py/setup-mpi@v1 + with: + mpi: openmpi - name: Install project no MPI if: ${{ inputs.mpi == 'false' }} shell: sh From 3f9201d7899d31a74e7e694fd37e1ea6f833aa4f Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Wed, 25 Feb 2026 19:23:19 -0800 Subject: [PATCH 14/17] Update mpi4py version to >4 --- .github/workflows/test.yaml | 14 -------------- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4acbd2b4..c6fb75ce 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -25,20 +25,6 @@ jobs: uses: codecov/codecov-action@v3 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - unit_tests_win: - runs-on: windows-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - name: Setup NoisePy - uses: ./.github/actions/setup - with: - python-version: ${{env.python_version}} - mpi: 'true' - - name: Run pytest - run: | - set PYTHONPATH=src - pytest tests/. integration_tests/. s1_s2: strategy: fail-fast: true diff --git a/pyproject.toml b/pyproject.toml index 76e76ee2..fc4b9ab9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,7 +86,7 @@ sql = [ "SQLite3-0611", ] mpi = [ - "mpi4py>=3.1.4,<4.0.0", + "mpi4py", ] aws = [ "boto3>=1.26.0,<2.0.0", From a654311e589328525784a8c2ac3a1e293bafad0b Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Fri, 1 May 2026 14:26:04 -0700 Subject: [PATCH 15/17] Retry win test Signed-off-by: Yiyu Ni --- .github/actions/setup/action.yaml | 2 -- .github/workflows/test.yaml | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 8a9cab74..8f5ae756 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -23,8 +23,6 @@ runs: - name: Setup MPI if: ${{ inputs.mpi == 'true' }} uses: mpi4py/setup-mpi@v1 - with: - mpi: openmpi - name: Install project no MPI if: ${{ inputs.mpi == 'false' }} shell: sh diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c6fb75ce..4acbd2b4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -25,6 +25,20 @@ jobs: uses: codecov/codecov-action@v3 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + unit_tests_win: + runs-on: windows-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Setup NoisePy + uses: ./.github/actions/setup + with: + python-version: ${{env.python_version}} + mpi: 'true' + - name: Run pytest + run: | + set PYTHONPATH=src + pytest tests/. integration_tests/. s1_s2: strategy: fail-fast: true From 032c8eccb61cc3fe87e972fada706b965c30b6a2 Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Fri, 1 May 2026 14:32:37 -0700 Subject: [PATCH 16/17] Revert Signed-off-by: Yiyu Ni --- .github/actions/setup/action.yaml | 2 ++ .github/workflows/precommit.yaml | 2 +- .github/workflows/test.yaml | 14 -------------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 8f5ae756..8a9cab74 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -23,6 +23,8 @@ runs: - name: Setup MPI if: ${{ inputs.mpi == 'true' }} uses: mpi4py/setup-mpi@v1 + with: + mpi: openmpi - name: Install project no MPI if: ${{ inputs.mpi == 'false' }} shell: sh diff --git a/.github/workflows/precommit.yaml b/.github/workflows/precommit.yaml index 73e32ee1..4f81cb4a 100644 --- a/.github/workflows/precommit.yaml +++ b/.github/workflows/precommit.yaml @@ -1,4 +1,4 @@ -name: pre-commit checks +name: Pre-commit checks on: pull_request: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4acbd2b4..c6fb75ce 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -25,20 +25,6 @@ jobs: uses: codecov/codecov-action@v3 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - unit_tests_win: - runs-on: windows-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - name: Setup NoisePy - uses: ./.github/actions/setup - with: - python-version: ${{env.python_version}} - mpi: 'true' - - name: Run pytest - run: | - set PYTHONPATH=src - pytest tests/. integration_tests/. s1_s2: strategy: fail-fast: true From 3c2db07dd517a4c14d422964bac5b449fd191e29 Mon Sep 17 00:00:00 2001 From: Yiyu Ni Date: Fri, 1 May 2026 14:54:34 -0700 Subject: [PATCH 17/17] Update log with v0.3.5 io Signed-off-by: Yiyu Ni --- pyproject.toml | 2 +- src/noisepy/seis/__init__.py | 6 +++- src/noisepy/seis/correlate.py | 6 ++-- src/noisepy/seis/stack.py | 6 ++-- tutorials/tutorial_compositestore.ipynb | 44 ++++++++----------------- tutorials/tutorial_local_mseed.ipynb | 5 +-- tutorials/tutorial_ncedc.ipynb | 37 +++++++-------------- tutorials/tutorial_pnwstore.ipynb | 42 ++++++++--------------- 8 files changed, 52 insertions(+), 96 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fc4b9ab9..f00fb42f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ dependencies = [ "PyYAML==6.0", "pydantic-yaml==1.0", "psutil>=5.9.5,<6.0.0", - "noisepy-seis-io>=0.3.4", + "noisepy-seis-io>=0.3.5", "scipy==1.12.0" ] diff --git a/src/noisepy/seis/__init__.py b/src/noisepy/seis/__init__.py index 0c27396d..03009b49 100644 --- a/src/noisepy/seis/__init__.py +++ b/src/noisepy/seis/__init__.py @@ -26,5 +26,9 @@ - noise_module: Collection of functions used in the cross_correlate and stacking steps """ -logging.basicConfig(level=logging.INFO, format="%(asctime)s | %(levelname)s | %(module)s.%(funcName)s() | %(message)s") +logging.basicConfig( + level=logging.INFO, + format="%(asctime)s | %(levelname)s | %(module)s.%(funcName)s() | %(message)s", + datefmt="%Y-%m-%d %H:%M:%S", +) logger = logging.getLogger(__name__) diff --git a/src/noisepy/seis/correlate.py b/src/noisepy/seis/correlate.py index 3cf9bbde..f5045d18 100644 --- a/src/noisepy/seis/correlate.py +++ b/src/noisepy/seis/correlate.py @@ -160,7 +160,7 @@ def cc_timespan( f"for {ts}" ) if len(missing_channels) == 0: - logger.warning(f"{ts} already completed") + logger.info(f"{ts} already completed") return [] ch_data_tuples = _read_channels( @@ -478,7 +478,7 @@ def _read_channels( single_freq: bool = True, ) -> List[Tuple[Channel, ChannelData]]: ch_data_refs = [executor.submit(_safe_read_data, store, ts, ch) for ch in channels] - ch_data = get_results(ch_data_refs, "Reading channel data") + ch_data = get_results(ch_data_refs, "Reading data") tuples = list(filter(lambda tup: tup[1].data.size > 0, zip(channels, ch_data))) return _filter_channel_data(tuples, sampling_rate, single_freq) @@ -544,5 +544,5 @@ def check_memory(params: ConfigParameters, nsta: int) -> int: "Require %5.3fG memory but only %5.3fG provided)! Reduce inc_hours to avoid this issue!" % (memory_size, MAX_MEM) ) - logger.info(f"Require {memory_size:5.2f}GB memory for correlations") + logger.debug(f"Require {memory_size:5.2f}GB memory for correlations") return nseg_chunk diff --git a/src/noisepy/seis/stack.py b/src/noisepy/seis/stack.py index dd5d124b..c8a15d75 100644 --- a/src/noisepy/seis/stack.py +++ b/src/noisepy/seis/stack.py @@ -85,7 +85,7 @@ def initializer(): pairs_node = [pairs_all[i] for i in scheduler.get_indices(pairs_all)] tasks = [executor.submit(stack_store_pair, p[0], p[1], cc_store, stack_store, fft_params) for p in pairs_node] - results = get_results(tasks, "Stacking Pairs") + results = get_results(tasks, "Stacking pairs") executor.shutdown() scheduler.synchronize() tlog.log("Step 2 in total", t_tot) @@ -108,9 +108,9 @@ def stack_store_pair( try: ts = DateTimeRange(fft_params.start_date, fft_params.end_date) if stack_store.contains(src_sta, rec_sta, ts): - logger.info(f"Stack already exists for {src_sta}-{rec_sta}/{ts}") + logger.debug(f"Stack already exists for {src_sta}-{rec_sta}/{ts}") return True - logger.info(f"Stacking {src_sta}_{rec_sta}/{ts}") + logger.debug(f"Stacking {src_sta}_{rec_sta}/{ts}") timespans = cc_store.get_timespans(src_sta, rec_sta) stacks = stack_pair(src_sta, rec_sta, timespans, cc_store, fft_params) if len(stacks) == 0: diff --git a/tutorials/tutorial_compositestore.ipynb b/tutorials/tutorial_compositestore.ipynb index c104e50b..c045b616 100644 --- a/tutorials/tutorial_compositestore.ipynb +++ b/tutorials/tutorial_compositestore.ipynb @@ -60,19 +60,20 @@ "source": [ "%load_ext autoreload\n", "%autoreload 2\n", - "from noisepy.seis import cross_correlate, stack_cross_correlations, __version__ # noisepy core functions\n", - "from noisepy.seis.io.asdfstore import ASDFCCStore, ASDFStackStore # Object to store ASDF data within noisepy\n", - "from noisepy.seis.io.compositerawstore import CompositeRawStore\n", - "from noisepy.seis.io.s3store import SCEDCS3DataStore, NCEDCS3DataStore\n", - "from noisepy.seis.io.channel_filter_store import channel_filter\n", - "from noisepy.seis.io.datatypes import Channel, CCMethod, ConfigParameters, FreqNorm, RmResp, StackMethod, TimeNorm # Main configuration object\n", - "from noisepy.seis.io.channelcatalog import XMLStationChannelCatalog # Required stationXML handling object\n", + "\n", "import os\n", "import obspy\n", "import shutil\n", "from datetime import datetime, timezone\n", "from datetimerange import DateTimeRange\n", "\n", + "from noisepy.seis import cross_correlate, stack_cross_correlations, __version__ # noisepy core functions\n", + "from noisepy.seis.io.asdfstore import ASDFCCStore, ASDFStackStore # Object to store ASDF data within noisepy\n", + "from noisepy.seis.io.compositerawstore import CompositeRawStore\n", + "from noisepy.seis.io.s3store import SCEDCS3DataStore, NCEDCS3DataStore\n", + "from noisepy.seis.io.channel_filter_store import channel_filter\n", + "from noisepy.seis.io.datatypes import Channel, CCMethod, ConfigParameters, FreqNorm, RmResp, StackMethod, TimeNorm\n", + "from noisepy.seis.io.channelcatalog import XMLStationChannelCatalog # Required stationXML handling object\n", "from noisepy.seis.io.plotting_modules import plot_all_moveout\n", "\n", "print(f\"Using NoisePy version {__version__}\")\n", @@ -127,27 +128,6 @@ "We prepare the configuration of the workflow by declaring and storing parameters into the ``ConfigParameters()`` object and/or editing the ``config.yml`` file.\n" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "dIjBD7riIfdJ" - }, - "outputs": [], - "source": [ - "# Initialize ambient noise workflow configuration\n", - "config = ConfigParameters() # default config parameters which can be customized" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "Tsp7RfC8IwE-" - }, - "source": [ - "Customize the job parameters below:" - ] - }, { "cell_type": "code", "execution_count": null, @@ -156,6 +136,9 @@ }, "outputs": [], "source": [ + "# default config parameters which can be customized\n", + "config = ConfigParameters()\n", + "\n", "config.start_date = start\n", "config.end_date = end\n", "config.acorr_only = False # only perform auto-correlation or not\n", @@ -223,7 +206,6 @@ "outputs": [], "source": [ "# For this tutorial make sure the previous run is empty\n", - "#os.system(f\"rm -rf {cc_data_path}\")\n", "if os.path.exists(cc_data_path):\n", " shutil.rmtree(cc_data_path)" ] @@ -254,9 +236,9 @@ }, "outputs": [], "source": [ - "scedc_catalog = XMLStationChannelCatalog(SCEDC_STATION_XML, \n", + "scedc_catalog = XMLStationChannelCatalog(SCEDC_STATION_XML, path_format=\"{network}_{station}.xml\",\n", " storage_options=S3_STORAGE_OPTIONS)\n", - "ncedc_catalog = XMLStationChannelCatalog(NCEDC_STATION_XML, \"{network}.{name}.xml\", \n", + "ncedc_catalog = XMLStationChannelCatalog(NCEDC_STATION_XML, path_format=\"{network}.{station}.xml\", \n", " storage_options=S3_STORAGE_OPTIONS)\n", "\n", "scedc_store = SCEDCS3DataStore(SCEDC_DATA, scedc_catalog, \n", diff --git a/tutorials/tutorial_local_mseed.ipynb b/tutorials/tutorial_local_mseed.ipynb index 8ecdc06f..9e25fe26 100644 --- a/tutorials/tutorial_local_mseed.ipynb +++ b/tutorials/tutorial_local_mseed.ipynb @@ -119,7 +119,8 @@ "outputs": [], "source": [ "# Initialize ambient noise workflow configuration\n", - "config = ConfigParameters() # default config parameters which can be customized\n", + "# default config parameters which can be customized\n", + "config = ConfigParameters() \n", "\n", "config.start_date = start\n", "config.end_date = end\n", @@ -163,7 +164,7 @@ "config.stations = [\"*\"]\n", "config.channels = [\"HH?\"]\n", "\n", - "catalog = XMLStationChannelCatalog(STATION_XML, path_format='{network}.{name}.xml')\n", + "catalog = XMLStationChannelCatalog(STATION_XML, path_format='{network}.{station}.xml')\n", "raw_store = MiniSeedDataStore(DATA, catalog,\n", " channel_filter(config.networks, config.stations, config.channels), \n", " date_range=timerange)" diff --git a/tutorials/tutorial_ncedc.ipynb b/tutorials/tutorial_ncedc.ipynb index 2b6e64b4..5f846ad8 100644 --- a/tutorials/tutorial_ncedc.ipynb +++ b/tutorials/tutorial_ncedc.ipynb @@ -60,16 +60,17 @@ "source": [ "%load_ext autoreload\n", "%autoreload 2\n", + "\n", + "import os\n", + "from datetime import datetime, timezone\n", + "from datetimerange import DateTimeRange\n", + "\n", "from noisepy.seis import cross_correlate, stack_cross_correlations, __version__ # noisepy core functions\n", "from noisepy.seis.io.asdfstore import ASDFCCStore, ASDFStackStore # Object to store ASDF data within noisepy\n", "from noisepy.seis.io.s3store import NCEDCS3DataStore # Object to query SCEDC data from on S3\n", "from noisepy.seis.io.channel_filter_store import channel_filter\n", "from noisepy.seis.io.datatypes import CCMethod, ConfigParameters, FreqNorm, RmResp, StackMethod, TimeNorm\n", "from noisepy.seis.io.channelcatalog import XMLStationChannelCatalog # Required stationXML handling object\n", - "import os\n", - "from datetime import datetime, timezone\n", - "from datetimerange import DateTimeRange\n", - "\n", "from noisepy.seis.io.plotting_modules import plot_all_moveout\n", "\n", "print(f\"Using NoisePy version {__version__}\")\n", @@ -139,27 +140,6 @@ "We prepare the configuration of the workflow by declaring and storing parameters into the ``ConfigParameters()`` object and/or editing the ``config.yml`` file.\n" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "dIjBD7riIfdJ" - }, - "outputs": [], - "source": [ - "# Initialize ambient noise workflow configuration\n", - "config = ConfigParameters() # default config parameters which can be customized" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "Tsp7RfC8IwE-" - }, - "source": [ - "Customize the job parameters below:" - ] - }, { "cell_type": "code", "execution_count": null, @@ -168,6 +148,10 @@ }, "outputs": [], "source": [ + "# Initialize ambient noise workflow configuration\n", + "# default config parameters which can be customized\n", + "config = ConfigParameters() \n", + "\n", "config.start_date = start\n", "config.end_date = end\n", "config.acorr_only = False # only perform auto-correlation or not\n", @@ -266,7 +250,8 @@ "config.stations = [\"KCT\", \"KRP\", \"KHMB\"]\n", "config.channels = [\"HH?\"]\n", "\n", - "catalog = XMLStationChannelCatalog(S3_STATION_XML, \"{network}.{name}.xml\", storage_options=S3_STORAGE_OPTIONS) # Station catalog\n", + "catalog = XMLStationChannelCatalog(S3_STATION_XML, path_format=\"{network}.{station}.xml\", \n", + " storage_options=S3_STORAGE_OPTIONS)\n", "raw_store = NCEDCS3DataStore(S3_DATA, catalog, \n", " channel_filter(config.networks, config.stations, config.channels), \n", " timerange, storage_options=S3_STORAGE_OPTIONS) # Store for reading raw data from S3 bucket\n", diff --git a/tutorials/tutorial_pnwstore.ipynb b/tutorials/tutorial_pnwstore.ipynb index 3118bfb8..4e1e3a49 100644 --- a/tutorials/tutorial_pnwstore.ipynb +++ b/tutorials/tutorial_pnwstore.ipynb @@ -68,16 +68,17 @@ }, "outputs": [], "source": [ + "import os\n", + "from datetime import datetime\n", + "from datetimerange import DateTimeRange\n", + "\n", "from noisepy.seis import cross_correlate, stack_cross_correlations # noisepy core functions\n", "from noisepy.seis.io import plotting_modules\n", - "from noisepy.seis.io.asdfstore import ASDFCCStore, ASDFStackStore # Object to store ASDF data within noisepy\n", + "from noisepy.seis.io.asdfstore import ASDFCCStore, ASDFStackStore\n", "from noisepy.seis.io.channel_filter_store import channel_filter\n", "from noisepy.seis.io.pnwstore import PNWDataStore\n", - "from noisepy.seis.io.datatypes import CCMethod, ConfigParameters, Channel, ChannelData, ChannelType, FreqNorm, RmResp, Station, TimeNorm\n", + "from noisepy.seis.io.datatypes import CCMethod, ConfigParameters, FreqNorm, RmResp, TimeNorm\n", "from noisepy.seis.io.channelcatalog import XMLStationChannelCatalog # Required stationXML handling object\n", - "import os\n", - "from datetime import datetime\n", - "from datetimerange import DateTimeRange\n", "\n", "path = \"./pnw_data\" \n", "\n", @@ -116,27 +117,6 @@ "We store the metadata information about the ambient noise cross correlation workflow in a ConfigParameters() object. We first initialize it, then we tune the parameters for this cross correlation." ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "dIjBD7riIfdJ" - }, - "outputs": [], - "source": [ - "# Initialize ambient noise workflow configuration\n", - "config = ConfigParameters() # default config parameters which can be customized" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "Tsp7RfC8IwE-" - }, - "source": [ - "Customize the job parameters below:" - ] - }, { "cell_type": "code", "execution_count": null, @@ -145,6 +125,10 @@ }, "outputs": [], "source": [ + "# Initialize ambient noise workflow configuration\n", + "# default config parameters which can be customized\n", + "config = ConfigParameters()\n", + "\n", "config.sampling_rate = 20 # (int) Sampling rate in Hz of desired processing (it can be different than the data sampling rate)\n", "config.cc_len = 3600 # (float) basic unit of data length for fft (sec)\n", " # criteria for data selection\n", @@ -215,11 +199,11 @@ "config.stations = [\"BBO\", \"BABR\", \"SHUK\", \"PANH\"]\n", "config.channels = [\"BH?\", \"HH?\"]\n", "\n", - "catalog = XMLStationChannelCatalog(STATION_XML, path_format=\"{network}/{network}.{name}.xml\")\n", + "catalog = XMLStationChannelCatalog(STATION_XML, path_format=\"{network}/{network}.{station}.xml\")\n", "raw_store = PNWDataStore(DATA, DB_PATH, catalog,\n", " channel_filter(config.networks, config.stations, config.channels), \n", - " date_range=timerange) # Store for reading raw data\n", - "cc_store = ASDFCCStore(cc_data_path) # Store for writing CC data" + " date_range=timerange) # Store for reading raw data\n", + "cc_store = ASDFCCStore(cc_data_path) # Store for writing CC data" ] }, {