Skip to content

Repository files navigation

Monthly Report

Pipeline and Streamlit UI for generating monthly seismic reports for Taiwan SM stations (SM01/02/06/09/19/37/39/40).

Setup

conda env create -f env.yml
conda activate visual_month

Typical usage — run.sh

Edit the variables at the top of run.sh, then run it:

# variables
monthIndex="5"
startDay="121"
endDay="151"
parentDir="/raid1/SM_data/archive/2026/TW"
outputParentDir="/home/patrick/Work/Month_report_repo/"
stationList="/home/patrick/Work/Month_report_repo/station.csv"
pzParentDir="/raid1/SM_data/TWSM2/"
bash run.sh

This runs the full pipeline in order:

  1. preprocessing.py — removes instrument response
  2. visualization.py — data availability, PSD, spectrogram
  3. event_analysis.py — waveform+spectrogram grid and record section for each event in used_event_list (parallelized with GNU Parallel, -j6)

Prepare used_event_list beforehand — one event per line, space-separated: DAY TIME LON LAT.


Directory structure

Input data (example: SM01, processing 2026 data)

/raid1/SM_data/archive/2026/TW/          ← parentDir (read-only)
└── SM01/EPZ.D/TW.SM01.00.EPZ.D.2026.121

/raid1/SM_data/archive/2024/TW/          ← write-privileged mount
├── preprocessing/SM01/EPZ.D/...         ← generated by preprocessing.py
└── remove_resp_2026/SM01/TW.SM01.00.EPZ.D.2026.121

Regardless of the year being processed, preprocessing/ and remove_resp_{year}/ are always written under archive/2024/TW/ — the only directory with write access.

Output

/home/patrick/Work/Month_report_repo/    ← outputParentDir
├── log/
├── output/2026_May/
│   ├── May_data_availability_EPZ.D.png
│   └── SM01_EPZ_spec.png
└── events/<EVENT_LABEL>/
    ├── record_section.png
    └── waveform_spectrogram/<STATION>.png

Individual scripts

preprocessing.py

python preprocessing.py \
  --parent_dir=$parentDir --pz_parent_dir=$pzParentDir \
  --start_day=$startDay --end_day=$endDay \
  --output_parent_dir=$outputParentDir

visualization.py

# Data availability
python visualization.py --mode=seis_status --month_index=$monthIndex \
  --parent_dir=$parentDir --output_parent_dir=$outputParentDir

# PSD (raw data, no response removal)
python visualization.py --mode=psd --month_index=$monthIndex \
  --start_day=$startDay --end_day=$endDay \
  --parent_dir=$parentDir --output_parent_dir=$outputParentDir

# Spectrogram (ylim 0.1–50 Hz, log scale)
python visualization.py --mode=spec --month_index=$monthIndex \
  --start_day=$startDay --end_day=$endDay \
  --parent_dir=$parentDir --output_parent_dir=$outputParentDir

event_analysis.py

# Single event
python event_analysis.py --mode=all --month_index=$monthIndex \
  --event_day=85 --event_time=2026-03-25T10:13:37 \
  --event_lon=121.56 --event_lat=24.01 \
  --parent_dir=$parentDir --output_parent_dir=$outputParentDir \
  --station_location_file=$stationList

# Batch (same as run.sh)
parallel -j6 --colsep ' ' \
  "python event_analysis.py --mode=all --month_index=$monthIndex \
   --event_day={1} --event_time={2} --event_lon={3} --event_lat={4} \
   --parent_dir=$parentDir --output_parent_dir=$outputParentDir \
   --station_location_file=$stationList" \
  :::: used_event_list

app.py — Streamlit UI

Displays pre-rendered PNGs and provides on-demand preview (no file writing).

streamlit run app.py

Set Base Data Directory in the sidebar to outputParentDir.

About

For monthly report

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages