Skip to main content

HyTraj

This python library implements HySPLIT based trajectory modeling and analysis.

Installation

Install using pip:

pip install hytraj

or

pip install git+https://github.com/pankajkarman/HyTraj.git

Dependencies

  1. Plotting requires Basemap.

  2. Hierarchical clustering requires traj_dist.

Documentation

Latest documentation is available here.

Usage

See this notebook for example usecase.

import hytraj as ht

Generate Trajectories

from hytraj import HyTraj

met_type = "ncep"
dates = pd.date_range("2010-02-01", freq="24H", end="2010-02-10")
hy = HyTraj(stations, height, run_time, working, metdir, outdir, met_type)
data = hy.run(dates, njobs=7)
hy.plot(data["Neumayer"], vertical="alt", show=True)

Example Trajectories

Cluster Trajectories

KMeans Clustering using wavelet features

from hytraj import HyCluster

labels = HyCluster(data).fit(kmax=10, method='KMeans')

Hierarchical Agglomerative Clustering (HAC)

from hytraj import HyHAC

trj = HyHAC(data)
labels = trj.fit(nclus=4, metric='sspd')
trj.plot_dendrogram()

Dendrogram

Receptor Modeling

from hytraj import HyReceptor, HyData

station = 'South Pole'
data = HyData(files, stations).read()[station]
model = HyReceptor(ozone, data, station_name="South Pole")
cwt = model.calculate_cwt(weighted=False)
pscf = model.calculate_pscf(thresh=0.95)
rtwc = model.calculate_rtwc(normalise=True)
model.plot_map(rtwc, boundinglat=-25)

Features

  1. HyTraj: Higher level implementation of Parallel Generation, reading and plotting of Trajectories (Recommended).

  2. HyGen: Generation of Trajectories using various meteo datasets (NCEP and GDAS implemented).

  3. HyControl: Generation of control files for parallel trajectory generation afterwards.

  4. HyParallel: Parallel generation of trajectories using control files produced using HyControl.

  5. HyData: Reading and binning trajectories data (NetCDF with xarray support).

  6. HyCluster: Clustering of trajectories with KMeans using wavelet features.

  7. HyHAC: Clustering of trajectories with Hierarchical Agglomerative Clustering (HAC) using various trajectory distance metric like DTW, EDR, LCSS, SSPD, Frechet Distance, Hausdorf Distance.

  8. HyReceptor: Single site Receptor Modeling ( both weighted and unweighted):

    • Concentration weighted Trajectory (CWT)
    • Potential Source Contribution Function (PSCF)
    • Residence Time Weighted Concentration (RTWC)

To Do

  1. Support for more meteorology like ERA5.
  2. Add documentation.
  3. GUI: Medium-term goal

PS: Find pre-built HYSPLIT executable at this link and copy executeble to working directory.

Metadata

Release files for hytraj 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hytraj 0.1.3
File Size Uploaded
hytraj-0.1.3.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hytraj 0.1.3
File Interpreter ABI Platform
hytraj-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 25.9 kB

Release files / hytraj-0.1.3.tar.gz

Download URL hytraj-0.1.3.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
450952106cd497aef396120d6abf23799686534564b6679a014a2eab559f7034
BLAKE2b-256 checksum
How to use checksums
2248ef3e83a15330c526df3f5ae6df286abc50eaecc3ac31afad3bb6f6a7b40c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release files / hytraj-0.1.3-py3-none-any.whl

Download URL hytraj-0.1.3-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c843db51bf17ca16913776a965d370abf82a4a163dc7c86b7863ba569f55805
BLAKE2b-256 checksum
How to use checksums
8b4d0336b7c7429d0e7dcf5e5d37411bce3a2aa5dd9fb24c57438493e5b41e12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page