umr-lops / xsar

Synthetic Aperture Radar (SAR) Level-1 GRD python mapper for efficient xarray/dask based processing
https://cyclobs.ifremer.fr/static/sarwing_datarmor/xsar/
MIT License
28 stars 8 forks source link

reader RS2 #161

Closed vincelhx closed 1 year ago

vincelhx commented 1 year ago

i got several issues while opening RS2 files.

xsar.RadarSat2Dataset(meta, resolution='1000m')

donne : 

ValueError Traceback (most recent call last) Cell In[20], line 1 ----> 1 xsar_obj_1000m = fct_dataset(meta, resolution='1000m')

File ~/libs_last/xsar/src/xsar/radarsat2_dataset.py:219, in RadarSat2Dataset.init(failed resolving arguments) 217 if rasters is not None: 218 self._dataset = xr.merge([self._dataset, rasters]) --> 219 self._dataset = xr.merge([self.interpolate_times, self._dataset]) 220 if 'ground_heading' not in skip_variables: 221 self._dataset = xr.merge([self.load_ground_heading(), self._dataset])

File ~/libs_last/xsar/src/xsar/radarsat2_dataset.py:623, in RadarSat2Dataset.interpolate_times(self) 621 samples = self.sar_meta.geoloc.pixel 622 time_values_2d = np.tile(times, (samples.shape[0], 1)).transpose() --> 623 interp_func = RectBivariateSpline(x=lines, y=samples, z=time_values_2d.astype(float), kx=1, ky=1) 624 da_var = map_blocks_coords( 625 self._da_tmpl.astype('datetime64[ns]'), 626 interp_func 627 ) 628 return da_var.isel(sample=0).to_dataset(name='time')

File /home1/datawork/vlheureu/conda-env/xsar_N/lib/python3.10/site-packages/scipy/interpolate/fitpack2.py:1494, in RectBivariateSpline._init(self, x, y, z, bbox, kx, ky, s) 1492 raise ValueError('y must be strictly increasing') 1493 if not x.size == z.shape[0]: -> 1494 raise ValueError('x dimension of z must have same number of ' 1495 'elements as x') 1496 if not y.size == z.shape[1]: 1497 raise ValueError('y dimension of z must have same number of ' 1498 'elements as y')

ValueError: x dimension of z must have same number of elements as x

other files reproduce this error

- missing BroseImage.tif : 

FileNotFoundError Traceback (most recent call last) Cell In[17], line 4 2 out_folder = "/home1/datahome/vlheureu/IFREMER/prod/L2_GRD/tests_files/" 3 out_file = out_folder + os.path.basename(inputfile) + "/output.nc" ----> 4 makeL2(inputfile,out_file,config_file)

File ~/IFREMER/prod/L2_GRD/inversion.py:72, in makeL2(filename, out_file, config_path) 67 raise FileNotFoundError('config_path do not exists, got %s ' % config_path) 70 # 2 - Add raster and load dataset at 1km resoltuion ---> 72 meta = fct_meta(filename) 74 # land mask 75 #fameta.set_mask_feature('land', '/home/datawork-cersat-public/cache/public/ftp/project/sarwing/xsardata/land-polygons-split-4326/land_polygons.shp') 77 meta.set_raster('ecmwf_0100_1h','/home/datawork-cersat-public/provider/ecmwf/forecast/hourly/0100deg/netcdf_light_REPRO_tree/%Y/%j/ECMWF_FORECAST0100%Y%m%d%H%M_10U_10V.nc')

File ~/libs_last/xsar/src/xsar/utils.py:99, in timing..wrapper(*args, *kwargs) 97 startrss = process.memory_info().rss 98 starttime = time.time() ---> 99 result = f(args, **kwargs) 100 endtime = time.time() 101 if mem_monitor:

File ~/libs_last/xsar/src/xsar/radarsat2_meta.py:37, in RadarSat2Meta.init(self, name) 35 self.dt = rs2_reader(name.split(':')[1]) 36 else: ---> 37 self.dt = rs2_reader(name) 38 if not name.startswith('RADARSAT2_DS:'): 39 name = 'RADARSAT2_DS:%s:' % name

