mbforr / youtube-examples

Repo with all my code and examples from YouTube
2 stars 5 forks source link

Flipped images #1

Open scene-mosaic opened 1 year ago

scene-mosaic commented 1 year ago

The code flips the product images at the end. Flips the y-axis, it seems.

jennaguffogg commented 3 months ago

I resolved this by adding these two lines, which uses numpy to vertically flip the data:

rem_flipped = xr.DataArray(np.flipud(rem.values), dims=rem.dims, coords=rem.coords)
cropped_flipped = xr.DataArray(np.flipud(cropped.values), dims=cropped.dims, coords=cropped.coords)

and then using the 'flipped' versions to create the final outputs:

colors = ['#f2f7fb', '#81a8cb', '#37123d']
shade(rem_flipped.squeeze(), cmap=colors, span=[0, 20], how='linear')

a = shade(xrspatial.hillshade(cropped_flipped.squeeze(), angle_altitude=1, azimuth=250), cmap=['black', 'white'], how='linear')
b = shade(rem_flipped.squeeze(), cmap=colors, span=[0, 10], how='linear', alpha=200)
stack(a, b)