Skip to content

Commit ac15b42

Browse files
authored
Merge pull request #4 from martanto/dev
Update readme
2 parents 1f4e9ba + eb09992 commit ac15b42

File tree

2 files changed

+63
-18
lines changed

2 files changed

+63
-18
lines changed

README.md

Lines changed: 63 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,76 @@
11
# Displacement Seismic Amplitude Ratio (DSAR)
22

33
## 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`.
428

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
730
```python
8-
network = "VG"
9-
station = "PSAG"
10-
location = "00"
11-
channel = "EHZ"
31+
dsar.run()
32+
```
1233

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.
1536

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+
```
1847

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+
```
2356

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+
)
2566
```
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+
![output.png](https://github.com/martanto/dsar/blob/master/examples/figures/output.png?raw=true)
73+
2974

3075
## References
3176
> Caudron, C., et al., 2019, Change in seismic attenuation as a long-term precursor of gas-driven

examples/figures/output.png

153 KB
Loading

0 commit comments

Comments
 (0)