fn fix_habitat_map(habitat: &mut Array2D<u32>, dispersal: &Array2D<f64>) {
    for y in 0..habitat.num_rows() {
        for x in 0..habitat.num_columns() {
            let h_before = habitat[(y, x)];

            if h_before <= 1 {
                // If there is any dispersal from this location, it must be habitat
                let h_fixed = if dispersal
                    .row_iter(y * habitat.num_columns() + x)
                    .map_or(false, |mut it| it.any(|p| *p > 0.0_f64))
                {
                    1
                } else {
                    0
                };

                if h_fixed != h_before {
                    habitat[(y, x)] = h_fixed;

                    // warn!(
                    //     "Corrected habitat value {} to {} at ({},{}) to fit \
                    //      dispersal ...", h_before, h_fixed, x, y
                    // );
                }
            }
        }
    }
}
// Fix habitat rounding error by correcting 0/1 values to 0/1 based on dispersal
//  (can only disperse from habitat)
Fix habitat rounding error by correcting 0/1 values to 0/1 based on dispersal
(can only disperse from habitat)
Fix habitat rounding error by correcting 0 / 1 values to 0 / 1 based on dispersal ( can only disperse from habitat )
fn fix_habitat_map(habitat: &mut Array2D<u32>, dispersal: &Array2D<f64>) {
    for y in 0..habitat.num_rows() {
        for x in 0..habitat.num_columns() {
            let h_before = habitat[(y, x)];
            if h_before <= 1 {
                // If there is any dispersal from this location, it must be habitat
                let h_fixed = if dispersal
                    .row_iter(y * habitat.num_columns() + x)
                    .map_or(false, |mut it| it.any(|p| *p > 0.0_f64))
                {
                    1
                } else {
                    0
                };
                if h_fixed != h_before {
                    habitat[(y, x)] = h_fixed;
                    // warn!(
                    //     "Corrected habitat value {} to {} at ({},{}) to fit \
                    //      dispersal ...", h_before, h_fixed, x, y
                    // );
                }
            }
        }
    }
}
fn fix_habitat_map ( habitat : & mut Array2D < u32 > , dispersal : & Array2D < f64 > ) { for y in 0 .. habitat . num_rows ( ) { for x in 0 .. habitat . num_columns ( ) { let h_before = habitat [ ( y , x ) ] ; if h_before <= 1 { // If there is any dispersal from this location, it must be habitat let h_fixed = if dispersal . row_iter ( y * habitat . num_columns ( ) + x ) . map_or ( false , | mut it | it . any ( | p | * p > 0.0_f64 ) ) { 1 } else { 0 } ; if h_fixed != h_before { habitat [ ( y , x ) ] = h_fixed ; // warn!( //     "Corrected habitat value {} to {} at ({},{}) to fit \ //      dispersal ...", h_before, h_fixed, x, y // ); } } } } }
Fix habitat rounding error by correcting 0/1 values to 0/1 based on dispersal
(can only disperse from habitat)
Fix habitat rounding error by correcting 0 / 1 values to 0 / 1 based on dispersal ( can only disperse from habitat )
habitat
&mut Array2D<u32>
dispersal
&Array2D<f64>
habitat
&mut Array2D<u32>
dispersal
&Array2D<f64>