Metadata-Version: 2.4
Name: dsar
Version: 1.3.0
Summary: Calculating Displacement Seismic Amplitude Ratio (DSAR) Value
Project-URL: Homepage, https://github.com/martanto/dsar
Project-URL: Issues, https://github.com/martanto/dsar/issues
Author-email: Martanto <martanto@live.com>, Corentin Caudron <corentin@ulb.be>
License: MIT License
        
        Copyright (c) 2024 Martanto
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: dsar,seismic,volcano,volcanology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Requires-Dist: ipykernel>=7.2.0
Requires-Dist: matplotlib>=3.9.0
Requires-Dist: numpy>=2.0.0
Requires-Dist: obspy>=1.4.2
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: pandas>=2.2.0
Requires-Dist: python-slugify>=8.0.0
Requires-Dist: setuptools==80.8.0
Provides-Extra: base
Requires-Dist: matplotlib; extra == 'base'
Requires-Dist: numpy; extra == 'base'
Requires-Dist: obspy; extra == 'base'
Requires-Dist: openpyxl; extra == 'base'
Requires-Dist: pandas; extra == 'base'
Requires-Dist: python-slugify; extra == 'base'
Description-Content-Type: text/markdown

#  Displacement Seismic Amplitude Ratio (DSAR)

## How to Use
### Install using pip:
```python
pip install dsar
```

### Import `dsar` module
```python
from dsar import DSAR, PlotDsar
```

### Initiate DSAR
```python
dsar = DSAR(
    input_dir="G:\\Output\\Converted\\SDS",
    directory_structure='SDS',
    start_date="2024-01-01",
    end_date="2024-04-22",
    station="RUA3",
    channel="EHZ",
    resample="10min" # default
)
```

See https://github.com/martanto/magma-converter for supported `directory_structure`.

### Run DSAR
```python
dsar.run()
```

### Results/Output directory
Output directory would be as the same folder where DSAR code is running. It will create `output` directory.

### Plot DSAR
Initiate DSAR plot
```python
plot = PlotDsar(
    start_date="2024-01-01",
    end_date="2024-04-22",
    station="RUA3",
    channel="EHZ"
)
```

### Get combined dataframe to plot
```python
df = plot.df
```
The output of dataframe will be saved as CSV:
```text
✅ Saved to D:\Project\dsar\output\dsar\VG.RUA3.00.EHZ\combined_10min_VG.RUA3.00.EHZ.csv
```

Plot DSAR:
```python
plot.plot(
    interval_day=7,
    y_min=85,
    y_max=225,
    save=True,
    file_type='jpg',
)
```
Output:
```text
✅ Saved to D:\Project\dsar\output\dsar\VG.RUA3.00.EHZ\combined_10min_VG.RUA3.00.EHZ.csv
📷 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
```

Figures:
![output.png](https://github.com/martanto/dsar/blob/master/images/output.png?raw=true)


## References
> Caudron, C., et al., 2019, Change in seismic attenuation as a long-term precursor of gas-driven
eruptions: Geology, https://doi.org/10.1130/G46107.1  
> 
> Chardot, L., Jolly, A. D., Kennedy, B. M., Fournier, N., & Sherburn, S. (2015). Using volcanic tremor for eruption forecasting at White Island volcano (Whakaari), New Zealand. Journal of Volcanology and Geothermal Research, 302, 11–23. https://doi.org/10.1016/j.jvolgeores.2015.06.001
