You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{
"name": "ValueError",
"message": "rescale=True, but safe casting cannot be completed between asset scale value 1 and output dtype float32.
To continue using dtype='float32', pass rescale=False to retrieve data in its raw, unscaled values. Or, if you want rescaled values, pass a different dtype= (typically float).",
"stack": "---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[4], line 1
----> 1 cube = emc.load_minicube(specs, compute = True)
File c:\MySoftwares\Anaconda3\envs\cube\Lib\site-packages\earthnet_minicuber\minicuber.py:192, in Minicuber.load_minicube(cls, specs, verbose, compute)
189 if verbose:
190 print(f"Loading {provider.class.name} for {time_interval}")
--> 192 product_cube = provider.load_data(self.padded_bbox, time_interval, full_time_interval = self.full_time_interval)
194 if product_cube is not None:
195 if cube is None:
File c:\MySoftwares\Anaconda3\envs\cube\Lib\site-packages\stackstac\prepare.py:168, in prepare_items(items, assets, epsg, resolution, bounds, bounds_latlon, snap_bounds, rescale, dtype)
166 if rescale:
167 if not np.can_cast(type(asset_scale), dtype):
--> 168 raise ValueError(
169 f"rescale=True, but safe casting cannot be completed between "
170 f"asset scale value {asset_scale} and output dtype {dtype}.
"
171 f"To continue using {dtype=}, pass rescale=False to retrieve "
172 "data in its raw, unscaled values. Or, if you want rescaled "
173 "values, pass a different dtype= (typically float)."
174 )
176 if not np.can_cast(type(asset_offset), dtype):
177 raise ValueError(
178 f"rescale=True, but safe casting cannot be completed between "
179 f"asset offset value {asset_offset} and output dtype {dtype}.
"
(...)
182 "values, pass a different dtype= (typically float)."
183 )
ValueError: rescale=True, but safe casting cannot be completed between asset scale value 1 and output dtype float32.
To continue using dtype='float32', pass rescale=False to retrieve data in its raw, unscaled values. Or, if you want rescaled values, pass a different dtype= (typically float)."
}
The text was updated successfully, but these errors were encountered:
Output:
{
"name": "ValueError",
"message": "
rescale=True
, but safe casting cannot be completed between asset scale value 1 and output dtype float32.To continue using
dtype='float32'
, passrescale=False
to retrieve data in its raw, unscaled values. Or, if you want rescaled values, pass a differentdtype=
(typicallyfloat
).","stack": "---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[4], line 1
----> 1 cube = emc.load_minicube(specs, compute = True)
File c:\MySoftwares\Anaconda3\envs\cube\Lib\site-packages\earthnet_minicuber\minicuber.py:192, in Minicuber.load_minicube(cls, specs, verbose, compute)
189 if verbose:
190 print(f"Loading {provider.class.name} for {time_interval}")
--> 192 product_cube = provider.load_data(self.padded_bbox, time_interval, full_time_interval = self.full_time_interval)
194 if product_cube is not None:
195 if cube is None:
File c:\MySoftwares\Anaconda3\envs\cube\Lib\site-packages\earthnet_minicuber\provider\s2\sentinel2.py:152, in Sentinel2.load_data(self, bbox, time_interval, **kwargs)
148 metadata = items_s2.to_dict()['features'][0]["properties"]
149 epsg = metadata["proj:epsg"]
--> 152 stack = stackstac.stack(items_s2, epsg = epsg, assets = self.bands, dtype = "float32", properties = ["sentinel:product_id"], band_coords = False, bounds_latlon = bbox, xy_coords = 'center', chunksize = 2048,errors_as_nodata=(RasterioIOError('.*'), ), gdal_env=gdal_session)
155 if self.aws_bucket != "planetary_computer":
156 stack = stack.rename({"id": "id_old"}).rename({"sentinel:product_id": "id"})
File c:\MySoftwares\Anaconda3\envs\cube\Lib\site-packages\stackstac\stack.py:290, in stack(items, assets, epsg, resolution, bounds, bounds_latlon, snap_bounds, resampling, chunksize, dtype, fill_value, rescale, sortby_date, xy_coords, properties, band_coords, gdal_env, errors_as_nodata, reader)
283 if sortby_date is not False:
284 plain_items = sorted(
285 plain_items,
286 key=lambda item: item["properties"].get("datetime", "") or "",
287 reverse=sortby_date == "desc",
288 )
--> 290 asset_table, spec, asset_ids, plain_items = prepare_items(
291 plain_items,
292 assets=assets,
293 epsg=epsg,
294 resolution=resolution,
295 bounds=bounds,
296 bounds_latlon=bounds_latlon,
297 snap_bounds=snap_bounds,
298 rescale=rescale,
299 dtype=dtype,
300 )
301 arr = items_to_dask(
302 asset_table,
303 spec,
(...)
311 errors_as_nodata=errors_as_nodata,
312 )
314 return xr.DataArray(
315 arr,
316 *to_coords(
(...)
325 name="stackstac-" + dask.base.tokenize(arr),
326 )
File c:\MySoftwares\Anaconda3\envs\cube\Lib\site-packages\stackstac\prepare.py:168, in prepare_items(items, assets, epsg, resolution, bounds, bounds_latlon, snap_bounds, rescale, dtype)
166 if rescale:
167 if not np.can_cast(type(asset_scale), dtype):
--> 168 raise ValueError(
169 f"
rescale=True
, but safe casting cannot be completed between "170 f"asset scale value {asset_scale} and output dtype {dtype}.
"
171 f"To continue using
{dtype=}
, passrescale=False
to retrieve "172 "data in its raw, unscaled values. Or, if you want rescaled "
173 "values, pass a different
dtype=
(typicallyfloat
)."174 )
176 if not np.can_cast(type(asset_offset), dtype):
177 raise ValueError(
178 f"
rescale=True
, but safe casting cannot be completed between "179 f"asset offset value {asset_offset} and output dtype {dtype}.
"
(...)
182 "values, pass a different
dtype=
(typicallyfloat
)."183 )
ValueError:
rescale=True
, but safe casting cannot be completed between asset scale value 1 and output dtype float32.To continue using
dtype='float32'
, passrescale=False
to retrieve data in its raw, unscaled values. Or, if you want rescaled values, pass a differentdtype=
(typicallyfloat
)."}
The text was updated successfully, but these errors were encountered: