bufkit_data/
lib.rs

1//! Crate to manage and interface with an archive of
2//! [bufkit](https://training.weather.gov/wdtd/tools/BUFKIT/index.php) files.
3//!
4//! This supports a set of command line tools for utilizing the archive. In general, it may be
5//! useful to anyone interested in archiving bufkit files.
6//!
7//! The current implementation uses an [sqlite](https://www.sqlite.org/index.html) database to keep
8//! track of files stored in a common directory. The files are compressed, and so should only be
9//! accessed via the API provided by this crate.
10//!
11//! ## Python integration
12//! When compiled with the `pylib` feature it minimally supports access from Python. At this time it
13//! only supports reading files from the archive.
14//!
15//! For use with python, I recommend using a virtualenv and
16//! [maturin](https://github.com/pyo3/maturin). Once the virtualenv is activated,
17//! `pip install maturin` and install the bufkit_data package by going into the directory
18//! bufkit-data is cloned into and running:
19//!
20//! ```shell
21//! maturin develop --release --strip --cargo-extra-args="--features pylib"
22//!
23//! ```
24//!
25//! After this installation, you should be able to use `bufkit_data` from python with:
26//! ```python
27//! import bufkit_data as bd
28//!
29//! arch = bd.Archive("Path/to/my_archive")
30//! ord = arch.id_to_station_num("kord", "nam4km")
31//! most_recent_ord_nam = arch.most_recent(ord, "nam4km")
32//!
33//! from datetime import datetime as dt
34//! valid_time = dt(2020, 5, 5, 12, 0)
35//!
36//! ord = arch.id_to_station_num("kord", "gfs")
37//! old_ord_gfs = arch.retrieve_sounding(ord, "gfs", valid_time)
38//!
39//! ```
40#![deny(missing_docs)]
41
42//
43// Public API
44//
45pub use crate::archive::{Archive, StationSummary};
46pub use crate::errors::BufkitDataErr;
47pub use crate::models::Model;
48pub use crate::site::{SiteInfo, StateProv, StationNumber};
49
50#[cfg(feature = "pylib")]
51mod py_lib;
52
53//
54// Implementation only
55//
56mod archive;
57mod coords;
58mod errors;
59mod models;
60mod site;