# Create a Maskay dict object
S2files = cloudsen12.MaskayDict(
path=s2idpath,
pattern="\.jp2$",
full_names=True,
recursive=True,
sensor="Sentinel-2"
)
tensor = cloudsen12.TensorSat(**S2files.to_dict(), cache=True, align=False)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
[/usr/local/lib/python3.9/dist-packages/xarray/backends/file_manager.py](https://localhost:8080/#) in _acquire_with_cache_info(self, needs_lock)
208 try:
--> 209 file = self._cache[self._key]
210 except KeyError:
9 frames
[/usr/local/lib/python3.9/dist-packages/xarray/backends/lru_cache.py](https://localhost:8080/#) in __getitem__(self, key)
54 with self._lock:
---> 55 value = self._cache[key]
56 self._cache.move_to_end(key)
KeyError: [<function open at 0x7fbd01291dc0>, ('/content/S2B_MSIL1C_20220701T141719_N0400_R010_T20MRC_20220702T063947.SAFE/GRANULE/L1C_T20MRC_A027778_20220701T141716/IMG_DATA/T20MRC_20220701T141719_B01.jp2',), 'r', (('sharing', False),), 'd757e1c2-348e-4b9b-ae2f-6ccaa845b615']
During handling of the above exception, another exception occurred:
CPLE_OpenFailedError Traceback (most recent call last)
rasterio/_base.pyx in rasterio._base.DatasetBase.__init__()
rasterio/_base.pyx in rasterio._base.open_dataset()
rasterio/_err.pyx in rasterio._err.exc_wrap_pointer()
CPLE_OpenFailedError: '/content/S2B_MSIL1C_20220701T141719_N0400_R010_T20MRC_20220702T063947.SAFE/GRANULE/L1C_T20MRC_A027778_20220701T141716/IMG_DATA/T20MRC_20220701T141719_B01.jp2' not recognized as a supported file format.
During handling of the above exception, another exception occurred:
RasterioIOError Traceback (most recent call last)
[<ipython-input-7-84414c94bd67>](https://localhost:8080/#) in <cell line: 9>()
7 sensor="Sentinel-2"
8 )
----> 9 tensor = cloudsen12.TensorSat(**S2files.to_dict(), cache=True, align=False)
[/usr/local/lib/python3.9/dist-packages/maskay/tensorsat.py](https://localhost:8080/#) in __init__(self, cache, align, Aerosol, Blue, Green, Red, RedEdge1, RedEdge2, RedEdge3, NIR, NIR2, WaterVapor, Cirrus, SWIR1, SWIR2, TIR1, TIR2, HV, VH, HH, VV)
38 self.cache: bool = cache
39 self.align: bool = align
---> 40 self.Aerosol: Union[str, np.ndarray, xr.DataArray] = Aerosol
41 self.Blue: Union[str, np.ndarray, xr.DataArray] = Blue
42 self.Green: Union[str, np.ndarray, xr.DataArray] = Green
[/usr/local/lib/python3.9/dist-packages/maskay/tensorsat.py](https://localhost:8080/#) in Aerosol(self, value)
125 @Aerosol.setter
126 def Aerosol(self, value):
--> 127 self._Aerosol = self.to_xarray(value)
128
129 @property
[/usr/local/lib/python3.9/dist-packages/maskay/tensorsat.py](https://localhost:8080/#) in to_xarray(self, object)
98 """
99 if isinstance(object, str):
--> 100 with rioxarray.open_rasterio(object, "r") as src:
101 raster = np.squeeze(src, axis=0)
102 if self.cache:
[/usr/local/lib/python3.9/dist-packages/rioxarray/_io.py](https://localhost:8080/#) in open_rasterio(filename, parse_coordinates, chunks, cache, lock, masked, mask_and_scale, variable, group, default_name, decode_times, decode_timedelta, band_as_variable, **open_kwargs)
1122 else:
1123 manager = URIManager(file_opener, filename, mode="r", kwargs=open_kwargs)
-> 1124 riods = manager.acquire()
1125 captured_warnings = rio_warnings.copy()
1126
[/usr/local/lib/python3.9/dist-packages/xarray/backends/file_manager.py](https://localhost:8080/#) in acquire(self, needs_lock)
189 An open file object, as returned by ``opener(*args, **kwargs)``.
190 """
--> 191 file, _ = self._acquire_with_cache_info(needs_lock)
192 return file
193
[/usr/local/lib/python3.9/dist-packages/xarray/backends/file_manager.py](https://localhost:8080/#) in _acquire_with_cache_info(self, needs_lock)
213 kwargs = kwargs.copy()
214 kwargs["mode"] = self._mode
--> 215 file = self._opener(*self._args, **kwargs)
216 if self._mode == "w":
217 # ensure file doesn't get overridden when opened again
[/usr/local/lib/python3.9/dist-packages/rasterio/env.py](https://localhost:8080/#) in wrapper(*args, **kwds)
449
450 with env_ctor(session=session):
--> 451 return f(*args, **kwds)
452
453 return wrapper
[/usr/local/lib/python3.9/dist-packages/rasterio/__init__.py](https://localhost:8080/#) in open(fp, mode, driver, width, height, count, crs, transform, dtype, nodata, sharing, **kwargs)
302
303 if mode == "r":
--> 304 dataset = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)
305 elif mode == "r+":
306 dataset = get_writer_for_path(path, driver=driver)(
rasterio/_base.pyx in rasterio._base.DatasetBase.__init__()
RasterioIOError: '/content/S2B_MSIL1C_20220701T141719_N0400_R010_T20MRC_20220702T063947.SAFE/GRANULE/L1C_T20MRC_A027778_20220701T141716/IMG_DATA/T20MRC_20220701T141719_B01.jp2' not recognized as a supported file format.
Hi!
When running the following chunk of code (from the second example notebook (https://colab.research.google.com/github/cloudsen12/examples/blob/master/example02.ipynb)
The following error appears (in Google Colab):