<jupyter_start><jupyter_text><jupyter_code>from tensorflow.keras.preprocessing.image import load_img
import rasterio
import matplotlib.pyplot as plt
from keras import backend as K

filepath = 'http://landsat-pds.s3.amazonaws.com/c1/L8/042/034/LC08_L1TP_042034_20170616_20170629_01_T1/LC08_L1TP_042034_20170616_20170629_01_T1_B4.TIF'
with rasterio.open(filepath) as src:
    print(src.profile)
# The grid of raster values can be accessed as a numpy array and plotted:
with rasterio.open(filepath) as src:
   oviews = src.overviews(1) # list of overviews from biggest to smallest
   oview = oviews[-1] # let's look at the smallest thumbnail
   print('Decimation factor= {}'.format(oview))
   # NOTE this is using a 'decimated read' (http://rasterio.readthedocs.io/en/latest/topics/resampling.html)
   
   thumbnail = src.read(1)

plt.imshow(thumbnail)
plt.colorbar()
plt.title('original'.format(thumbnail.shape))
plt.xlabel('Column #')
plt.ylabel('Row #')

def three_transformation_grey(image):
    image_tsp = K.transpose(image)
    image_cw90 = K.reverse(image, axes=0)  # clock wise
    image_ccw90 = K.reverse(image, axes=1)  # counter clock wise

    plt.figure()
    plt.subplot(221)
    plt.imshow(image, cmap='gray')
    plt.title('Original')
    plt.axis('off')
    plt.subplot(222)
    plt.imshow(K.eval(image_tsp), cmap='gray')
    plt.title('Transposed')
    plt.axis('off')
    plt.subplot(223)
    plt.imshow(K.eval(image_cw90), cmap='gray')
    plt.title('Rotated 90˚ cw')
    plt.axis('off')
    plt.subplot(224)
    plt.imshow(K.eval(image_ccw90), cmap='gray')
    plt.title('Rotated 90˚ ccw')
    plt.axis('off')
    plt.show()
three_transformation(thumbnail)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13548387096774195, 'fraction_numerical': 0.05571847507331378, 'mean_word_length': 4.503225806451613, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '334493', 'license': 'Apache-2.0', 'n_tokens_mistral': 712, 'n_tokens_neox': 652, 'n_words': 118, 'path': 'satellite_task_1.ipynb', 'repo_name': 'dgg32/satellite_water', 'size': '1705'}