def main(out,maps,ms,keepdtype,ndv,createopts): # set mapset set_mapset(ms) # turn categorical names into dummy names maps=parse_feature_names(maps) # make desired output_mask # slopes above 55 degrees masked and points on top of water or snow masked make_output_mask('(slope < 55) && (lcc == 2 || lcc == 3)','buffered_basin_border') # run separately for each map for m in maps: dtype = gscript.parse_command('r.info',flags='g',map=m)['datatype'] if dtype == 'CELL': export_maps([m],out,'Byte',keepdtype,ndv,createopts) else: export_maps([m],out,'Float32',keepdtype,ndv,createopts) # remove group and mask gscript.run_command('g.remove', type='group', name='to_export', quiet=True, flags='f') drop_mask()
def main(mapset,map_name,remove,msk_type): set_mapset(mapset) if remove: drop_mask(msk_type) else: set_mask(name,msk_type)