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(out,mapy,mapx,ms,residname,estimatesname,seed): mapx = parse_feature_names(mapx) gscript.run_command('g.mapset',mapset=ms) # run regression run_regression(out,mapy,mapx,residname,estimatesname) # develop mask from residuals map set_mask(residname) # calculate sum of squares of residuals and number of observations (will be dividing by too many degrees # of freedom, but N is so big that the variance of the residuals is a reasonable approximation of the unbiased estimator of # the variance of the dependent variable. stats = get_stats(residname) sigma_hat2 = float(stats['variance']) # calculate standard error for each parameter estimate in the regression and output to file se_list = get_param_se(mapx,sigma_hat2) add_output_lines(out,mapx,se_list) # drop the mask from this mapset drop_mask()