|
1 | 1 | # Displacement Seismic Amplitude Ratio (DSAR) |
2 | 2 |
|
3 | 3 | ## How to Use |
| 4 | +### Install using pip: |
| 5 | +```python |
| 6 | +pip install dsar |
| 7 | +``` |
| 8 | + |
| 9 | +### Import `dsar` module |
| 10 | +```python |
| 11 | +from dsar import DSAR, PlotDsar |
| 12 | +``` |
| 13 | + |
| 14 | +### Initiate DSAR |
| 15 | +```python |
| 16 | +dsar = DSAR( |
| 17 | + input_dir="G:\\Output\\Converted\\SDS", |
| 18 | + directory_structure='SDS', |
| 19 | + start_date="2024-01-01", |
| 20 | + end_date="2024-04-22", |
| 21 | + station="RUA3", |
| 22 | + channel="EHZ", |
| 23 | + resample="10min" # default |
| 24 | +) |
| 25 | +``` |
| 26 | + |
| 27 | +See https://github.com/martanto/magma-converter for supported `directory_structure`. |
4 | 28 |
|
5 | | -1. All the seismic data must have SDS Directory as an input. See an example in [input directory](input). Or you can check it here https://www.seiscomp.de/seiscomp3/doc/applications/slarchive/SDS.html |
6 | | -2. Inside `main.py` or `main.ipynb` change those parameters: |
| 29 | +### Run DSAR |
7 | 30 | ```python |
8 | | -network = "VG" |
9 | | -station = "PSAG" |
10 | | -location = "00" |
11 | | -channel = "EHZ" |
| 31 | +dsar.run() |
| 32 | +``` |
12 | 33 |
|
13 | | -sds_directory = r"D:\Projects\dsar\input" |
14 | | -output_directory = 'output' |
| 34 | +### Results/Output directory |
| 35 | +Output directory would be as the same folder where DSAR code is running. It will create `output` directory. |
15 | 36 |
|
16 | | -start_date = "2017-12-01" |
17 | | -end_date = "2017-12-03" |
| 37 | +### Plot DSAR |
| 38 | +Initiate DSAR plot |
| 39 | +```python |
| 40 | +plot = PlotDsar( |
| 41 | + start_date="2024-01-01", |
| 42 | + end_date="2024-04-22", |
| 43 | + station="RUA3", |
| 44 | + channel="EHZ" |
| 45 | +) |
| 46 | +``` |
18 | 47 |
|
19 | | -bands: dict[str, list[float]] = { |
20 | | - 'HF' : [0.1, 8.0, 16.0], |
21 | | - 'LF' : [0.1, 4.5, 8.0], |
22 | | -} |
| 48 | +### Get combined dataframe to plot |
| 49 | +```python |
| 50 | +df = plot.df |
| 51 | +``` |
| 52 | +The output of dataframe will be saved as CSV: |
| 53 | +```text |
| 54 | +✅ Saved to D:\Project\dsar\output\dsar\VG.RUA3.00.EHZ\combined_10min_VG.RUA3.00.EHZ.csv |
| 55 | +``` |
23 | 56 |
|
24 | | -resample_rule: str = '10min' |
| 57 | +Plot DSAR: |
| 58 | +```python |
| 59 | +plot.plot( |
| 60 | + interval_day=7, |
| 61 | + y_min=85, |
| 62 | + y_max=225, |
| 63 | + save=True, |
| 64 | + file_type='jpg', |
| 65 | +) |
25 | 66 | ``` |
26 | | -3. Run the `main.py` or `main.ipynb`. |
27 | | -4. The output of this code would be saved into `output` directory and will be used as an input of `dsar.py`. |
28 | | -5. Run `dsar.py` to get the calculated _dsar_ CSV and plot the result. |
| 67 | +Output: |
| 68 | +```text |
| 69 | +✅ Saved to D:\Project\dsar\output\dsar\VG.RUA3.00.EHZ\combined_10min_VG.RUA3.00.EHZ.csv |
| 70 | +📷 Figure saved to: D:\Project\dsar\output\figures\dsar\VG.RUA3.00.EHZ\VG.RUA3.00.EHZ_10min_2024-01-01-2024-04-22.jpg |
| 71 | +``` |
| 72 | + |
| 73 | + |
29 | 74 |
|
30 | 75 | ## References |
31 | 76 | > Caudron, C., et al., 2019, Change in seismic attenuation as a long-term precursor of gas-driven |
|
0 commit comments