Welcome to snowplot’s documentation!

snowplot

https://img.shields.io/pypi/v/snowplot.svg Documentation Status

SnowPlot is a command line tool for snow professionals who need to make vertical plots to display various snowpack data. This was made from the need to make figures to validate the Lyte Probe. To that end we are adding density profiles, hand hardness profiles, snow micropen profiles, and more. The tool is based on a configuration file where the user can use a simple text editor to generate complicated figures.

Usage

snowplot config.ini

Features

  • Manage repeatable figures using a config file

  • Add annotations to plots with simple text

  • Plot Lyte Probe Data

  • Plot hand hardness data

  • Plot Snow micropen data

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Installation

Stable release

To install snowplot, run this command in your terminal:

$ pip install snowplot

This is the preferred method to install snowplot, as it will always install the most recent stable release.

If you don’t have pip installed, this Python installation guide can guide you through the process.

From sources

The sources for snowplot can be downloaded from the Github repo.

You can either clone the public repository:

$ git clone git://github.com/micahjohnson150/snowplot

Or download the tarball:

$ curl -OJL https://github.com/micahjohnson150/snowplot/tarball/master

Once you have a copy of the source, you can install it with:

$ python setup.py install

Usage

Form a configuration file using the the sections you want and save this to config.ini e.g.

[hand_hardness]
filename: hand_hardness.txt

[output]
filename: figure.png

Where the hand_hardness.txt file has:

140-120 = F,F+
120-90 = 4F
90-50 = 1F
50-0 = p

Then run snowplot on your config file in the commandline:

snowplot config.ini

This will produce the following image:

_images/single_hand_hardness.png

Configuration File Reference

The snowplot’s configuration file is described in detail below. This information is all based on the master.ini file stored under the top level of the package.

For configuration file syntax information please visit http://inicheck.readthedocs.io/en/latest/

lyte_probe

add_average_column
If true will average together all the columns
Default: False
Type: bool

assumed_depth
Depth in cm to assumed a linear depth profile to with the timeseries data
Default: None
Type: int

autocrop
Use the probes accelerometer and NIR sensors to crop the data to the snowpack only
Default: False
Type: bool

bottom_depth
Depth in CM where the movement stopped
Default: None
Type: float

calibration_coefficients
Polynomial coefficients to use for processing the column_to_plot data
Default: 1 0
Type: float

column_to_plot
List of columns to plot in the data
Default: sensor1
Type: string

depth_method
Method to determine the depth profile
Default: baro
Type: string
Options: baro acc avg

detect_surface
Use the NIR sensors to determine the location of the snow surface.
Default: False
Type: bool

filename
Filename to be plotted
Default: None
Type: criticalfilename

fill_color
Decimal RGB Color to use for the plot when fill is used
Default: 0 .455 .784 1
Type: float

fill_solid
Determines whether to fill in the profile solid to the y axis
Default: True
Type: bool

line_color
Decimal RGB Color to use for the plot
Default: 0.0 0.0 0.0 1
Type: float

plot_id
Location of plot left to right starting with 1
Default: 1
Type: int

plot_labels
a list of tuples containing labels to add to the plot
Default: None
Type: string

problem_layer
Depth in centimeters to place a red horizontal line on the plot.
Default: None
Type: float

remove_xticks
Whether or not to use the xtick labels
Default: False
Type: bool

smoothing
Rolling window over each column to apply an averaging filter
Default: None
Type: int

surface_depth
Depth in CM where the snow surface begins in the profile. This will also shift your profile up such that this depth is now zero
Default: None
Type: float

title
Plot title for the Lyte probe
Default: lyte probe
Type: string

use_filename_title
Use the filename to for the lyte plot title
Default: True
Type: bool

xlabel
Label to put under the x axis
Default: Force (mN)
Type: string

xlimits
Range in the X Axis to plot after all the settings above are applied
Default: None
Type: floatpair

ylabel
Label on the y axis
Default: Depth from surface (cm)
Type: string

ylimits
Range of depths in cm to plot after all the settings above are applied
Default: None
Type: floatpair

snow_micropen

filename
Filename to be plotted
Default: None
Type: criticalfilename

fill_color
Decimal RGB Color to use for the plot
Default: 0.211 .27 .31 1
Type: float

fill_solid
Determines whether to fill in the profile solid to the y axis
Default: True
Type: bool

line_color

Default: 0.0 0.0 0.0 1
Type: float

plot_id
Location of plot left to right starting with 1
Default: 1
Type: int

plot_labels
a list of tuples containing labels to add to the plot
Default: None
Type: string

problem_layer
Depth in centimeters to place a red horizontal line on the plot.
Default: None
Type: float

remove_xticks
Whether or not to use the xtick labels
Default: False
Type: bool

smoothing
Rolling window over each column to apply an averaging filter
Default: None
Type: int

title
Plot title the snow micro pen
Default: snow micropen
Type: string

use_filename_title
Use the filename to for the SMP title
Default: True
Type: bool

xlabel
Label to put under the x axis
Default: Force (mN)
Type: string

xlimits
Range in the X Axis to plot after all the settings above are applied
Default: None
Type: floatpair

