def main(): options, flags = gcore.parser() if options["input"]: map_name = gcore.find_file(name=options["input"], element="cell")["fullname"] if not map_name: gcore.fatal(_("Raster map <{raster}> not found").format(raster=options["input"])) # define display driver (avoid 'no graphics device selected' error at start up) driver = UserSettings.Get(group="display", key="driver", subkey="type") if driver == "png": os.environ["GRASS_RENDER_IMMEDIATE"] = "png" else: os.environ["GRASS_RENDER_IMMEDIATE"] = "cairo" # launch application app = wx.App() if not CheckWxVersion([2, 9]): wx.InitAllImageHandlers() # show main frame giface = StandaloneGrassInterface() frame = ExampleMapFrame(parent=None, giface=giface) if options["input"]: giface.WriteLog(_("Loading raster map <{raster}>...").format(raster=map_name)) frame.SetLayer(map_name) frame.Show() app.MainLoop()
def main(): options, flags = gcore.parser() probability = options['probability'] output = options['output'] count = int(options['count']) gcore.use_temp_region() # probability map probab_01 = 'probability_01_' + str(os.getpid()) TMP_RAST.append(probab_01) info = grast.raster_info(probability) gcore.write_command('r.recode', flags='d', input=probability, output=probab_01, title="Recoded probability map to 0 to 1", rules='-', stdin='{minim}:{maxim}:0:1'.format(minim=info['min'], maxim=info['max'])) mean = gcore.parse_key_val(gcore.read_command('r.univar', map=probab_01, flags='g'), val_type=float)['mean'] resolution = count / (mean * (info['north'] - info['south'] + info['east'] - info['west'])) resolution = sqrt((mean * (info['north'] - info['south']) * (info['east'] - info['west'])) / count) gcore.run_command('g.region', res=resolution) random_name = 'random_' + str(os.getpid()) point_map = 'points_' + str(os.getpid()) point_grid = 'points_' + str(os.getpid()) TMP_RAST.append(random_name) TMP_RAST.append(point_map) TMP_VECT.append(point_grid) gcore.run_command('r.surf.random', output=random_name, min=0, max=1) grast.mapcalc(exp='{point_map} = if({rand} <= {prob}, 1, null())'.format(rand=random_name, prob=probab_01, point_map=point_map)) gcore.run_command('r.to.vect', flags='t', input=point_map, output=point_grid, type='point') gcore.run_command('v.perturb', input=point_grid, output=output, parameter=resolution / 2., seed=os.getpid())
def main(): options, unused = gcore.parser() drape_map = options['color'] relief_map = options['shade'] brighten = options['brighten'] try: gcore.run_command('d.his', hue=drape_map, intensity=relief_map, brighten=brighten) except CalledModuleError: gcore.fatal(_("Module %s failed. Check the above error messages.") % 'd.his')
def main(): options, flags = gcore.parser() gisenv = gcore.gisenv() if "MONITOR" in gisenv: cmd_file = gisenv["MONITOR_{monitor}_CMDFILE".format(monitor=gisenv["MONITOR"].upper())] dout_cmd = "d.what.vect" for param, val in options.iteritems(): if val: dout_cmd += " {param}={val}".format(param=param, val=val) with open(cmd_file, "a") as file_: file_.write(dout_cmd) else: gcore.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
def main(): options, flags = gcore.parser() gisenv = gcore.gisenv() if 'MONITOR' in gisenv: cmd_file = gcore.parse_command('d.mon', flags='g')['cmd'] dout_cmd = 'd.out.file' for param, val in options.items(): if val: dout_cmd += " {param}={val}".format(param=param, val=val) with open(cmd_file, "a") as file_: file_.write(dout_cmd) else: gcore.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
def main(): options, flags = gcore.parser() gisenv = gcore.gisenv() if 'MONITOR' in gisenv: cmd_file = gcore.parse_command('d.mon', flags='g').get('cmd', None) if not cmd_file: gcore.fatal(_("Unable to open file '%s'") % cmd_file) dout_cmd = 'd.what.vect' for param, val in options.iteritems(): if val: dout_cmd += " {param}={val}".format(param=param, val=val) with open(cmd_file, "a") as file_: file_.write(dout_cmd) else: gcore.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
def main(): options, flags = gcore.parser() print options, flags gisenv = gcore.gisenv() if 'MONITOR' in gisenv: cmd_file = gisenv['MONITOR_{monitor}_CMDFILE'.format(monitor=gisenv['MONITOR'].upper())] d_cmd = 'd.to.rast' for param, val in options.iteritems(): if val: d_cmd += " {param}={val}".format(param=param, val=val) if gcore.overwrite(): d_cmd += ' --overwrite' with open(cmd_file, "a") as file_: file_.write(d_cmd) else: gcore.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
def main(): options, flags = gcore.parser() drape_map = options['color'] relief_map = options['shade'] brighten = int(options['brighten']) output_map = options['output'] bgcolor = options['bgcolor'] rhis_extra_args = {} if bgcolor: rhis_extra_args['bgcolor'] = bgcolor if flags['c']: rhis_extra_args['flags'] = 'c' to_remove = [] try: unique_name = 'tmp__rshade_%d' % os.getpid() tmp_base = '%s_drape' % unique_name tmp_r = tmp_base + '.r' tmp_g = tmp_base + '.g' tmp_b = tmp_base + '.b' if brighten: # steps taken from r.his manual page # how much they are similar with d.shade/d.his is unknown # perhaps even without brightness, there can be some differences # comparing to d.shade relief_map_tmp = '%s_relief' % unique_name # convert [-99, -99] to [0.01, 1.99] brighten = 1 + brighten / 100. grast.mapcalc('{n} = {c} * #{o}'.format( n=relief_map_tmp, o=relief_map, c=brighten)) gcore.run_command('r.colors', map=relief_map_tmp, color='grey255') relief_map = relief_map_tmp to_remove.append(relief_map_tmp) gcore.run_command('r.his', hue=drape_map, intensity=relief_map, red=tmp_r, green=tmp_g, blue=tmp_b, **rhis_extra_args) to_remove.extend([tmp_r, tmp_g, tmp_b]) gcore.run_command('r.composite', red=tmp_r, green=tmp_g, blue=tmp_b, output=output_map) remove(to_remove) # who knows if finally is called when exit except CalledModuleError, error: remove(to_remove) # TODO: implement module name to CalledModuleError gcore.fatal(_("Module %s failed. Check the above error messages.") % error.cmd)
def main(): options, flags = gcore.parser() # main options map_name = options['input'] output_file = options['output'] # TODO: other options of g.proj are not supported epsg_code = int(options['epsg']) # r.out.png options compression = int(options['compression']) # both flags (tw) passed to r.out.png routpng_flags = '' if flags['t']: routpng_flags += 't' if flags['w']: routpng_flags += 'w' if flags['l']: wgs84_file = output_file + '.wgs84' else: wgs84_file = None if flags['m']: use_region = False else: use_region = True if '@' in map_name: map_name, src_mapset_name = map_name.split('@') else: # TODO: maybe mapset is mandatory for those out of current mapset? src_mapset_name = '' export_png_in_projection(map_name=map_name, src_mapset_name=src_mapset_name, output_file=output_file, epsg_code=epsg_code, compression=compression, routpng_flags=routpng_flags, wgs84_file=wgs84_file, use_region=use_region)
def main(): options, flags = gcore.parser() aspect = options['aspect'] speed = options['speed'] probability = options['probability'] if options['particle_base']: particle_base = options['particle_base'] + '_' else: particle_base = None if options['particles']: particles = options['particles'] min_size = float(options['min_size']) max_size = float(options['max_size']) comet_length = int(options['comet_length']) else: particles = min_size = max_size = comet_length = None try: total_time = int(options['total_time']) step = int(options['step']) age = int(options['age']) count = int(options['count']) except ValueError: gcore.fatal(_("Parameter should be integer")) gcore.use_temp_region() # create aspect in x and y direction aspect_x = 'aspect_x_' + str(os.getpid()) aspect_y = 'aspect_y_' + str(os.getpid()) xshift_tmp = 'xshift_tmp_' + str(os.getpid()) yshift_tmp = 'yshift_tmp_' + str(os.getpid()) TMP_RAST.append(aspect_x) TMP_RAST.append(aspect_y) grast.mapcalc(exp="{aspect_x} = cos({aspect})".format(aspect_x=aspect_x, aspect=aspect)) grast.mapcalc(exp="{aspect_y} = sin({aspect})".format(aspect_y=aspect_y, aspect=aspect)) grast.mapcalc(exp="{xshift} = {aspect_x}*{speed}*{t}".format(xshift=xshift_tmp, t=step, speed=speed, aspect_x=aspect_x), overwrite=True) grast.mapcalc(exp="{yshift} = {aspect_y}*{speed}*{t}".format(yshift=yshift_tmp, t=step, speed=speed, aspect_y=aspect_y), overwrite=True) # initialize vector_tmp1 = 'vector_tmp1_' + str(os.getpid()) vector_tmp2 = 'vector_tmp2_' + str(os.getpid()) vector_tmp3 = 'vector_tmp3_' + str(os.getpid()) vector_region = 'vector_region_' + str(os.getpid()) TMP_VECT.extend([vector_tmp1, vector_tmp2, vector_tmp3, vector_region]) random_tmp = 'random_tmp_' + str(os.getpid()) TMP_RAST.extend([xshift_tmp, yshift_tmp, random_tmp]) gcore.run_command('v.in.region', output=vector_region, type='area') loop = 0 vector_1 = particle_base + "{0:03d}".format(loop) generate_points(name=vector_1, probability_map=probability, count=count) grast.mapcalc(exp="{random} = int(rand(1, {maxt}))".format(random=random_tmp, maxt=age + 1)) gcore.run_command('v.what.rast', map=vector_1, raster=random_tmp, column='t') write_vect_history('v.particles', options, flags, vector_1) vector_names = [vector_1, ] for time in range(0, total_time + step, step): vector_1 = particle_base + "{0:03d}".format(loop) vector_2 = particle_base + "{0:03d}".format(loop + 1) vector_names.append(vector_2) gcore.run_command('v.what.rast', map=vector_1, raster=xshift_tmp, column='xshift') gcore.run_command('v.what.rast', map=vector_1, raster=yshift_tmp, column='yshift') gcore.run_command('v.transform', layer=1, input=vector_1, output=vector_2, columns='xshift:xshift,yshift:yshift', quiet=True) # increase age gcore.info("Increasing age...") sql = 'UPDATE {table} SET t=t+1;'.format(table=vector_2) gcore.run_command('db.execute', sql=sql) # remove old points gcore.info("Removing old points...") gcore.run_command('v.select', overwrite=True, ainput=vector_2, atype='point', binput=vector_region, btype='area', operator='within', output=vector_tmp1) gcore.run_command('v.extract', input=vector_tmp1, layer=1, type='point', where="t <= " + str(age) + " AND xshift IS NOT NULL", output=vector_tmp2, overwrite=True) # generate new points gcore.info("Generating new points...") count_to_generate = count - gvect.vector_info(vector_tmp2)['points'] if count_to_generate > 0: generate_points(name=vector_tmp3, probability_map=probability, count=count_to_generate, overwrite=True) gcore.info("Patchig new and old points...") gcore.run_command('v.patch', flags='e', input=[vector_tmp2, vector_tmp3], output=vector_2, overwrite=True) sql = 'UPDATE {table} SET t={t} WHERE t IS NULL;'.format(table=vector_2, t=0) gcore.run_command('db.execute', sql=sql) write_vect_history('v.particles', options, flags, vector_2) loop += 1 # Make sure the temporal database exists tgis.init() tgis.open_new_space_time_dataset(particle_base[:-1], type='stvds', temporaltype='relative', title="title", descr='desc', semantic='mean', dbif=None, overwrite=gcore.overwrite()) # TODO: we must start from 1 because there is a bug in register_maps_in_space_time_dataset tgis.register_maps_in_space_time_dataset( type='vect', name=particle_base[:-1], maps=','.join(vector_names), start=str(1), end=None, unit='seconds', increment=step, interval=False, dbif=None) # create one vector map with multiple layers fd, path = tempfile.mkstemp(text=True) tmpfile = open(path, 'w') k = 0 for vector in vector_names: k += 1 layers = [x for x in range(k - comet_length + 1, k + 1) if x > 0] categories = list(range(len(layers), 0, -1)) text = '' for layer, cat in zip(layers, categories): text += '{l} {c}\n'.format(l=layer, c=cat) coords = gcore.read_command('v.to.db', flags='p', quiet=True, map=vector, type='point', option='coor', separator=" ").strip() for coord in coords.split('\n'): coord = coord.split() tmpfile.write('P 1 {n_cat}\n{x} {y}\n'.format(n_cat=len(categories), x=coord[1], y=coord[2])) tmpfile.write(text) tmpfile.close() gcore.run_command('v.in.ascii', flags='n', overwrite=True, input=path, output=particles, format='standard', separator=" ") os.close(fd) os.remove(path) k = 0 sql = [] sizes = get_sizes(max_size, min_size, comet_length) temporal_maps = [] for vector in vector_names: k += 1 table = 't' + str(k) gcore.run_command('v.db.addtable', map=particles, table=table, layer=k, column="width double precision") temporal_maps.append(particles + ':' + str(k)) for i in range(comet_length): sql.append("UPDATE {table} SET width={w:.1f} WHERE cat={c}".format(table=table, w=sizes[i][1], c=sizes[i][0])) gcore.write_command('db.execute', input='-', stdin=';\n'.join(sql)) tgis.open_new_space_time_dataset(particles, type='stvds', temporaltype='relative', title="title", descr='desc', semantic='mean', dbif=None, overwrite=True) # TODO: we must start from 1 because there is a bug in register_maps_in_space_time_dataset tgis.register_maps_in_space_time_dataset( type='vect', name=particles, maps=','.join(temporal_maps), start=str(1), end=None, unit='seconds', increment=step, interval=False, dbif=None) write_vect_history('v.particles', options, flags, particles)
# Try to connect print("Testing connection ...") sys.stdout.flush() if grass.run_command('db.select', quiet=True, flags='c', driver="pg", database=conn, sql="select version()") != 0: if user or password: print("Deleting login (db.login) ...") sys.stdout.flush() if grass.run_command('db.login', quiet=True, driver="pg", database=conn, user="", password="") != 0: print("Cannot delete login.") sys.stdout.flush() grass.fatal("Cannot connect to database.") if grass.run_command( 'db.connect', driver="pg", database=conn, schema=schema) != 0: grass.fatal("Cannot connect to database.") if __name__ == "__main__": options, flags = grass.parser() main()
if not options['at']: fatal(_("Required parameter <%s> not set") % "at") # create new frame if not exists create_frame(monitor, options['frame'], options['at']) else: if os.getenv('GRASS_OVERWRITE', '0') == '1': warning( _("Frame <%s> already exists and will be overwritten") % options['frame']) create_frame(monitor, options['frame'], options['at'], overwrite=True) else: if options['at']: warning( _("Frame <%s> already found. An existing frame can be overwritten by '%s' flag." ) % (options['frame'], "--overwrite")) # select givenframe select_frame(monitor, options['frame']) if __name__ == "__main__": if len(sys.argv) == 2 and sys.argv[1] == '--doctest': import doctest _ = str # doctest gettext workaround sys.exit(doctest.testmod().failed) options, flags = parser() sys.exit(main())
def main(): options, flags = gcore.parser() # it does not check if pngs and other files exists, # maybe it could check the any/all file(s) dir if options['raster'] and options['strds']: gcore.fatal(_("Options raster and strds cannot be specified together." " Please decide for one of them.")) if options['raster'] and options['where']: gcore.fatal(_("Option where cannot be combined with the option raster." " Please don't set where option or use strds option" " instead of raster option.")) if options['raster']: if ',' in options['raster']: maps = options['raster'].split(',') # TODO: skip empty parts else: maps = [options['raster']] elif options['strds']: # import and init only when needed # init is called anyway when the generated form is used import grass.temporal as tgis strds = options['strds'] where = options['where'] # make sure the temporal database exists tgis.init() # create the space time raster object ds = tgis.open_old_space_time_dataset(strds, 'strds') # check if the dataset is in the temporal database if not ds.is_in_db(): gcore.fatal(_("Space time dataset <%s> not found") % strds) # we need a database interface dbiface = tgis.SQLDatabaseInterfaceConnection() dbiface.connect() # the query rows = ds.get_registered_maps(columns='id', where=where, order='start_time') if not rows: gcore.fatal(_("Cannot get any maps for spatio-temporal raster" " dataset <%s>." " Dataset is empty or you temporal WHERE" " condition filtered all maps out." " Please, specify another dataset," " put maps into this dataset" " or correct your WHERE condition.") % strds) maps = [row['id'] for row in rows] else: gcore.fatal(_("Either raster or strds option must be specified." " Please specify one of them.")) # get the number of maps for later use num_maps = len(maps) out_dir = options['output'] if not os.path.exists(out_dir): # TODO: maybe we could create the last dir on specified path? gcore.fatal(_("Output path <%s> does not exists." " You need to create the (empty) output directory" " yourself before running this module.") % out_dir) epsg = int(options['epsg']) if ',' in options['opacity']: opacities = [float(opacity) for opacity in options['opacity'].split(',')] if len(opacities) != num_maps: gcore.fatal(_("Number of opacities <{no}> does not match number" " of maps <{nm}>.").format(no=len(opacities), nm=num_maps)) else: opacities = [float(options['opacity'])] * num_maps if ',' in options['info']: infos = options['info'].split(',') else: infos = [options['info']] # r.out.png options compression = int(options['compression']) # flag w is passed to r.out.png.proj # our flag n is inversion of r.out.png.proj's t flag # (transparent NULLs are better for overlay) # we always need the l flag (ll .wgs84 file) routpng_flags = '' if not flags['n']: routpng_flags += 't' if flags['w']: routpng_flags += 'w' # r.out.png.proj l flag for LL .wgs84 file is now function parameter # and is specified bellow if flags['m']: use_region = False # we will use map extent gcore.use_temp_region() else: use_region = True # hard coded file names data_file_name = 'data_file.csv' js_data_file_name = 'data_file.js' data_file = open(os.path.join(out_dir, data_file_name), 'w') js_data_file = open(os.path.join(out_dir, js_data_file_name), 'w') js_data_file.write('/* This file was generated by r.out.leaflet GRASS GIS' ' module. */\n\n') js_data_file.write('var layerInfos = [\n') for i, map_name in enumerate(maps): if not use_region: if gcore.run_command('g.region', rast=map_name): raise RuntimeError("Cannot set region from map <%s>." % map_name) if '@' in map_name: pure_map_name = map_name.split('@')[0] else: pure_map_name = map_name # TODO: mixing current and map's mapset at this point if '@' in map_name: map_name, src_mapset_name = map_name.split('@') else: # TODO: maybe mapset is mandatory for those out of current mapset? src_mapset_name = gcore.gisenv()['MAPSET'] image_file_name = pure_map_name + '.png' image_file_path = os.path.join(out_dir, image_file_name) # TODO: skip writing to file and extract the information from # function, or use object if function is so large wgs84_file = image_file_path + '.wgs84' export_png_in_projection(map_name=map_name, src_mapset_name=src_mapset_name, output_file=image_file_path, epsg_code=epsg, compression=compression, routpng_flags=routpng_flags, wgs84_file=wgs84_file, use_region=True) data_file.write(pure_map_name + ',' + image_file_name + '\n') # it doesn't matter in which location we are, it just uses the current # location, not tested for LL loc, assuming that to be nop. map_extent = get_map_extent_for_file(wgs84_file) bounds = map_extent_to_js_leaflet_list(map_extent) extra_attributes = [] generate_infos(map_name=map_name, projected_png_file=image_file_path, required_infos=infos, output_directory=out_dir, attributes=extra_attributes) # http://www.w3schools.com/js/js_objects.asp js_data_file.write(""" {{title: "{title}", file: "{file_}",""" """ bounds: {bounds}, opacity: {opacity}""" .format(title=pure_map_name, file_=image_file_name, bounds=bounds, opacity=opacities[i])) if extra_attributes: extra_js_attributes = [pair[0] + ': "' + escape_quotes( escape_endlines( escape_backslashes( pair[1] ))) + '"' for pair in extra_attributes] js_data_file.write(', ' + ', '.join(extra_js_attributes)) js_data_file.write("""}\n""") # do not write after the last item if i < num_maps - 1: js_data_file.write(',') js_data_file.write('];\n') data_file.close()
gpot.r_norm_thermal_alteration(gmax, tc, uc, us, execute=True, overwrite=OVER) power = opts['power'] gpot.r_power(power, tc, ground_conductivity, ground_temperature, fluid_limit_temperature, borehole_length, borehole_resistence, gmax, execute=True, overwrite=OVER) command = "{new} = if({old}<0, null(), {old})".format(old=power, new=power) mapcalc(command, overwrite=True) # TODO: add warning energy = opts['energy'] gpot.r_energy(energy, power, execute=True, overwrite=OVER) if __name__ == "__main__": options, flags = gcore.parser() main(options, flags) sys.exit(0)
else: try: gcore.run_command('v.out.ogr', quiet=True, input=input, layer=layer, output=output, format=format, type='point,line,area') except CalledModuleError: gcore.fatal(_("Module <%s> failed") % 'v.out.ogr') if format == "ESRI_Shapefile": exts = ['shp', 'shx', 'prj'] if output.endswith('.dbf'): outname = basename(output, 'dbf') for ext in exts: try_remove("%s.%s" % (outname, ext)) outname += '.dbf' else: for ext in exts: try_remove(os.path.join(output, "%s.%s" % (input, ext))) outname = os.path.join(output, input + ".dbf") elif format.lower() == 'csv': outname = output + '.csv' else: outname = input gcore.message(_("Exported table <%s>") % outname) if __name__ == "__main__": options, flags = gcore.parser() main()
#%option G_OPT_R_OUTPUT #% key: output #% description: Name of output raster map #%end #%option #% key: algorithm #% type: string #% options: l,nn,ns #% answer: nn #% descriptions: l;Linear;nn;Sibson natural neighbor;ns;Non-Sibsonian natural neighbor #% description: Settings #%end import os import sys from grass.script.core import parser import grass.script as grass from nnbathy import Nnbathy_raster def main(): obj = Nnbathy_raster(options) obj.compute() obj.create_output() if __name__ == "__main__": options, flags = parser() main()
toolboxes = toolboxes2dict(tool_root.findall('toolbox')) enrg_tools = toolboxes2dict(ET.fromstring(XMLENERGYTOOLBOX)) # update the energy toolboxes print("Updating", tool_path) for key in enrg_tools: if key in toolboxes: tool_root.remove(toolboxes[key]) tool_root.append(enrg_tools[key]) tool_tree.write(tool_path) grass_tool_path = join(os.getenv('GISBASE'), 'gui', 'wxpython', 'xml') user_tool_path = join(get_settings_path(), 'toolboxes') # read XML input files main_path = get_or_create('main_menu.xml', grass_tool_path, user_tool_path) tool_path = get_or_create('toolboxes.xml', grass_tool_path, user_tool_path) read_update_xml(main_path, tool_path) if __name__ == "__main__": opts, flgs = gcore.parser() check_install_pip(flgs['i']) fix_missing_libraries(flgs['i']) if flgs['x']: add_rgreen_menu()
if host: conn += ",host=" + host if port: conn += ",port=" + port # Unfortunately we cannot test untill user/password is set if user or password: print("Setting login (db.login) ... ") sys.stdout.flush() if grass.run_command('db.login', driver="pg", database=conn, user=user, password=password) != 0: grass.fatal("Cannot login") # Try to connect print("Testing connection ...") sys.stdout.flush() if grass.run_command('db.select', quiet=True, flags='c', driver="pg", database=conn, sql="select version()") != 0: if user or password: print("Deleting login (db.login) ...") sys.stdout.flush() if grass.run_command('db.login', quiet=True, driver="pg", database=conn, user="", password="") != 0: print("Cannot delete login.") sys.stdout.flush() grass.fatal("Cannot connect to database.") if grass.run_command('db.connect', driver="pg", database=conn, schema=schema) != 0: grass.fatal("Cannot connect to database.") if __name__ == "__main__": options, flags = grass.parser() main()
) run_command( "r.mapcalc", overwrite=ow, expression=ECOHF % tuple( map( float, ( opts["energy_tops_hf"], opts["energy_tops_hf"], opts["energy_cormometric_vol_hf"], ), )), ) run_command("r.mapcalc", overwrite=ow, expression=ECOCC) run_command("r.mapcalc", overwrite=ow, expression=ECOT) with RasterRow(p_bioenergy) as pT: T = np.array(pT) print("Resulted maps: " + output + "_t_bioenergyHF, " + output + "_t_bioenergyC, " + output + "_t_bioenergy") print("Total bioenergy stimated (Mwh): %.2f" % np.nansum(T)) if __name__ == "__main__": main(*parser())