Skip to content

Commit

Permalink
Merge pull request #7 from bluss/ndarray-0.11
Browse files Browse the repository at this point in the history
Use ndarray 0.11
  • Loading branch information
evomassiny committed Dec 29, 2017
2 parents 56ffbbe + c67df52 commit f858f33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords = ["netcdf", "hdf", "hdf5", "libnetcdf", "netcdf4"]
[dependencies]
libc = "0.2"
lazy_static = "0.1.11"
ndarray = "0.9.1"
ndarray = "0.11.0"

[dependencies.netcdf-sys]
path = "netcdf-sys"
8 changes: 3 additions & 5 deletions src/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use attribute::{init_attributes, Attribute};
use string_from_c_str;
use NC_ERRORS;
use std::error::Error;
use ndarray::{Array1,ArrayD};
use ndarray::{ArrayD};
use libc;

macro_rules! get_var_as_type {
Expand Down Expand Up @@ -430,8 +430,7 @@ impl Variable {
dims.push(dim.len as usize);
}
let values = self.values()?;
let array = Array1::<T>::from_vec(values);
Ok(array.into_shape(dims)?)
Ok(ArrayD::<T>::from_shape_vec(dims, values)?)
}

/// Fetchs variable slice as a ndarray.
Expand All @@ -441,8 +440,7 @@ impl Variable {
dims.push(dim.len as usize);
}
let values = self.values_at(indices, slice_len)?;
let array = Array1::<T>::from_vec(values);
Ok(array.into_shape(slice_len)?)
Ok(ArrayD::<T>::from_shape_vec(slice_len, values)?)
}

/// Put a single value at `indices`
Expand Down

0 comments on commit f858f33

Please sign in to comment.