Clip Sentinel-3 LST raster to polygon shapefile

Hi there,

In a Nutshell

I want to clip S3 LST L2 dataarray to a polygon shapefile I created using QGIS

more details

LST Data

From the initial S3-L2_LST product delivered from Sentinel-3 data, I built a dataset that looks as so (lat, lon and time have been assigned to coordinates, but not to dimensions - which appears to be ‘Frozen’):

Polygon Shapefile

  • I generated one polygon,
  • and saved it as a shp file (crs : EPSG:4326 - WGS: 84)

Data to shapefile cliping process

I tried to clip the LST DataArray displayed above to my customized polygon using hints I found here and there:

Test1 - Masking NetCDF time series data from shapefile using Python - Geographic Information Systems Stack Exchange

da = xarray.open_dataset(xr_filepath)
lst_da = da.LST"lon", y_dim="lat", inplace=True)

→ ERROR : x dimension (lon) not found. Data variable: LST

Test2 - python - Masking NetCDF data using shapefile (xarray & geopandas) - Geographic Information Systems Stack Exchange

geodf = geopandas.read_file(shp_filepath)
xds = rioxarray.open_rasterio(xr_filepath)
# WARNING -> NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix be returned."epsg:4326", inplace=True)

clipped =,

→ ERROR : No data found in bounds. Data variable: LST

Test3 - python mask netcdf data using shapefile - Stack Overflow

I tried some customization but I clearly do not have a sufficient understanding of the initial code and field knowledge to make this code fits my use case specificities…

CONCLUSION : I couldn’t make it happen…

It might have to do with my LST data array Dimensions being differents from Coordinates (lat, lon), but my scarce experience in this field do not help me to be creative enough in terms of workarounds…

I’ve also encountered people talking about “subsetting” the raster/xarray instead of “cliping”, which might end up leading to the same objective for me :

Extract data from one initial dataset, relatively to one specific area

Would you have any hints, or clear procedure to follow using python script (I’m prototyping on Jupyter Lab at the moment…), it would be very much appreciated !

#clip #subset #shapefile #rasterio #geospatial #sentinel

Hello ‘step’ fellows,

I’m still struggling on this particular issue, but my understanding of the root causes is improving.
I’ve just started reading a content that seems to describe and summarize my “situation” into what can be called “regridding”.

The more I feel like I’m stuck in a dead-end, considering my current knowledge, the more I feel hope in what appears to make sense in my use case.
Hoping this could help one of you, contributers, to help me climb a new step ;).

Other than that, have a good day ;).

Just to let you know that you will find a solution at the following address:

Thank to you all.