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
I would like to rename the DataArray key in the xr.Dataset object returned by S2Product.load() because I am unable to serialize xr.Dataset to a netCDF file. The xr.Dataset.to_netcdf() raises TypeError: DataArray.name or Dataset key must be either a string or None for serialization to netCDF files. Therefore, I rename the keys from SpectralBandNames objects to strings. When I load from the netcdf file, I would like to rename the string keys to band keys to exactly reconstuct the xr.Dataset object. For this, I call to_band for each str but the to_band returns a list.
Solution:
return a single band instead of a list of bands when to_band is called with a single string
Could not find an alternative to this
The text was updated successfully, but these errors were encountered:
A workaround could be to take the list of all the string keys, convert them all at once in SpectralBandNames and loop on the converted keys.
Wouldn't it be possible?
I would like to rename the DataArray key in the xr.Dataset object returned by
S2Product.load()
because I am unable to serialize xr.Dataset to a netCDF file. The xr.Dataset.to_netcdf() raisesTypeError: DataArray.name or Dataset key must be either a string or None for serialization to netCDF files
. Therefore, I rename the keys from SpectralBandNames objects to strings. When I load from the netcdf file, I would like to rename the string keys to band keys to exactly reconstuct the xr.Dataset object. For this, I call to_band for each str but the to_band returns a list.Solution:
return a single band instead of a list of bands when to_band is called with a single string
Could not find an alternative to this
The text was updated successfully, but these errors were encountered: