Giter Club home page Giter Club logo

hytraj's Introduction


PyPI version License Downloads Code style: black


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.

hytraj's People

Contributors

pankajkarman avatar

Stargazers

 avatar  avatar  avatar  avatar Ales Kuchar avatar  avatar

Watchers

James Cloos avatar  avatar

hytraj's Issues

a suggestion

Hi pankajkarman,

 The package is very useful in analysing potiential source.
 I see the calculation of pscf/cwt/rtwc, it does not consider the trajtory point height, all is in 2D surface.
 But in working directory, there is a terrain file, I think if the calculation can take the height into consideration,ie in a 3D space, it will be more excellent.

Regards,

ddlddl58

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.