Skip to main content

ModifiedDTW

Project description

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 to install all the requirements. Just follow the commands below:

Install dtaidistance:

pip install dtaidistance

Cost matrix based on dtaidistance (https://pypi.org/project/dtaidistance/)

Install pandas:

pip install pandas

Data requirements:

Both timeseries should be in pandas series format with same datetime index

Usage

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modifieddtw-1.1.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modifieddtw-1.1.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file modifieddtw-1.1.1.tar.gz.

File metadata

  • Download URL: modifieddtw-1.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for modifieddtw-1.1.1.tar.gz
Algorithm Hash digest
SHA256 e5e6e46ac2243b20544b2ea3edd47e6c17106f6b10045229266988eac5b184b4
MD5 8d92023e55bcea8666b4196c4b88fae3
BLAKE2b-256 6142f351230f211ae0720efc963b5e60a112f510b75ac697f1d54730ad2a8b33

See more details on using hashes here.

File details

Details for the file modifieddtw-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: modifieddtw-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for modifieddtw-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f04900b4660e99eee3eea48e17d02711a51aaa19646c62e3411879dc4d1d1fd
MD5 345158af6f741ea27f62625e9af4c242
BLAKE2b-256 11df6a56defd621887865a36f7f6df83ba82e6596b9e85505ff1910a8eb28be3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page