Metadata-Version: 2.4
Name: ModifiedDTW
Version: 1.1.1
Summary: ModifiedDTW
Author: BilalSB
Author-email: syedbakhtawarbilal@gmail.com
Keywords: python,DTW,drought propagation,Bilal-Vivek Band,MDTW
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dtaidistance
Requires-Dist: pandas
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# Description
This is a tutorial project for finding optimum lag using the Modified Dynamic time warping along with the links.

## Requirements

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install all the requirements.
Just follow the commands below:

Install dtaidistance:
```bash
pip install dtaidistance
```
Cost matrix based on dtaidistance (https://pypi.org/project/dtaidistance/)

Install pandas:
```bash
pip install pandas
```

## Data requirements:
Both timeseries should be in pandas series format with same datetime index

## Usage
```bash
from ModifiedDTW.ModifedDTW import MDTWlag

series1 = Droughtindex1  # Cause
series2 = Droughtindex2  # Effect

Results = MDTWlag(series1, series2, Maximumwindowsize, LagRange)

Distanceatdifferentlags = Results[0]
OptimumLag = Results[1]
OptimumLinks = Results[2]

```
**MaximumWindowSize** defines the window within which the DTW path operates (default = 12).

**LagRange** specifies the maximum lag up to which the optimum lag will be searched (depends on the system under study;  Default use MaximumWindowSize = LagRange).

**Distanceatdifferentlags** outputs a dataframe with total path distance at different lag.

**OptimumLag** is the propagation lag based on minimum path distance.

**OptimumLinks** is the datetime of links between the two indices at optimum lag.


__Note: This package uses forward only band (Bilal-Gupta Band) preferred for analysis of links/lag between meteorological to agricultural/hydrological indices.__

## Cite
Bilal, S. B., & Gupta, V. (2026). A novel multi-link approach to drought propagation analysis using modified dynamic time warping. Journal of Hydrology, 135604. (https://doi.org/10.1016/j.jhydrol.2026.135604)

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
