Esempio n. 1
0
def copy_mapset(mapset_from,mapset_to,regfilter,overwrite,lf):      # OUTSIDE
        gsetup.init(gisbase, gisdbase, location, mapset_from)
        #grass.run_command("g.mapset", mapset=mapset_from, quiet=1)
        # list contents of temp mapset
        raster_list = grass.list_pairs(type = 'rast')
        # Switch to target mapset and copy rasters over
        grass.run_command("g.mapset", mapset=mapset_to,quiet=0)
        for rast in raster_list:
                if(rast[1] != 'PERMANENT' and re.search(regfilter,rast[0])):
                        old = rast[0]+ '@' + rast[1]
                        new = rast[0]
                        cmd = old+","+new
                        printout("g.copy, rast="+cmd+", overwrite="+str(overwrite),lf)
                        grass.run_command("g.copy", rast=cmd, overwrite=overwrite)
Esempio n. 2
0
def copy_fromtemp(cores,mapset_to,suffixes,overwrite,bregion,C,lf):  # OUTSIDE
        gsetup.init(gisbase, gisdbase, location, mapset_to)
        for count in range(0,cores):
                # Switch to temp mapset
                mapset_temp = 'temp'+str(count).zfill(2)
                grass.run_command("g.mapset", mapset=mapset_temp, quiet=1)
                # list contents of temp mapset
                raster_list = grass.list_pairs(type = 'rast')
                # Switch to target mapset and copy rasters over
                grass.run_command("g.mapset", mapset=mapset_to,quiet=0)
                for regfilter in suffixes:
                        for rast in raster_list:
                                if(rast[1] != 'PERMANENT' and re.search(regfilter,rast[0])):
                                        old = rast[0]+ '@' + rast[1]
                                        new = rast[0]
                                        cmd = old+","+new
                                        printout("g.copy, rast="+cmd+", overwrite="+str(overwrite),lf)
                                        grass.run_command("g.copy", rast=cmd, overwrite=overwrite)
Esempio n. 3
0
def list_in_current_mapset(pattern):
    maps = gs.list_pairs(type="rast", mapset=".", pattern=pattern, flag="e")
    maps = [name for name, mapset in maps]
    return maps
Esempio n. 4
0
def list_in_current_mapset(pattern):
    """List names of raster maps in the current mapset"""
    maps = gs.list_pairs(type='rast', mapset=".", pattern=pattern, flag='e')
    maps = [name for name, mapset in maps]
    return maps