def write_raster(raster_name, arr, can_ovr):
    """
    write a grass raster
    raster_name: the GRASS raster name
    arr: the array to be written in GRASS raster
    """
    if can_ovr == True and raster.RasterRow(raster_name).exist() == True:
        utils.remove(raster_name, 'raster')
        #~ msgr.verbose(_("Removing raster map %s") % raster_name)
    with raster.RasterRow(raster_name, mode='w', mtype='DCELL') as newraster:
        newrow = raster.Buffer((arr.shape[1],), mtype='DCELL')
        for row in arr:
            newrow[:] = row[:]
            newraster.put_row(newrow)
Exemple #2
0
 def remove(self):
     """Remove the map"""
     if self.is_open():
         self.close()
     utils.remove(self.name, "rast")
Exemple #3
0
 def remove(self):
     """Remove vector map"""
     if self.is_open():
         self.close()
     utils.remove(self.name, 'vect')
Exemple #4
0
 def remove(self):
     """Remove vector map"""
     if self.is_open():
         self.close()
     utils.remove(self.name, 'vect')
Exemple #5
0
 def remove(self):
     """Remove the map"""
     if self.is_open():
         self.close()
     utils.remove(self.name, 'rast')