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

//
// Public API
//
pub use crate::archive::{Archive, StationSummary};
pub use crate::errors::BufkitDataErr;
pub use crate::models::Model;
pub use crate::site::{SiteInfo, StateProv, StationNumber};

#[cfg(feature = "pylib")]
mod py_lib;

//
// Implementation only
//
mod archive;
mod coords;
mod errors;
mod models;
mod site;