geowombat
geowombat copied to clipboard
Reading Tiff : ValueError: negative dimensions are not allowed
Hi dear When trying to open my tiff file, I get this error: ValueError: negative dimensions are not allowed code: with gw.open(mytif) as src: print(src)
File "/home/---/.local/lib/python3.8/site-packages/geowombat/core/api.py", line 493, in init self.data = warp_open( File "/home/---/.local/lib/python3.8/site-packages/geowombat/backends/xarray_.py", line 271, in warp_open with open_rasterio( File "/home/---/.local/lib/python3.8/site-packages/geowombat/backends/xarray_rasterio_.py", line 316, in open_rasterio x, _ = riods.transform * (np.arange(nx) + 0.5, np.zeros(nx) + 0.5) ValueError: negative dimensions are not allowed
The same tiff file can be read easily using rasterio, gdal... by with geowombat it's not possible Thanks
Can you print the transform, shape and CRS?
On Fri, Jul 8, 2022, 4:19 AM Hajji Hicham @.***> wrote:
Hi dear When trying to open my tiff file, I get this error: ValueError: negative dimensions are not allowed code: with gw.open(mytif) as src: print(src)
File "/home/---/.local/lib/python3.8/site-packages/geowombat/core/api.py", line 493, in init self.data = warp_open( File "/home/---/.local/lib/python3.8/site-packages/geowombat/backends/xarray_.py", line 271, in warp_open with open_rasterio( File "/home/---/.local/lib/python3.8/site-packages/geowombat/backends/xarray_rasterio_.py", line 316, in open_rasterio x, _ = riods.transform * (np.arange(nx) + 0.5, np.zeros(nx) + 0.5) ValueError: negative dimensions are not allowed
The same tiff file can be read easily using rasterio, gdal... by with geowombat it's not possible Thanks
— Reply to this email directly, view it on GitHub https://github.com/jgrss/geowombat/issues/174, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHR6VBBDTRRTTJNKWR2OALVS7QCZANCNFSM53AFDCSQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
transform (-0.015703125000000002, 0.0, -1.02, 0.0, -0.014794921875000002, 35.92) shape (1, 1024, 1024) crs +init=epsg:4326
It's pretty unusual to have a negative xres, @jgrss likely didn't set it up to handle this.
If you have a moment, could you write it back out with rasterio and change the transform to transform (0.015703125000000002, 0.0, -1.02, 0.0, -0.014794921875000002, 35.92)
That would help us clarify what we need to resolve.
On Fri, Jul 8, 2022 at 9:32 AM Hicham2022 @.***> wrote:
transform (-0.015703125000000002, 0.0, -1.02, 0.0, -0.014794921875000002, 35.92) shape (1, 1024, 1024) crs +init=epsg:4326
— Reply to this email directly, view it on GitHub https://github.com/jgrss/geowombat/issues/174#issuecomment-1178994397, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHR6VGOC35SDVPIDRLSRILVTAUXBANCNFSM53AFDCSQ . You are receiving this because you commented.Message ID: @.***>
@hicham20212022 this shouldn't be much trouble to add support for. The geowombat opener uses rasterio, so the issue is with generating the DataArray coordinates (which, as @mmann1123 points out, assumes the x resolution is positive). Should be an easy fix...
@hicham20212022 Can you see if the following branch resolves your issue? jgrss/xres_issue174
I suspect that not only is the xres negative but your data is mirrored on the yaxis which I am not sure we are handling.
Please let us know either way.
I am closing this because of inactivity. @hicham20212022 feel free to reopen if you want to revisit.