geoarray issueshttps://git.gfz-potsdam.de/danschef/geoarray/-/issues2023-10-18T22:49:55+02:00https://git.gfz-potsdam.de/danschef/geoarray/-/issues/42Set higher regrid_shape when res_factor=1 is set for show_map2023-10-18T22:49:55+02:00Xin ZhangSet higher regrid_shape when res_factor=1 is set for show_mapAs discussed [here](https://github.com/SciTools/cartopy/issues/1415), the image will be downsampled by default. Because `res_factor=1` aims to plot the data in original resolution, we can set it like this:
```
if res_factor == 1:...As discussed [here](https://github.com/SciTools/cartopy/issues/1415), the image will be downsampled by default. Because `res_factor=1` aims to plot the data in original resolution, we can set it like this:
```
if res_factor == 1:
regrid_shape = 3000
else:
regrid_shape = None
ax.imshow(image2plot, cmap=palette, interpolation=interpolation, vmin=vmin, vmax=vmax,
regrid_shape=regrid_shape,......
.....
```https://git.gfz-potsdam.de/danschef/geoarray/-/issues/39Some missing ENVI metadata keys when running GeoArray.save with newer GDAL ve...2023-11-03T18:12:19+01:00Daniel SchefflerSome missing ENVI metadata keys when running GeoArray.save with newer GDAL versions.Observed with gdal 3.6.2. Tests are failing in https://git.gfz-potsdam.de/danschef/geoarray/-/jobs/200001.Observed with gdal 3.6.2. Tests are failing in https://git.gfz-potsdam.de/danschef/geoarray/-/jobs/200001.Daniel SchefflerDaniel Schefflerhttps://git.gfz-potsdam.de/danschef/geoarray/-/issues/35Band-specific nodata values not correctly updated2023-02-04T00:51:51+01:00Daniel SchefflerBand-specific nodata values not correctly updatedHere is an example:
```python
from geoarray import GeoArray
import numpy as np
# create a dummy dataset with nodata=0
gA = GeoArray(np.random.randint(0, 10, (5, 5)), nodata=0)
gA.save('/path/to/tmp.tif', fmt='GTIFF')
# read that datas...Here is an example:
```python
from geoarray import GeoArray
import numpy as np
# create a dummy dataset with nodata=0
gA = GeoArray(np.random.randint(0, 10, (5, 5)), nodata=0)
gA.save('/path/to/tmp.tif', fmt='GTIFF')
# read that dataset and overwrite the nodata value
gA2 = GeoArray('/path/to/tmp.tif', nodata=0).to_mem()
gA2.nodata = -9999
gA2.save('/path/to/out.tif', fmt='GTIFF')
```
Now the band-specific nodata value should be updated from 0 t0 -9999. However, it remains 0:
```bash
$ gdalinfo /path/to/out.tif
Driver: GTiff/GeoTIFF
Files: /path/to/out.tif
Size is 5, 5
Origin = (0.000000000000000,0.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Metadata:
data_ignore_value='-9999'
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0000000, 0.0000000)
Lower Left ( 0.0000000, -5.0000000)
Upper Right ( 5.0000000, 0.0000000)
Lower Right ( 5.0000000, -5.0000000)
Center ( 2.5000000, -2.5000000)
Band 1 Block=5x5 Type=Float64, ColorInterp=Gray
NoData Value=0
```
This causes, e.g., QGIS to not correctly recognize the nodata value.Daniel SchefflerDaniel Schefflerhttps://git.gfz-potsdam.de/danschef/geoarray/-/issues/34Automatically determine the driver from output file extension2021-11-15T12:29:58+01:00Xavier C. LlanoAutomatically determine the driver from output file extensionHi Daniel,
If I set the `path_out` as a tif file and the `fmt_out` is not set (by default ENVI) I get this error because the `geoarray` think that the driver is `ENVI` but not:
```bash
Warping progress |============================...Hi Daniel,
If I set the `path_out` as a tif file and the `fmt_out` is not set (by default ENVI) I get this error because the `geoarray` think that the driver is `ENVI` but not:
```bash
Warping progress |==================================================| 100.0% Complete => 0:00:01
Writing GeoArray of size (7555, 6784, 4) to /tmp/processing_NHLaRM/2a113a03f29847468fe423a1616b4df1/OUTPUT.tif.
Warning 6: driver ENVI does not support creation option WRITE_METADATA
Warning 6: driver ENVI does not support creation option WRITE_METADATA
Critical: Logged critical: Traceback (most recent call last):
File "/home/xavier/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Coregistration/automated_global_coregistration_algorithm.py", line 256, in processAlgorithm
CR.correct_shifts()
File "/home/xavier/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Coregistration/libs/arosics/CoReg.py", line 1723, in correct_shifts
self.deshift_results = DS.correct_shifts()
File "/home/xavier/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Coregistration/libs/arosics/DeShifter.py", line 415, in correct_shifts
out_geoArr.save(self.path_out, fmt=self.fmt_out, creationOptions=self.out_creaOpt)
File "/home/xavier/.local/lib/python3.9/site-packages/geoarray/baseclasses.py", line 1086, in save
gdal.Unlink(out_path + '.aux.xml')
File "/usr/lib/python3.9/site-packages/osgeo/gdal.py", line 1682, in Unlink
return _gdal.Unlink(*args)
RuntimeError: unknown error occurred
```
I know that the solution is let the user define the driver with that arg, but a better solution is automatically determine the driver from output file extension, and with that, the `fmt_out` is not necessary (or maybe yes but for specific cases, but by default could by `auto`). There are good examples and easy to implement for that, check this (the issue and its respective PR):
https://github.com/rasterio/rasterio/issues/265
https://github.com/rasterio/rasterio/pull/2008/fileshttps://git.gfz-potsdam.de/danschef/geoarray/-/issues/20Add automatic updating of no-data mask in case GeoArray.__setitem__() receive...2019-01-21T14:58:37+01:00Daniel SchefflerAdd automatic updating of no-data mask in case GeoArray.__setitem__() receives an array including nodata values.```python
gA = GeoArray(ndarray, nodata=-9999)
gA.calc_mask_nodata()
# set parts of the GeoArray to nodata
gA[:4, :] = -9999
```
=> nodata mask is not updated, we have to do that manually```python
gA = GeoArray(ndarray, nodata=-9999)
gA.calc_mask_nodata()
# set parts of the GeoArray to nodata
gA[:4, :] = -9999
```
=> nodata mask is not updated, we have to do that manuallyDaniel SchefflerDaniel Schefflerhttps://git.gfz-potsdam.de/danschef/geoarray/-/issues/19GeoArray.show() crashes in case of very large rasters2018-09-17T14:01:34+02:00Daniel SchefflerGeoArray.show() crashes in case of very large rastersThis is caused by https://gitext.gfz-potsdam.de/danschef/py_tools_ds/issues/4.
A workaround is to set GeoArray.show(res_factor=1).This is caused by https://gitext.gfz-potsdam.de/danschef/py_tools_ds/issues/4.
A workaround is to set GeoArray.show(res_factor=1).Daniel SchefflerDaniel Schefflerhttps://git.gfz-potsdam.de/danschef/geoarray/-/issues/14Some properties of a GeoArray get lost when doing GeoArray(*warp_ndarray(...))2018-08-06T16:26:47+02:00Mathias BochowSome properties of a GeoArray get lost when doing GeoArray(*warp_ndarray(...))Here is a notebook for testing and debugging:
/misc/hy8/HySpex_Labor/Sentinelprojekt/Elbe/2015-08_Anna-Lisa/MikroPP/Debugging_lost_metadata_and_projection.ipynb
Look for the ### comments ### in this notebook!
Thanks!
```python
------...Here is a notebook for testing and debugging:
/misc/hy8/HySpex_Labor/Sentinelprojekt/Elbe/2015-08_Anna-Lisa/MikroPP/Debugging_lost_metadata_and_projection.ipynb
Look for the ### comments ### in this notebook!
Thanks!
```python
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-23-f6e220219165> in <module>()
13 print(slice(wp_x_left_final,wp_x_right_final,1))
14
---> 15 middleImGeoArrayCut = middleImGeoArrayRect.get_subset(xslice=slice(wp_x_left_final,wp_x_right_final,1))
16
17 print(middleImGeoArrayRect.cols)
/service/soft/local/pytools/scheffler/geoarray/geoarray/baseclasses.py in get_subset(self, xslice, yslice, zslice, return_GeoArray, reset_bandnames)
1442 sub_gA = GeoArray(sub_arr, sub_gt, self.prj,
1443 bandnames=bNs_out, nodata=self.nodata, progress=self.progress, q=self.q)
-> 1444 sub_gA.meta = meta_out
1445 sub_gA.filePath = self.filePath
1446
/service/soft/local/pytools/scheffler/py_tools_ds/py_tools_ds/convenience/object_oriented.py in <lambda>(self, val)
6 return property(
7 lambda self: getattr(self, key),
----> 8 lambda self, val: setattr(self, key, val),
9 lambda self: delattr(self, key))
/service/soft/local/pytools/scheffler/geoarray/geoarray/baseclasses.py in metadata(self, GDF)
514 assert isinstance(GDF, (GeoDataFrame, DataFrame)) and len(GDF.columns) == self.bands, \
515 "%s.metadata can only be set with an instance of geopandas.GeoDataFrame of which the column number " \
--> 516 "corresponds to the band number of %s." % (self.__class__.__name__, self.__class__.__name__)
517 self._metadata = GDF
518
AssertionError: GeoArray.metadata can only be set with an instance of geopandas.GeoDataFrame of which the column number corresponds to the band number of GeoArray.
```https://git.gfz-potsdam.de/danschef/geoarray/-/issues/9geoarray.masks.CloudMask returns float322017-08-29T15:36:53+02:00Andre Hollsteingeoarray.masks.CloudMask returns float32![image](/uploads/4fcfc253960e6f901104c442383bfd45/image.png)![image](/uploads/4fcfc253960e6f901104c442383bfd45/image.png)Daniel SchefflerDaniel Schefflerhttps://git.gfz-potsdam.de/danschef/geoarray/-/issues/1Some metadata in the xml files is not parsed to the corrected files.2017-11-14T21:00:47+01:00Hannes DiedrichSome metadata in the xml files is not parsed to the corrected files.We should talk about that at some point (easer than write it down here, maybe todo on my side)We should talk about that at some point (easer than write it down here, maybe todo on my side)Daniel SchefflerDaniel Scheffler