#!/usr/bin/env python
# coding: utf-8
#
#
# # Jupyter in the Emacs universe
#
# Editing Jupyter notebooks in Emacs.
# In[ ]:
get_ipython().run_line_magic('matplotlib', 'inline')
# In[ ]:
get_ipython().system('curl https://data.geo.admin.ch/ch.swisstopo.swissimage-dop10/swissimage-dop10_2020_2533-1152/swissimage-dop10_2020_2533-1152_0.1_2056.tif --output image.tif')
#
#
# ## The Python code starts here
# In[ ]:
import matplotlib.pyplot as plt
import rasterio as rio
from rasterio import plot
# In[ ]:
dst_filepath = "foo.png"
# In[ ]:
fig, ax = plt.subplots()
with rio.open("image.tif") as src:
plot.show(src.read(window=((6700, 8000), (1300, 3000))))
fig.savefig(dst_filepath)