z_idx

Function z_idx 

Source
pub fn z_idx(
    xi: usize,
    yi: usize,
    xlen: usize,
    ylen: usize,
) -> Result<usize, DomainError>
Expand description

Returns the index corresponding to the grid point (i, j). The index is given by j*len(x) + i

§Important

The za array is indexed in column-major style (Fortran style), so it must be defined accordingly.

§Example

let xa = [0.0, 1.0];
let ya = [0.0, 2.0];
let za = [
    0.0, 1.0, // <- This one
    2.0, 3.0,
];
let za_index = z_idx(0, 1, xa.len(), ya.len())?;
assert_eq!(za_index, 2);
}