File /home1/datawork/vlheureu/conda-env/xsar_N/lib/python3.10/site-packages/xradarsat2/radarSat2_xarray_reader.py:2154, in rs2_reader(folder_path) 2140 """ 2141 Principal function of the reader, that create a datatree with all the product.xml and lut xml files dataset 2142 (...) 2151 datatree containing every dataset 2152 """ 2153 # Verify if the product is complete -> 2154 verify_hierarchy_product(folder_path) 2156 # get product.xml path 2157 product_xml_path = os.path.join(folder_path, "product.xml")

File /home1/datawork/vlheureu/conda-env/xsar_N/lib/python3.10/site-packages/xradarsat2/radarSat2_xarray_reader.py:2134, in verify_hierarchy_product(folder_path) 2132 list_file = glob.glob(entire_file_path) 2133 if len(list_file) == 0: -> 2134 raise FileNotFoundError( 2135 f"The file {file} is missing for the product {folder_path}" 2136 )

FileNotFoundError: The file BrowseImage.tif is missing for the product /home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2019/270/RS2_OK888888_PK888888_DK888888_SCWA_20190927_082744_VV_VH_SGF

for ```/home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2019/270/RS2_OK888888_PK888888_DK888888_SCWA_20190927_082744_VV_VH_SGF``` and ```/home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2009/234/RS2_OK99999_PK999999_DK999999_XXXX_20090822_222741_VV_VH_SGF```

- for ```/home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2015/191/RS2_OK99999_PK999999_DK999999_XXXX_20150710_094757_VV_VH_SGF```i got : 

Traceback (most recent call last): File "rasterio/_base.pyx", line 308, in rasterio._base.DatasetBase.init File "rasterio/_base.pyx", line 219, in rasterio._base.open_dataset File "rasterio/_err.pyx", line 221, in rasterio._err.exc_wrap_pointer rasterio._err.CPLE_AppDefinedError: /home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2015/191/RS2_OK99999_PK999999_DK999999_XXXX_20150710_094757_VV_VH_SGF/imagery_VV.tif: TIFFReadDirectory:Failed to read directory at offset 210406808

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home1/datawork/vlheureu/conda-env/xsar_N/lib/python3.10/site-packages/xradarsat2/radarSat2_xarray_reader.py", line 1901, in load_digital_number rio = rasterio.open(tiff_files[0]) File "/home1/datawork/vlheureu/conda-env/xsar_N/lib/python3.10/site-packages/rasterio/env.py", line 451, in wrapper return f(*args, kwds) File "/home1/datawork/vlheureu/conda-env/xsar_N/lib/python3.10/site-packages/rasterio/init.py", line 304, in open dataset = DatasetReader(path, driver=driver, sharing=sharing, kwargs) File "rasterio/_base.pyx", line 310, in rasterio._base.DatasetBase.init rasterio.errors.RasterioIOError: /home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2015/191/RS2_OK99999_PK999999_DK999999_XXXX_20150710_094757_VV_VH_SGF/imagery_VV.tif: TIFFReadDirectory:Failed to read directory at offset 210406808

imagery_VV.tif couldn't be opened



- Antimeridian crossing not yet checked
pas de probleme particulière avec cette erreur : l'Antimeridian crossing n'est juste pas géré. 
yreynaud commented 1 year ago

/home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2015/191/RS2_OK99999_PK999999_DK999999_XXXX_20150710_094757_VV_VH_SGF is a corrupted file (appears there : https://cyclobs.ifremer.fr/static/sarwing_datarmor/processings/c39e79a/default/reports/RS2_all/errors.txt)

agrouaze commented 1 year ago

no problem (anymore) for /home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2019/236/RS2_OK112943_PK987923_DK926612_SCWA_20190824_214409_VV_VH_SGF'

agrouaze commented 1 year ago

all the issues listed in the ticket are solved or "won't fix". I close the ticket.