Skip to main content

Hello!


I created mosaic for each patch using np.median(eop_s2.data['TRUE-COLOR-S2-L1C'], axis=0).squeeze()

But since it is numpy array, I cannot add it as data_timeless to EOPatch. I wonder how I can do this.


Thank you in advance for your help.

This works for me:

eopatch.data_timeless['test'] = np.median(eopatch.data['BANDS'], axis=0).squeeze()

# eopatch.data['BANDS'].shape is (n_timestamps, height, width, n_bands), n_bands>1
# eopatch.data_timeless['test'].shape is (height, width, n_bands)

Please check that the dimension of your data_timeless feature is 3. In case you only have single band in your data, then the squeeze() you are using is removing that dimension, and you might have ended up with a numpy array with shape (height, width).

Otherwise, please provide more details (e.g. paste the error you get).

Best


I wanted to add that squeeze() can act a bit too sharply sometimes. Usually you have a good idea which axis you want to squeeze, so I would suggest using squeeze(axis=0) or some other axis, whenever you use it.


 
batic:

eopatch.data_timelesss'test'] = np.median(eopatch.dataa'BANDS'], axis=0).squeeze()

Dear,

Thank you for your help - The main idea is to prepare the RGB mosaic out of the time series so there is not 1D feature, and your script worked very well 🙂

Kind regards


Reply