Skip to main content

Implementation of HySPLIT based trajectory modeling and analysis in python

Project description

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.

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

hytraj-0.1.3.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

hytraj-0.1.3-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file hytraj-0.1.3.tar.gz.

File metadata

  • Download URL: hytraj-0.1.3.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for hytraj-0.1.3.tar.gz
Algorithm Hash digest
SHA256 450952106cd497aef396120d6abf23799686534564b6679a014a2eab559f7034
MD5 67363f76616a55b1313c51d1bae0b60b
BLAKE2b-256 2248ef3e83a15330c526df3f5ae6df286abc50eaecc3ac31afad3bb6f6a7b40c

See more details on using hashes here.

File details

Details for the file hytraj-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: hytraj-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for hytraj-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4c843db51bf17ca16913776a965d370abf82a4a163dc7c86b7863ba569f55805
MD5 7b01a83edf00f9df9da2c5bcd70f190d
BLAKE2b-256 8b4d0336b7c7429d0e7dcf5e5d37411bce3a2aa5dd9fb24c57438493e5b41e12

See more details on using hashes here.

Supported by

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