Skip to content

Fix as many test warnings as possible #831

@brendancol

Description

@brendancol

============ 468 passed, 320 warnings in 48.65s =============
xrspatial/tests/test_aspect.py: 1 warning
xrspatial/tests/test_classify.py: 2 warnings
xrspatial/tests/test_curvature.py: 1 warning
xrspatial/tests/test_focal.py: 9 warnings
xrspatial/tests/test_hillshade.py: 1 warning
xrspatial/tests/test_multispectral.py: 7 warnings
xrspatial/tests/test_slope.py: 1 warning
xrspatial/tests/test_viewshed.py: 4 warnings
/home/brendan/miniconda/envs/xrspatial-312/lib/python3.12/site-packages/numba_cuda/numba/cuda/dispatcher.py:696: NumbaPerformanceWarning: Grid size 1 will likely result in GPU under-utilization due to low occupancy.
warn(errors.NumbaPerformanceWarning(msg))

xrspatial/tests/test_classify.py::test_natural_breaks_not_enough_unique_values
/home/brendan/xarray-spatial/xrspatial/classify.py:612: Warning: natural_breaks Warning: Not enough unique values in data array for 18 classes. n_samples=17 should be >= n_clusters=18. Using k=17 instead.
warnings.warn('natural_breaks Warning: Not enough unique values '

xrspatial/tests/test_curvature.py: 264 warnings
/home/brendan/xarray-spatial/xrspatial/curvature.py:75: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
cellsize_arr = cupy.array([float(cellsize)], dtype='f4')

xrspatial/tests/test_focal.py::test_mean_transfer_function_gpu_equals_cpu
/home/brendan/miniconda/envs/xrspatial-312/lib/python3.12/site-packages/numba_cuda/numba/cuda/dispatcher.py:696: NumbaPerformanceWarning: Grid size 25 will likely result in GPU under-utilization due to low occupancy.
warn(errors.NumbaPerformanceWarning(msg))

xrspatial/tests/test_focal.py: 10 warnings
/home/brendan/miniconda/envs/xrspatial-312/lib/python3.12/site-packages/numba_cuda/numba/cuda/cudadrv/devicearray.py:934: NumbaPerformanceWarning: Host array used in CUDA kernel will incur copy overhead to/from device.
warn(NumbaPerformanceWarning(msg))

xrspatial/tests/test_focal.py::test_hotspots_zero_global_std
/home/brendan/xarray-spatial/xrspatial/focal.py:908: RuntimeWarning: invalid value encountered in divide
mean_array = convolve_2d(data, kernel / kernel.sum())

xrspatial/tests/test_hillshade.py::test_hillshade_rtx_with_shadows
/home/brendan/miniconda/envs/xrspatial-312/lib/python3.12/site-packages/numba_cuda/numba/cuda/dispatcher.py:696: NumbaPerformanceWarning: Grid size 16 will likely result in GPU under-utilization due to low occupancy.
warn(errors.NumbaPerformanceWarning(msg))

xrspatial/tests/test_pathfinding.py::test_a_star_search_with_barriers
xrspatial/tests/test_pathfinding.py::test_a_star_search_with_barriers
xrspatial/tests/test_pathfinding.py::test_a_star_search_with_barriers
xrspatial/tests/test_pathfinding.py::test_a_star_search_with_barriers
xrspatial/tests/test_pathfinding.py::test_a_star_search_with_barriers
xrspatial/tests/test_pathfinding.py::test_a_star_search_snap
xrspatial/tests/test_pathfinding.py::test_a_star_search_snap
/home/brendan/xarray-spatial/xrspatial/pathfinding.py:365: Warning: End at a non crossable location
warnings.warn("End at a non crossable location", Warning)

xrspatial/tests/test_pathfinding.py::test_a_star_search_snap
xrspatial/tests/test_pathfinding.py::test_a_star_search_snap
/home/brendan/xarray-spatial/xrspatial/pathfinding.py:357: Warning: Start at a non crossable location
warnings.warn("Start at a non crossable location", Warning)

xrspatial/tests/test_perlin.py::test_perlin_gpu
/home/brendan/miniconda/envs/xrspatial-312/lib/python3.12/site-packages/numba_cuda/numba/cuda/dispatcher.py:696: NumbaPerformanceWarning: Grid size 9 will likely result in GPU under-utilization due to low occupancy.
warn(errors.NumbaPerformanceWarning(msg))

xrspatial/tests/test_zonal.py::test_zone_ids_stats[dask+numpy]
xrspatial/tests/test_zonal.py::test_zone_ids_stats[dask+numpy]
/home/brendan/miniconda/envs/xrspatial-312/lib/python3.12/site-packages/dask/_task_spec.py:759: RuntimeWarning: invalid value encountered in divide
return self.func(*new_argspec)

xrspatial/tests/test_zonal.py::test_zone_ids_stats[dask+numpy]
xrspatial/tests/test_zonal.py::test_zone_ids_stats[dask+numpy]
/home/brendan/xarray-spatial/xrspatial/zonal.py:62: RuntimeWarning: All-NaN slice encountered
min=lambda block_mins: np.nanmin(block_mins, axis=0),

xrspatial/tests/test_zonal.py::test_zone_ids_stats[dask+numpy]
xrspatial/tests/test_zonal.py::test_zone_ids_stats[dask+numpy]
/home/brendan/xarray-spatial/xrspatial/zonal.py:61: RuntimeWarning: All-NaN slice encountered
max=lambda block_maxes: np.nanmax(block_maxes, axis=0),

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions