Describe the bug
rasterize() accepts invalid values for resolution and chunks instead of rejecting them.
resolution:
resolution=-1 produces a 1x1 raster
resolution=inf produces a 1x1 raster
resolution=0 raises ZeroDivisionError
resolution=nan raises an opaque integer conversion error
chunks:
chunks=0 hangs the process. _normalize_chunks() loops while remaining > 0 and subtracts min(rchunk, remaining) from remaining. With rchunk=0 the subtraction is zero and the loop never terminates.
- Negative
chunks makes remaining grow without bound.
Expected behavior
Validate resolution is finite and > 0 before any dimension math, with a clear ValueError. Validate chunks > 0 at the top of _normalize_chunks().
Files: xrspatial/rasterize.py:2230, xrspatial/rasterize.py:1520
Describe the bug
rasterize()accepts invalid values forresolutionandchunksinstead of rejecting them.resolution:resolution=-1produces a 1x1 rasterresolution=infproduces a 1x1 rasterresolution=0raisesZeroDivisionErrorresolution=nanraises an opaque integer conversion errorchunks:chunks=0hangs the process._normalize_chunks()loopswhile remaining > 0and subtractsmin(rchunk, remaining)fromremaining. Withrchunk=0the subtraction is zero and the loop never terminates.chunksmakesremaininggrow without bound.Expected behavior
Validate
resolutionis finite and> 0before any dimension math, with a clearValueError. Validatechunks > 0at the top of_normalize_chunks().Files:
xrspatial/rasterize.py:2230,xrspatial/rasterize.py:1520