I have 2 different x-array dataset like shown below:
<xarray.Dataset> Dimensions: (band: 1, num_star_looks: 24, number_of_image_bounds: 2, number_of_time_bounds: 2, x: 10848, y: 10848) Coordinates: t datetime64[ns] ... * y (y) float32 0.151858 ... -0.151858 * x (x) float32 -0.151858 ... 0.151858 band_id (band) int8 1 band_wavelength (band) float32 ... Dimensions without coordinates: band, num_star_looks, number_of_image_bounds, number_of_time_bounds Data variables: Rad (y, x) float32 ...
2nd dataset:
<xarray.Dataset> Dimensions: (band: 1, num_star_looks: 24, number_of_image_bounds: 2, number_of_time_bounds: 2, x: 10848, y: 10848) Coordinates: t datetime64[ns] ... * y (y) float32 0.151858 ... -0.151858 * x (x) float32 -0.151858 ... 0.151858 band_id (band) int8 2 band_wavelength (band) float32 ... Dimensions without coordinates: band, num_star_looks, number_of_image_bounds, number_of_time_bounds Data variables: Rad (y, x) float32 ...
Both have different values in coordinate t
and band_id
. Now I want to concat them using band_id
dim, but I'm getting error as:
xr.concat([F1, F2], dim = 'band_id')
ValueError: band_id already exists as coordinate or variable name.
When I try to concat it using dimension t
it's working perfectly as I wanted and resulting following array.
<xarray.Dataset> Dimensions: (band: 1, num_star_looks: 24, number_of_image_bounds: 2, number_of_time_bounds: 2, t: 2, x: 10848, y: 10848) Coordinates: band_id (band) int8 1 * y (y) float32 0.151858 ... -0.151858 * x (x) float32 -0.151858 ... 0.151858 * t (t) datetime64[ns] 2019-04-10T00:05:08.113467008 2019-04-11T00:05:06.598942080 Dimensions without coordinates: band, num_star_looks, number_of_image_bounds, number_of_time_bounds Data variables: Rad (t, y, x) float32 ...
I want something similar dimension in Rad
variable but instead of t
I want band_id
.
What I think is maybe there's dimension ````bandin
band_idcoordinate and there's no dimension in
t``` so it's working there.
from Recent Questions - Stack Overflow https://stackoverflow.com/questions/65376927/valueerror-band-id-already-exists-as-coordinate-or-variable-name-xarray-concat Chris_007
没有评论:
发表评论