pub mod bicubic;
pub mod bilinear;
pub mod common;
pub mod nearest;
use crate::error::Result;
pub trait Interpolator {
fn interpolate(&self, data: &[f32], shape: &[usize], indices: &[f64]) -> Result<f32>;
fn name(&self) -> &str;
}
pub fn get_interpolator(name: &str) -> Result<Box<dyn Interpolator>> {
match name.to_lowercase().as_str() {
"nearest" => Ok(Box::new(nearest::NearestInterpolator)),
"bilinear" => Ok(Box::new(bilinear::BilinearInterpolator)),
"bicubic" => Ok(Box::new(bicubic::BicubicInterpolator)),
_ => Err(crate::error::RossbyError::InvalidParameter {
param: "interpolation".to_string(),
message: format!("Unknown interpolation method: {}", name),
}),
}
}