google / Xee

An Xarray extension for Google Earth Engine
Apache License 2.0
240 stars 28 forks source link

Fix: Use np.concatenate() instead of np.array() for merging 1D arrays with different sizes #132

Closed dabhicusp closed 7 months ago

dabhicusp commented 7 months ago

Currently, the usage of np.array() inside the _process_coordinate_data fails when attempting to merge 1D arrays with different sizes. This can be resolved by replacing np.array() with np.concatenate(), which effectively merges 1D arrays with varying shapes into a single 1D array.

Example code:

import numpy as np
day1 = np.random.randint(10, size=(5))
print(day1)

day2 = np.random.randint(10, size=(4))
print(day2)

allDays1 = np.array([day1, day2])  # not worked
allDays2 = np.concatenate([day1, day2]) # worked
print(allDays1)