In [1]: import rioxarray as rio
In [2]: import numpy as np
In [3]: import xarray as xr
In [4]: x = np.zeros((4,2400), dtype=np.float64)
In [5]: xd = xr.DataArray(x, dims=('detectors', 'rows_an'))
In [6]: xd.rio.set_spatial_dims(x_dim=xd.dims[1], y_dim=xd.dims[0])
Out[6]:
<xarray.DataArray (detectors: 4, rows_an: 2400)>
array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]])
Dimensions without coordinates: detectors, rows_an
In [7]: xd.rio.to_raster("/tmp/issue.cog", tiled=True, driver="COG", dtype=xd.dtype)
/home/abecheru/.local/lib/python3.9/site-packages/rasterio/__init__.py:230: NotGeoreferencedWarning: The given matrix is equal to Affine.identity or its flipped counterpart. GDAL may ignore this matrix and save no geotransform without raising an error. This behavior is somewhat driver-specific.
s = writer(path, mode, driver=driver,
Floating point exception (core dumped)
Problem description
On trying to write a two dimensional array with zeros in float64 as COG a Floating point exception is raised.
Code Sample, a copy-pastable example if possible
Problem description
On trying to write a two dimensional array with zeros in float64 as COG a Floating point exception is raised.
Expected Output
A COG file.
Environment Information
abecheru@abecheru-OptiPlex-3010:~/wrk/eopf-cpm$ python -c "import rioxarray; rioxarray.show_versions()" rioxarray (0.12.0) deps: rasterio: 1.2.10 xarray: 2022.6.0 GDAL: 3.3.2 GEOS: None PROJ: None PROJ DATA: None GDAL DATA: None
Other python deps: scipy: 1.9.0 pyproj: 3.3.1
System: python: 3.9.13 (main, May 23 2022, 21:57:12) [GCC 11.2.0] executable: /usr/bin/python machine: Linux-5.15.0-47-generic-x86_64-with-glibc2.35
Installation method
pip