Git Product home page Git Product logo

rfoehnix's Introduction

foehnix

Build Status codecov Repository Status Python

A Toolbox for Automated Foehn Classification based on Mixture Models

foehnix package provides a toolbox for automated probabilistic foehn wind classification based on two-component mixture models (foehn mixture models). foehnix models are a special case of the general flexible mixture model class (Fraley 2002, Leisch 2004, Grün 2007, Grün 2008), an unsupervised statistical model to identify unobserveable clusters or components in data sets.

The application of mixture models for an automated classification of foehn winds has first been proposed by Plavcan et al. (2014). The "Community Foehn Classification Experiment" shows that the method performs similar compared to another semi-automatic classification, foehn experts, students, and weather enthusiasts (see Mayr 2019).

Aim of this software package:

  • provide easy-to-use functions for classification
  • create probabilistic foehn classification
  • easy scalability (can be applied to large data sets)
  • reproducibility of the results
  • create results which are comparable to other locations

Important Links

First Steps

Installation

The package is not yet published via the Comprehensive R Archive Network (CRAN) but will be made available as soon as finished. Currently the package has to be downloaded/installed via github which can be done in different ways. Note that the foehnix package comes with routines written in C. Thus, on Windows, the Rtools have to be installed to be able to compile the C code!

Via the R package remotes

The R package remotes allows one to install packages from github via the R command line interface using the function install_github. By default, remotes installes the latest version of the master branch. However, feel free to install one of our earlier releases (show release candidates).

# Load library 'remotes'. If not yet installed, call
# install.packages("remotes") first.
library("remotes")

# Install package (automatically resolves required dependencies)
install_github("retostauffer/Rfoehnix")

# Or install a specific release candiate (here v0.1-2)
install_github("retostauffer/[email protected]")
asdf

By cloning the repository

Or do it the good old way via git clone (Note: dependencies have to be installed manually):

# Change directory
cd <somewhere/on/your/local/disc>

# Clone repository
git clone https://github.com/retostauffer/Rfoehnix.git foehnix

Afterwards use your preferred way to install local packages. E.g., using devtools or remotes:

# Use remotes
remotes::install_local("foehnix")

# Using devtools
devtools::install("foehnix")

For Command Shell Fans

Fans of the good old console can of course use the good old way.

# Change directory
cd <somewhere/on/your/local/disc>

# Clone repository
git clone https://github.com/retostauffer/Rfoehnix.git foehnix

# Feel free to use on of our release candidates which
# might miss some features, but might also be more stable.
# A list of release candidates can be found on:
# - https://github.com/retostauffer/Rfoehnix/releases
(cd foehnix && git checkout tags/<tagname> && cd ..)

# Install directly
R CMD INSTALL foehnix

# OR
R CMD build foehnix
R CMD INSTALL foehnix_<version>.tar.gz

Import observation data

The foehnix package depends on the R package zoo (Z's Ordered Observations), a package/object to handle (un-)regular time series data. Import data as zoo is relatively straight forward for those being used to R. For all others, we provide a small "how-to" which can be found here:

More information is provided in the "Reading Data into zoo" vignette of the R package zoo.

Create classification

Once the observation data have been imported, one can start doing the classification. The foehnix package comes with two demo data sets, one for Southern California (USA) and one for Tyrol (A). The documentation provides a walk-through on how to start using foehnix:

Reto, Matthias, Georg, and Fabien.

References

Mayr GJ, Plavcan D, Laurence A, Elvidge A, Grisogono B, Horvath K, Jackson P, Neururer A, Seibert P, Steenburgh JW, Stiperski I, Sturman A, Večenaj Ž, Vergeiner J, Vosper S, Zängl G (2018). The Community Foehn Classification Experiment. Bulletin of the American Meteorological Society, 99(11), 2229—2235, 10.1175/BAMS-D-17-0200.1

Plavcan D, Mayr GJ, Zeileis A (2014). Automatic and Probabilistic Foehn Diagnosis with a Statistical Mixture Model. Journal of Applied Meteorology and Climatology, 53(3), 652—659, 10.1175/JAMC-D-13-0267.1

Hastie T, Tibshirani R, Friedman J (2009). Fitting Logistic Regression Models. In The Elements of Statistical Learning (Chapter 4.4.1), 2nd edition, ISBN 978-0387848570. PDF download

Grün B, Friedrich L (2008). FlexMix Version 2: Finite Mixtures with Concomitant Variables and Varying and Constant Parameters. Journal of Statistical Software, Articles, 28(4), 1—35, doi:10.18637/jss.v028.i04

Grün B, Leisch F (2007). Fitting Finite Mixtures of Generalized Linear Regressions in _R_. Computational Statistics & Data Analysis, 51(11), doi:10.1016/j.csda.2006.08.014

Friedrich L (2004). FlexMix: A General Framework for Finite Mixture Models and Latent Class Regression in R. Journal of Statistical Software, Articles, 11(8), 1—18, doi:10.18637/jss.v011.i08

Fraley C, Raftery AE (2000). Model-Based Clustering, Discriminant Analysis, and Density Estimation. Journal of the American Statistical Association, 97(458), 611—631, doi:10.1198/016214502760047131

McCullagh P, Nelder JA (1999). Likelihood functions for binary data. In Generalized Linear Models (Chapter 4.4), 2nd edition, ISBN 0-412-31760-5.

rfoehnix's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fmaussion

rfoehnix's Issues

windrose: how to have same speed classes on all subplot?

I haven't found a way yet of plotting the same speed classes on all subplots (unconditional, foehn, nofoehn). If there already is, could you please add that to the examples you give in the windrose-documentation. If not, could you please implement it (at least as an option)? Thanks!

rownames(beta) does not work for me

Quite likely this is due to my limited R knowledge but for me the following line does not work as rownames(beta) always returns NULL

ic <- grep("^\\(Intercept\\)$", rownames(beta))

minimal working example from the unit test:

beta <- structure(matrix(c(2, -5, -5), ncol = 1), rownames = c("(Intercept)", "A", "B"))
ic <- grep("^\\(Intercept\\)$", rownames(beta))

as rownames returns NULL, ic is subsequently integer(0) and the IF-loop after the above quoted line always uses the ELSE fallback.

added functionality for tsplot

Would be great to have

  • filter(s) underlaid to the wind direction plot

  • an option to add plots of T/rh and dd/ff of the crest station at the top of the current tsplot (analogous to the way the valley station is currently plotted plus an underlay of the wind filter (if specified). Helps with the analysis of foehn locations that are difficult to classify.

Hovmoeller: plot even if time series < 1year

For unusually short time series (but frequent enough foehn) it would be nice to also be able to plot a Hovmoeller and just have the times without data empty. Currently attempting to do so gives an empty plot.

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.