Search code examples
geospatialgeocodingcartopysatellite-imagepyproj

Converting pixel data from SEVIRI satellite images to lat, lon values using pyproj and cartopy


I am trying to plot specific Data from satellite Images like this one satellite image. The Data is referenced by Pixels of the Picture. Every Picture has 1024px in height and width and is from a geostationary satellite (SEVIRI) with the boundaries of latitude of 30° to -30° and longitude from 30° to 105°. A datapoint has the information for example: width:800px height: 305px. Unfortunately i am lost with all these projection methods. How can i transform the pixel values in lat, lon values?


Solution

  • The original data, as recorded by SEVIRI, by definition is in the geostationary projection. But if this is somehow already resampled to lat/lon you can just use the extent as you already have it. If it's in another projection, you would need to know what it is, it's not something anyone but you can know.

    That said, the assumption seems to hold quite well. You can read it with Matplotlib, assign the extent you mentioned, which matches the overlaid coastlines quite well:

    import matplotlib.pyplot as plt
    import cartopy.crs as ccrs
    
    fn = "ieZPH.jpg"
    data = plt.imread(fn)
    
    extent = (30, 105, 30, -30)
    proj = ccrs.PlateCarree()
    
    fig, ax = plt.subplots(figsize=(10,7), dpi=96, facecolor="w", subplot_kw=dict(projection=proj))
    
    ax.imshow(data, extent=extent, transform=ccrs.PlateCarree(), origin="lower")
    ax.coastlines(color="r", linestyle="--")
    
    ax.set_extent(extent, crs=proj)
    ax.gridlines(draw_labels=True)
    

    enter image description here