ylabel
Label on the y axis
Default: Depth from surface (cm)
Type: string

ylimits
Range of depths in cm to plot after all the settings above are applied
Default: None
Type: floatpair

hand_hardness

filename
Filename to be plotted
Default: None
Type: criticalfilename

fill_color
Decimal RGB Color to fill the plot if fill is used
Default: 0.603 0.6 0.84 1
Type: float

line_color

Default: 0.0 0.0 0.0 1
Type: float

plot_id
Location of plot left to right starting with 1
Default: 1
Type: int

plot_labels
a list of tuples containing labels to add to the plot
Default: None
Type: string

problem_layer
Depth in centimeters to place a red horizontal line on the plot.
Default: None
Type: float

remove_xticks
Whether or not to use the xtick labels
Default: False
Type: bool

title
Plot title for the hand hardness profile
Default: Hand Hardness
Type: string

use_filename_title
Use the filename to for the subplot title
Default: False
Type: bool

xlabel
Label to put under the x axis
Default: Hand Hardness
Type: string

xlimits
Range in the X Axis to plot after all the settings above are applied
Default: 0 19
Type: floatpair

ylabel
Label on the y axis
Default: Depth from surface (cm)
Type: string

ylimits
Range of depths in cm to plot after all the settings above are applied
Default: None
Type: floatpair

grain_size

filename
Filename to be plotted
Default: None
Type: criticalfilename

fill_color
Decimal RGB Color to fill the plot if fill is used
Default: 0.635 0.278 0.690
Type: float

line_color

Default: 0.0 0.0 0.0 1
Type: float

plot_id
Location of plot left to right starting with 1
Default: 1
Type: int

plot_labels
a list of tuples containing labels to add to the plot
Default: None
Type: string

problem_layer
Depth in centimeters to place a red horizontal line on the plot.
Default: None
Type: float

remove_xticks
Whether or not to use the xtick labels
Default: False
Type: bool

title
Plot title for the hand hardness profile
Default: Grain Size
Type: string

use_filename_title
Use the filename to for the subplot title
Default: False
Type: bool

xlabel
Label to put under the x axis
Default: Observed Grain Size
Type: string

xlimits
Range in the X Axis to plot after all the settings above are applied
Default: 0 5
Type: floatpair

ylabel
Label on the y axis
Default: Depth from surface (cm)
Type: string

ylimits
Range of depths in cm to plot after all the settings above are applied
Default: None
Type: floatpair

output

dpi
Resolution of the image to produce
Default: 100
Type: int

figure_size
Must be a list of two items specifying figure size in inches
Default: 6 10
Type: float

filename
filename for the outputted figure
Default: None
Type: string

output_dir
Location to save figures
Default: ./output
Type: directory

show_plot
Show the plot to be outputted
Default: True
Type: bool

suptitle
Over arching title on the figure.
Default: None
Type: string

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

You can contribute in many ways:

Types of Contributions

Report Bugs

Report bugs at https://github.com/micahjohnson150/snowplot/issues.

If you are reporting a bug, please include:

  • Your operating system name and version.

  • Any details about your local setup that might be helpful in troubleshooting.

  • Detailed steps to reproduce the bug.

Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.

Implement Features

Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.

Write Documentation

snowplot could always use more documentation, whether as part of the official snowplot docs, in docstrings, or even on the web in blog posts, articles, and such.

Submit Feedback

The best way to send feedback is to file an issue at https://github.com/micahjohnson150/snowplot/issues.

If you are proposing a feature:

  • Explain in detail how it would work.

  • Keep the scope as narrow as possible, to make it easier to implement.

  • Remember that this is a volunteer-driven project, and that contributions are welcome :)

Get Started!

Ready to contribute? Here’s how to set up snowplot for local development.

  1. Fork the snowplot repo on GitHub.

  2. Clone your fork locally:

    $ git clone git@github.com:your_name_here/snowplot.git
    
  3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:

    $ mkvirtualenv snowplot
    $ cd snowplot/
    $ python setup.py develop
    
  4. Create a branch for local development:

    $ git checkout -b name-of-your-bugfix-or-feature
    

    Now you can make your changes locally.

  5. When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:

    $ flake8 snowplot tests
    $ python setup.py test or pytest
    $ tox
    

    To get flake8 and tox, just pip install them into your virtualenv.

  6. Commit your changes and push your branch to GitHub:

    $ git add .
    $ git commit -m "Your detailed description of your changes."
    $ git push origin name-of-your-bugfix-or-feature
    
  7. Submit a pull request through the GitHub website.

Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

  1. The pull request should include tests.

  2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.

  3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check https://travis-ci.com/micahjohnson150/snowplot/pull_requests and make sure that the tests pass for all supported Python versions.

Tips

To run a subset of tests:

$ pytest tests.test_snowplot

Deploying

A reminder for the maintainers on how to deploy. Make sure all your changes are committed (including an entry in HISTORY.rst). Then run:

$ bump2version patch # possible: major / minor / patch
$ git push
$ git push --tags

Travis will then deploy to PyPI if tests pass.

Credits

Development Lead

Contributors

None yet. Why not be the first?

History

0.1.0 (2020-02-10)

  • First release on PyPI.

Indices and tables