Skip to content

Commit 89068a4

Browse files
committed
fixing a bug
1 parent e1d623f commit 89068a4

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/core.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ use crate::affines::Affine;
99
use crate::utils;
1010
use crate::distance;
1111

12+
1213
pub fn similarityrs(
1314
x: &Array2<f32>,
1415
trans: &Affine,
1516
is_geo: bool,
1617
bandwidth: f64,
1718
radius: Option<f32>,
1819
nsample: usize,
20+
ncols: usize,
1921
seed: u64
2022
) -> Result<Vec<f64>> {
2123
let (rows, cols) = x.dim();
@@ -27,7 +29,7 @@ pub fn similarityrs(
2729
let data = x.as_slice().context("Array not contiguous")?;
2830

2931
// Get the XY for distance calc
30-
let xy: Vec<(f64, f64)> = utils::get_xy(data.len(), cols, trans)?;
32+
let xy: Vec<(f64, f64)> = utils::get_xy(data.len(), ncols, trans)?;
3133

3234
// Pre-calc valid cells to skip processing nan cells
3335
let valid_rows: Vec<usize> = (0..rows)

src/distance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ pub fn distance_km(x1: f64, y1: f64, x2: f64, y2: f64, geo: bool) -> f32 {
3030
euclidean(x1, y1, x2, y2)
3131
};
3232

33-
(dist / 1000.0) as f32
33+
(dist / 1000.0) as f32
3434
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn similaritypy(
3434
.map_err(|e| PyRuntimeError::new_err(e.to_string()))?;
3535

3636
let out: Vec<f64> = pool
37-
.install(|| core::similarityrs(&array, &affine, is_geo, bandwidth, radius, nsample, seed))
37+
.install(|| core::similarityrs(&array, &affine, is_geo, bandwidth, radius, nsample, ncols, seed))
3838
.map_err(|er| PyRuntimeError::new_err(format!("Climsim failed: {er}")))?;
3939

4040
let outarray: Array2<f64> = Array2::from_shape_vec((nrows, ncols), out)

0 commit comments

Comments
 (0)