Function wafer::input::read_csv [−][src]
fn read_csv(
file: &str,
target_size: [usize; 3],
bb: usize,
log: &Logger
) -> Result<Array3<R64>, Error>
Given a filename, this function reads in the data of a csv file and parses the values into a 3D array. There are a few caveats to this as the file may be of a different shape to the requested size in the configuration file. The routine therefore attempts to resample/interpolate the data to fit the required parameters.
Arguments
file
- A filename wrapped in an option. This function is called from filename parsers which may not be able to obtain a valid location.target_size
- Requested size of the resultant array. If this size does not match the data pulled from the file, interpolation or resampling will occur.
Returns
- A 3D array loaded with data from the file and resampled/interpolated if required.
If something goes wrong in the parsing or file handling, a
csv::Error
is passed.