Jupyternotebook

Display image from WMS (owslib)

[89]:
from owslib.wcs import WebCoverageService
from IPython.display import Image
import rasterio
from rasterio.plot import show
from rasterio import MemoryFile
import matplotlib.pyplot as plt

url = 'https://gpwmap.jaxa.jp/ows?'
identifier = ['GCOM-C__LST250m_LST_Day']
format = "GeoTIFF"
subsets_long = ('Long', 137.85, 140.85)
subsets_lat = ('Lat', 35.15, 36.85)
subsets_time = ('time','2024-04-02T01:33:00Z')
subsets = [subsets_long, subsets_lat, subsets_time]

wcs = WebCoverageService(url, version="2.0.1")
img = wcs.getCoverage( identifier=identifier, format=format, subsets = subsets)

cmap = plt.colormaps['turbo']

with MemoryFile(img) as memfile:
     with memfile.open() as dataset:
            show(dataset, cmap=cmap)
../../_images/tutorials_wcs_jupyter_1_0.png

references