-
Notifications
You must be signed in to change notification settings - Fork 11
Fix complex int16 dn dtype slc #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix complex int16 dn dtype slc #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice !
Can you use a dict mapping instead of an 'if' ?
@@ -433,7 +432,11 @@ def _load_digital_number(self, resolution=None, chunks=None, resampling=rasterio | |||
# sort chunks keys like map_dims | |||
chunks = dict(sorted(chunks.items(), key=lambda pair: list(map_dims.keys()).index(pair[0]))) | |||
chunks_rio = {map_dims[d]: chunks[d] for d in map_dims.keys()} | |||
|
|||
riot_dtyp = rio.dtypes[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Grouny , can you replace with:
try:
rio_dtyp = self._rio_dtypes[rio.dtypes[0]]
except KeyError:
rio_dtyp = rio.dtypes[0]
and define:
self._rio_dtypes = {'complex_int16' : 'complex'}
somewhere in init ?
@@ -479,11 +482,13 @@ def _load_digital_number(self, resolution=None, chunks=None, resampling=rasterio | |||
rio.height // resolution['atrack'] * resolution['atrack']) | |||
|
|||
if self.s1meta.driver == 'GTiff': | |||
logging.info('rio dtypes zero: %s',rio.dtypes[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be removed if it's works as expected.
Hi, xr.open_dataset(f,chunks=chunks_rio, parse_coordinates=False,engine='rasterio') this syntax benefits from xr.open_rasterio(f, chunks=chunks_rio, parse_coordinates=False) is not working for SLC data. |
Yes, it would be nice to drop xr.open_rasterio in favor of rioxarray in xsar. So for now, I think that this PR is the best solution. |
Going back on this PR, I cannot find the internal types to decode the .tiff files for SLC products since it is now integrated in the |
It's seems that this problem has been fixed upstream in rasterio. @agrouaze , are you ok to close this PR without merge ? |
Ok to close this PR without merge. |
small fix to allow
rasterio
complex_int16
to be interpreted asnp.complex_
in order to fix the dtype casting error in case of coarse resolution options on SLC (complex Digital Number).For instance
xsar.open_dataset(wv_slc_meta.subdatasets[good_indice],resolution=resolutionZ,resampling=rasterio.enums.Resampling.rms)
is now possible.
Note that rasterio will be probably replaced by rioxarray in xarray backends: pydata/xarray#5491