Exemple #1
0
 def preprocess_to_raster_precision(self, shp_pr, field_pr):
     """
     Function to extract data in pixel of vectors. For that, it need to
     save a shapefile, then rasterize it and get a final data matrix.
     
     :param shp_pr: Input shapefile path
     :type shp_pr: str 
     :param field_pr: Field name of the shapefile to rasterize
     :type field_pr: str
     """
     
     kwargs = {}
     kwargs['rm_rast'] = 1 # To remove existing raster in the clip_raster function
     opt = {}
     opt['Remove'] = 1 # To remove existing vector
     # Define vector
     vector_pr = Vector(shp_pr, self.path_cut, **opt)
     # Create the raster output path
     img_pr = vector_pr.layer_rasterization(self.ex_raster, field_pr)
     self.img_pr.append(clip_raster(img_pr, self.complete_validation_shp, **kwargs))
     
     # Call the raster class to extract the image data
     self.complete_img.append(RasterSat_by_date('', '', [0]))