This is not something I do often, but I recall it being fairly easy. Today however I can't make it work:
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rasterio
>>> from matplotlib import pyplot
>>> src = rasterio.open("ProtectedAreas_152160_mask_5x5.gtiff")
>>> from rasterio.plot import show_hist
>>> show_hist(src, bins=50, lw=0.0, stacked=False, alpha=0.3,histtype='stepfilled', title="Histogram")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/rasterio/plot.py", line 250, in show_hist
arr = source.read(masked=masked)
File "rasterio/_io.pyx", line 336, in rasterio._io.DatasetReaderBase.read
MemoryError: Unable to allocate array with shape (1, 87425, 89057) and data type float64
>>>
>>> show_hist(src, title="Histogram")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/rasterio/plot.py", line 250, in show_hist
arr = source.read(masked=masked)
File "rasterio/_io.pyx", line 336, in rasterio._io.DatasetReaderBase.read
MemoryError: Unable to allocate array with shape (1, 87425, 89057) and data type float64
Is there something missing here? Some type conversion perhaps?