Skip to main content

oxigdal_sensors/
lib.rs

1//! OxiGDAL Sensors - Remote Sensing and Satellite Sensor Data Processing
2//!
3//! This crate provides comprehensive support for remote sensing and satellite sensor data processing,
4//! including sensor definitions, radiometric corrections, spectral indices, and image classification.
5//!
6//! # Features
7//!
8//! ## Sensor Support
9//!
10//! Comprehensive sensor definitions for major satellite platforms:
11//! - **Landsat**: 5 TM, 7 ETM+, 8/9 OLI/TIRS
12//! - **Sentinel**: 2 MSI (optical), 1 SAR
13//! - **MODIS**: Terra/Aqua (36 bands)
14//! - **ASTER**: VNIR, SWIR, and TIR subsystems
15//!
16//! ```
17//! use oxigdal_sensors::sensors::landsat;
18//!
19//! let sensor = landsat::landsat8_oli_tirs();
20//! assert_eq!(sensor.bands.len(), 11);
21//!
22//! let red_band = sensor.get_band_by_common_name("Red");
23//! assert!(red_band.is_some());
24//! ```
25//!
26//! ## Radiometric Calibration
27//!
28//! Convert Digital Numbers (DN) to physical units:
29//!
30//! ```
31//! use oxigdal_sensors::radiometry::calibration::{RadiometricCalibration, earth_sun_distance};
32//! use scirs2_core::ndarray::array;
33//!
34//! let cal = RadiometricCalibration::new(0.00002, 0.0)
35//!     .with_solar_irradiance(1554.0);
36//!
37//! let dn = array![[1000.0, 2000.0], [3000.0, 4000.0]];
38//! let radiance = cal.dn_to_radiance(&dn.view());
39//!
40//! let doy = earth_sun_distance(180);
41//! assert!(doy.is_ok());
42//! ```
43//!
44//! ## Atmospheric Correction
45//!
46//! Multiple atmospheric correction methods:
47//!
48//! ```
49//! use oxigdal_sensors::radiometry::atmospheric::{DarkObjectSubtraction, AtmosphericCorrection};
50//! use scirs2_core::ndarray::array;
51//!
52//! let dos = DarkObjectSubtraction::default_params();
53//! let toa = array![[0.05, 0.10], [0.15, 0.20]];
54//!
55//! let corrected = dos.correct(&toa.view());
56//! assert!(corrected.is_ok());
57//! ```
58//!
59//! ## Spectral Indices (20+)
60//!
61//! Comprehensive collection of spectral indices:
62//!
63//! ### Vegetation Indices
64//! - NDVI, EVI, EVI2, SAVI, MSAVI, OSAVI
65//! - GNDVI, GRVI, CI (Chlorophyll Index)
66//! - NDWI, NDMI (water content)
67//!
68//! ```
69//! use oxigdal_sensors::indices::vegetation::{ndvi, evi, savi};
70//! use scirs2_core::ndarray::array;
71//!
72//! let nir = array![[0.5, 0.6], [0.7, 0.8]];
73//! let red = array![[0.1, 0.1], [0.1, 0.1]];
74//!
75//! let ndvi_result = ndvi(&nir.view(), &red.view());
76//! assert!(ndvi_result.is_ok());
77//!
78//! let blue = array![[0.05, 0.05], [0.05, 0.05]];
79//! let evi_result = evi(&nir.view(), &red.view(), &blue.view());
80//! assert!(evi_result.is_ok());
81//! ```
82//!
83//! ### Burn Indices
84//! - nbr, d_nbr, nbr2
85//!
86//! ```
87//! use oxigdal_sensors::indices::burn::{nbr, d_nbr};
88//! use scirs2_core::ndarray::array;
89//!
90//! let nir = array![[0.5, 0.6]];
91//! let swir2 = array![[0.2, 0.2]];
92//!
93//! let nbr_result = nbr(&nir.view(), &swir2.view());
94//! assert!(nbr_result.is_ok());
95//! ```
96//!
97//! ### Urban Indices
98//! - NDBI, UI, IBI
99//!
100//! ### Water Indices
101//! - MNDWI, AWEI, WRI
102//!
103//! ## Pan-Sharpening
104//!
105//! Multiple pan-sharpening algorithms:
106//! - Brovey Transform
107//! - IHS (Intensity-Hue-Saturation)
108//! - PCA (Principal Component Analysis)
109//!
110//! ## Image Classification
111//!
112//! - Unsupervised: K-Means, ISODATA
113//! - Supervised: Maximum Likelihood
114//!
115//! # COOLJAPAN Policy Compliance
116//!
117//! This crate adheres to COOLJAPAN ecosystem policies:
118//!
119//! - **Pure Rust**: 100% Pure Rust implementation, no C/Fortran dependencies
120//! - **No unwrap()**: All error cases are properly handled with `Result<T, E>`
121//! - **SciRS2 Integration**: Uses `scirs2-core` for scientific computing
122//! - **Comprehensive Error Handling**: Custom error types for all failure modes
123//! - **File Size Policy**: All source files are kept under 2000 lines
124//! - **Latest Crates**: Uses latest versions from crates.io
125//! - **Workspace Policy**: Follows workspace dependency management
126//!
127//! # Performance
128//!
129//! All algorithms are optimized for production use with:
130//! - Efficient memory usage
131//! - Vectorized operations using ndarray
132//! - Optional parallel processing (enable `parallel` feature)
133//! - Numerical stability checks
134//!
135//! # Safety
136//!
137//! This crate is designed with safety in mind:
138//! - No unsafe code (except what's in dependencies)
139//! - Comprehensive input validation
140//! - Proper handling of edge cases
141//! - Clear error messages for debugging
142
143#![warn(missing_docs)]
144#![warn(clippy::all)]
145// Pedantic disabled to reduce noise - default clippy::all is sufficient
146// #![warn(clippy::pedantic)]
147#![deny(clippy::unwrap_used)]
148#![deny(clippy::panic)]
149#![allow(clippy::module_name_repetitions)]
150#![allow(clippy::cast_precision_loss)]
151#![allow(clippy::cast_possible_truncation)]
152#![allow(clippy::cast_sign_loss)]
153#![allow(clippy::similar_names)]
154#![allow(clippy::too_many_lines)]
155#![allow(clippy::doc_markdown)]
156
157pub mod classification;
158pub mod error;
159pub mod indices;
160pub mod pan_sharpening;
161pub mod radiometry;
162pub mod sensors;
163
164// Re-export commonly used items
165pub use error::{Result, SensorError};
166
167/// Crate version
168pub const VERSION: &str = env!("CARGO_PKG_VERSION");
169
170/// Crate name
171pub const NAME: &str = env!("CARGO_PKG_NAME");
172
173#[cfg(test)]
174mod tests {
175    use super::*;
176
177    #[test]
178    fn test_version() {
179        assert!(!VERSION.is_empty());
180        assert_eq!(NAME, "oxigdal-sensors");
181    }
182}