#!/usr/bin/env python # coding: utf-8 # In[2]: import os import rioxarray # In[3]: ''' Folder ''' os.chdir(r'C:/Users/jtrum/world_bank/data/') # In[4]: ''' Read raster ''' import xarray as xr # In[5]: raster = xr.open_rasterio('ago_women_2020.tif') # In[6]: raster # In[7]: import geopandas as gpd aoi = gpd.read_file('aoiLuanda.geojson') # In[8]: aoi # In[13]: ##clip raster clip_bound = aoi.geometry # In[14]: clip_bound # In[16]: clip_raster = raster.rio.clip(clip_bound, from_disk=True) # In[ ]: import matplotlib.pyplot as plt # In[17]: #plot clipped raster clip_raster.plot()