I am trying to learn sentinelsat by following some tutorials. Part of the codes goes like this.
import rasterio as rio
import geopandas as gpd
nReserve = gpd.read_file('NReserve/NaturalReserve_Polygon.shp')
nReserve_proj = nReserve.to_crs({'init': 'epsg:32633'})
with rio.open("RGB.tiff") as src:
    out_image, out_transform = rio.mask.mask(src, nReserve_proj.geometry,crop=True)
    out_meta = src.meta.copy()
    out_meta.update({"driver": "GTiff",
                 "height": out_image.shape[1],
                 "width": out_image.shape[2],
                 "transform": out_transform})
    
with rio.open("RGB_masked.tif", "w", **out_meta) as dest:
    dest.write(out_image)
The line out_image, out_transform = rio.mask.mask(src, nReserve_proj.geometry,crop=True) is giving me error. The error goes like this --
AttributeError                            Traceback (most recent call last)
<ipython-input-45-c1fc22fa2c5d> in <module>()
      2 
      3 with rio.open("RGB.tiff") as src:
----> 4     out_image, out_transform = rio.mask.mask(src, nReserve_proj.geometry,crop=True)
      5     out_meta = src.meta.copy()
      6     out_meta.update({"driver": "GTiff",
AttributeError: module 'rasterio' has no attribute 'mask'
But rasterio's documentation it shows rasterio.mask.mask() exists. from doc --
rasterio.mask.mask(dataset, shapes, all_touched=False, invert=False, nodata=None, filled=True, crop=False, pad=False, pad_width=0.5, indexes=None)
What went wrong here? I am new so I am not understanding what to check.
rasterio.pyin the current working directory. Because of the order Python searches for things to import, the code in this file would be imported instead of the installed module. If you have this situation occurring, the solution is to rename your file to something that wouldn't block the correct import of any module. Possibly just:my_rasterio.py.import rasterio as rioI usedfrom rasterio import mask as mskand then writing the line like thisout_image, out_transform = msk.mask(src, nReserve_proj.geometry,crop=True)Now it is not giving any error.