Closed scottstanie closed 11 months ago
The gdal int8
was hardwired already, but not correctly. I like your approach in dolphin. Could you issue a PR for it in mintpy also?
We could still update the mapping dict, just for bookkeeping purposes.
Hi @yunjunz
I have installed mintpy and everything looks normal. However, when running it gets the following error. I'm not sure if it's related to GDAL, since I have it installed. Look forward to getting your hint.
raise ImportError('Cannot import gdal and osr!')
ImportError: Cannot import gdal and osr!
Hi @yunjunz
I have installed mintpy and everything looks normal. However, when running it gets the following error. I'm not sure if it's related to GDAL, since I have it installed. Look forward to getting your hint.
raise ImportError('Cannot import gdal and osr!') ImportError: Cannot import gdal and osr!
The error shows that your GDAL can not be imported.
Is there any suggestion what should I do ?
Meanwhile I check with the basic command such as gdalinfo
it's work.
Perhaps open a different issue about it? Although it is a very likely not a Mintpy issue, but rather a python setup problem with how you have installed GDAL
As I mentioned, I can ran gdal command without problem. However, may be my question not directly related to this threads and can be closed.
GDAL and GDAL's Python binding are two different things. Please ensure your gdal and mintpy are installed in the same Python environment, and gdal can be imported in that environment. This had been an issue a long time ago, but I have not seen it for many years now.
Thanks @yunjunz for the response.
Description of the problem
int8
data types were added in GDAL 3.7. These are being used by isce3 as the layover/shadow mask datatype. They're not recognizable by mintpy due to the hard coded mappings between GDAL and numpy datatypes.Full script that generated the error
Full error message
The one line fix
add
14: 'int8',
to theDATA_TYPE_GDAL2NUMPY
and'int8': 14
toDATA_TYPE_NUMPY2GDAL
another possible fix:
Alternative to the quick fix- take a function like these instead of the dict mappings: https://github.com/opera-adt/dolphin/blob/main/src/dolphin/utils.py#L69-L102 so that they use the GDAL functions