Converting Xarray data variables to dimension

  Kiến thức lập trình

I am attempting to convert some data variables in my Xarray data structure (latitude, longitude, and time) to dimensions.

However, when I attempt to use the expand_dims and assign_coords methods to add these data variables as dimensions:

spotter = spotter.expand_dims(dim={'time':6390651, 'latitude':6390651, 'longitude':6390651}, create_index_for_new_dim=True).assign_coords({'time': spotter.time, 'latitude': spotter.latitude, 'longitude': spotter.longitude})

I get an error message:

ValueError: time already exists as coordinate or variable name.

What exactly is the issue here?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT