Modules

Module rawdata

This module contains all functions, necessary for the inititation of an emipy project.

emipy.rawdata.change_RootPath(path)

Changes the path of the root to the project in the configuration.ini file.

Parameters:path (String) – Path to the project, which is to access.
Returns:
Return type:None.
emipy.rawdata.download_MapData(path, resolution=10, clear=False, chunk_size=128)

Download shp files to given path

Parameters:
  • path (String) – Path to the root of the project.
  • resolution (int/list, optional) – Defines the resolution, that the downloaded maps have. Selectable are 1,3,10,20,60. The default is 10.
  • clear (Boolean) – If put on True, the function clears the MappingData Directory, before downloading the data., The default is False.
  • chunk_size (TYPE, optional) – DESCRIPTION. The default is 128.
Returns:

Return type:

None.

emipy.rawdata.download_NACE_TransitionTables(path)

Creates, if necessary, the folder TransitionData in the given path and downloads NACE transition tables from Eurostat to save them in the folder TransitionData.

Parameters:path (String) – Path to the root of the project.
Returns:
Return type:None.
emipy.rawdata.download_PollutionData(path, chunk_size=128)

Downloads the pollution data into given path.

Parameters:
  • path (String) – Path to the root of the project.
  • chunk_size (TYPE, optional) – DESCRIPTION. The default is 128.
Returns:

Return type:

None.

emipy.rawdata.generate_PollutionData_2(path)

Generates the new data set. For this, the function downloads the .pkl file from the emipy repository, decompresses it and renames the columns.

Parameters:path (String) – Path to the root of the project.
Returns:data2 – The new data base in the format, that enables the emipy functions to act on it.
Return type:DataFrame
emipy.rawdata.get_RootPath()

Returns the current root path, stored in the config file.

Returns:path – Current path to the root of the project, stored in the config file.
Return type:String
emipy.rawdata.init_emipy_project(path, resolution=10, force_rerun=False)

Executes the initiation of a new project. Downloads all needed data to the given path and merges data of interest.

Parameters:
  • path (String) – Path to root of project.
  • force_rerun (Boolean, optional) – Forces the programm to rerun the merging routine, if True. The default is False.
  • resolution (int/list, optional) – Defines the resolution, that the downloaded maps have. Selectable are 1,3,10,20,60. The default is 10.
Returns:

Return type:

None.

emipy.rawdata.merge_PollutionData(path, force_rerun=False)

Inserts tables with different data into each other.

Parameters:
  • path (String) – Path to the root of the project.
  • force_rerun (Boolean, optional) – If true, the function executes the routine even if the destination folder already contains corresponding files.. The default is False.
Returns:

Return type:

None.

emipy.rawdata.pickle_RawData(path, force_rerun=False)

loads files of interest, converts them into .pkl file and saves them in the same path.

Parameters:
  • path (String) – Path to the root of the project.
  • force_rerun (Boolean, optional) – If true, the function executes the routine even if the destination folder already contains corresponding files.. The default is False.
Returns:

Return type:

None.

Module processdata

This module contains all functions to produce the data set of interest.

emipy.processdata.change_ColumnsOfInterest(total=None, add=None, sub=None, reset=False)

Changes the list of column names in the config file, that are of interest.

Parameters:
  • total (List/String, optional) – Replaces the column names at all with the given list. If total is a string the names have to be seperated by a “,”. The default is None.
  • add (List/String, optional) – Adds the given column names to the existing ones. If add is a string the names have to be seperated by a “,”.The default is None.
  • sub (List/String, optional) – Subtracts the given column names from the existing ones. If sub is a string the names have to be seperated by a “,”.The default is None.
  • reset (Boolean, optional) – Resets the list of column names to the presettings. The default is False.
Returns:

config[‘COLUMNSOFINTEREST’] – Updated list of columnsofinterest.

Return type:

dict

emipy.processdata.change_NACECode_filter(total=None, add=None, sub=None)

Changes the NACE code dict in the config file.

Parameters:
  • total (Dict, optional) – Replacement dictionary that replaces the complete NACE code dict. The default is None.
  • add (Dict, optional) – Dictionary that gets added to the NACE code dict. The default is None.
  • sub (Dict, optional) – Dictionary that is substracted from the NACE code dict. The default is None.
Returns:

Return type:

None

emipy.processdata.change_RenameDict(total=None, add=None, sub=None, reset=False)

Changes the column name dict in the config file and returns the actual column names dict.

Parameters:
  • total (Dict, optional) – Replacement dictionary that replaces the complete column name dict. The default is None.
  • add (Dict, optional) – Dictionary that gets added to the column name dict. The default is None.
  • sub (Dict, optional) – Dictionary that is substracted from the column name dict. The default is None.
  • reset (Boolean, optional) – If True, the column name dict gets resetted to the standard settings. The default is False.
Returns:

config[‘COLUMNNAMES’] – actualised column name dictionary.

Return type:

dict

emipy.processdata.change_unit(db, unit=None)

Changes the units of the emission in the table and adapts the numbers of TotalQuantity and AccidentalQuantity in the according way. If no unit is given, no changes are applied.

Parameters:
  • db (DataFrame) – DataFrame which units are to be changed.
  • unit (string, optional) – New unit name. The default is None.
Returns:

data_out – DataFrame with changed emission units.

Return type:

DataFrame

emipy.processdata.export_db_to_csv(db, path=None, filename=None, **kwargs)

Stores the DataFrame given in the input as a .csv file to the given path, or if the path is not given to the ExportData folder in the root path with the given filename.

Parameters:
  • db (DataFrame) – Filtered database, that is to export.
  • path (String, optional) – Path under which the DataFrame is stored.
  • filename (String, optional) – If the path is not given, this is the file name under which the DataFrame ist stored in the ExportData folder of the project
  • kwargs (Type, optional) – pandas.to_csv() input arguments
Returns:

Return type:

None

emipy.processdata.export_db_to_excel(db, path=None, filename=None, **kwargs)

Stores the DataFrame given in the input as a .xlsx file to the given path, or if the path is not given to the ExportData folder in the root path with the given filename.

Parameters:
  • db (DataFrame) – Filtered database, that is to export.
  • path (String, optional) – Path under which the DataFrame is stored.
  • filename (String, optional) – If the path is not given, this is the file name under which the DataFrame ist stored in the ExportData folder of the project
  • kwargs (Type, optional) – pandas.to_excel() input arguments
Returns:

Return type:

None

emipy.processdata.export_db_to_pickle(db, path=None, filename=None, **kwargs)

Stores the DataFrame given in the input as a .pkl file to the given path, or if the path is not given to the ExportData folder in the root path with the given filename.

Parameters:
  • db (DataFrame) – Filtered database, that is to export.
  • path (String, optional) – Path under which the DataFrame is stored.
  • filename (String, optional) – If the path is not given, this is the file name under which the DataFrame ist stored in the ExportData folder of the project
  • kwargs (Type, optional) – pandas.to_pickle() input arguments
Returns:

Return type:

None

emipy.processdata.f_db(db, FacilityReportID=None, CountryName=None, ReportingYear=None, ReleaseMediumName=None, PollutantName=None, PollutantGroupName=None, NACEMainEconomicActivityCode=None, NUTSRegionGeoCode=None, ParentCompanyName=None, FacilityName=None, City=None, PostalCode=None, CountryCode=None, RBDGeoCode=None, RBDGeoName=None, NUTSRegionGeoName=None, NACEMainEconomicActivityName=None, MainIASectorCode=None, MainIASectorName=None, MainIAActivityCode=None, MainIAActivityName=None, PollutantReleaseID=None, ReleaseMediumCode=None, PollutantCode=None, PollutantGroupCode=None, ExclaveExclude=False, ReturnUnknown=False)

Takes DataFrame and filters out data, according to input parameters.

Parameters:
  • db (DataFrame) – Input DataFrame.
  • FacilityReportID (Int/String/List, optional) – List of FacilityReportID’s to be maintained. In the data from 2001-2017 this entry is an integer. Therefore we have to use integers or a list of integers for the filtering. In the data from 2017-2019 this is stored as a string. Therefore we have to use a string or a list of strings for the filtering. The default is None.
  • CountryName (String/List, optional) – List of countries to be maintained. The default is None.
  • ReportingYear (String/List, optional) – List of reporting years to be maintained. The default is None.
  • ReleaseMediumName (String/List, optional) – List of release medium names to be maintained. The default is None.
  • PollutantName (String/List, optional) – List of pollutant names to be maintained. The default is None.
  • PollutantGroupName (String/List, optional) – List of polllutant group names to be maintained. The default is None.
  • NACEMainEconomicActivityCode (String/List, optional) – List of NACE main economic activity codes to be maintained. The default is None.
  • NUTSRegionGeoCode (String/List, optional) – List of NUTS region geocodes to be maintained. The default is None.
  • ParentCompanyName (String/List, optional) – List of Parent company names to be maintained. The default is None.
  • FacilityName (String/List, optional) – List of facility names to be maintained. The default is None.
  • City (String/list, optional) – List of cities to be maintained. The default is None.
  • PostalCode (String/List, optional) – List of postal codes to be a´maintained. The default is None.
  • CountryCode (String/List, optional) – List of country codes to be maintained. The default is None.
  • RBDGeoCode (String/List, optional) – List of River Basin District geo codes to be maintained. The default is None.
  • RBDGeoName (String/List, optional) – List of River Basin District geo names to be maintained. The default is None.
  • NUTSRegionGeoName (String/List, optional) – List of NUTS region geo names to be maintained. The default is None.
  • NACEMainEconomicActivityName (String/List, optional) – List of NACE main economic activity names to be maintained. The default is None.
  • MainIASectorCode (String/List, optional) – List of Investment Association sector codes to be maintained. The default is None.
  • MainIASectorName (String/List, optional) – List of Investmend Association sector names to be maintained. The default is None.
  • MainIAActivityCode (String/List, optional) – List of Investmend Association activity codes to be maintained. The default is None.
  • MainIAActivityName (String/List, optional) – List of Investmend Association activity names to be maintained. The default is None.
  • PollutantReleaseID (Int/List, optional) – List of pollutant release IDs to be maintained. The default is None.
  • ReleaseMediumCode (String/List, optional) – List of realease medium codes to be maintained. The default is None.
  • PollutantCode (String/List, optional) – List of pollutant codes to be maintained. The default is None.
  • PollutantGroupCode (String/List, optional) – List of pollutant group codes to be maintained. The default is None.
  • ExclaveExclude (Boolean, optional) – If True, exclaves that are unique NUTS-LVL1 regions are excluded. The default is False.
  • ReturnUnknown (Boolean, optional) – If True, function returns DataFrame that is sorted out due to not enough information for the filter process. The default is False.
Returns:

  • db (DataFrame) – DataFrame after filter process.
  • dbna (DataFrame) – DataFrame that is filtered out, but has na values for the filter column. If they are filtered out correctly is not known.

emipy.processdata.f_mb(mb, NUTS_ID=None, CNTR_CODE=None, NAME_LATN=None, ExclaveExclude=False)

Filters the geometry data of the DataFrame by the specifications of the input.

Parameters:
  • mb (DataFrame) – Input DataFrame.
  • NUTS_ID (String/List, optional) – NUTS:ID assigned from eurostat. The default is None.
  • CNTR_CODE (String/List, optional) – Country code. The default is None.
  • NAME_LATN (String/List, optional) – Name of Region, classified by eurostat. The default is None.
Returns:

mb – DataFrame with geometry data of the specified conditions.

Return type:

DataFrame

emipy.processdata.get_CNTR_CODEList(mb)

returns list of all possible CountryCodes in the given DataFrame.

Parameters:mb (DataFrame) – Data of interest.
Returns:CNTR_CODEList – list of all Country codes present in the current DataFrame.
Return type:list
emipy.processdata.get_CountryList(db)

Returns a list of all appearing countries in given dataframe.

Parameters:db (DataFrame) – Data in which is looked for unique countries.
Returns:CountryList – List of unique countries.
Return type:List
emipy.processdata.get_NACECode_filter(specify=None)

If not specified, this function returns a dict with all stored NACECODE dictionaries. If specified, it returns the corresponding NACECODES as a list.

Parameters:specify (String/List of Strings, optional) – Specify for wich economical categories you want to have the NACECODES. You can get a list of all selection options, with executing this function with specify=None. The default is None.
Returns:NACElist – If specify is None it returns a Dict with all stored NACECODE dictionarys. If specify is not None it returns the according NACECODES in a list.
Return type:Dict/List
emipy.processdata.get_NACECode_filter_industry(group=None)

Creates a list of NACE codes corresponding to the selected industry sectors.

Parameters:group (String, optional) – industry sector. The default is None.
Returns:NACECode – list of NACE codes corresponding to the specified industry sectors.
Return type:List
emipy.processdata.get_PollutantList(db)

Returns a list of all appearing pollutant names in given dataframe.

Parameters:db (DataFrame) – Data in which is looked for unique pollutant names.
Returns:PollutantList – List of unique pollutant names.
Return type:List
emipy.processdata.get_YearList(db)

Returns a list of all appearing reporting years in given dataframe.

Parameters:db (DataFrame) – Data in which is looked for unique reporting years.
Returns:YearList – List of unique reporting years.
Return type:List
emipy.processdata.perform_NACETransition(db, NewNACE=2, path=None)

Changes the NACE_1_1 Codes of the input DataFrame into NACE_2 Codes.

Parameters:
  • db (DataFrame) – Input DataFrame with partly entries that are coded with NACE_1_1.
  • NewNACE (Int, optional) – The target NACE-code. The default is 2.
  • path (String, optional) – Path to the root of your project. If None is given, emipy searches for the path, stored in the config file. The default is None.
Returns:

final – The input DataFrame with changed NACE-codes if necessary.

Return type:

DataFrame

emipy.processdata.read_db(path=None, NewData=False)

Loads complete pollution record.

Parameters:
  • path (String, optional) –
    Path to the file, that is to be loaded. The file has to be a .pkl file. If None is given, the function loads
    the data file, stored in the emipy project, that is specified in the config file. The default is ‘None’.
  • NewData (Boolean, optional) – If this is set to True, the data base with data from 2017 - 2019 is loaded instead of the one with data from 2001 - 2017. The default is False.
Returns:

db – Pollution record for either the years 2001-2017 or 2017-2019.

Return type:

DataFrame

emipy.processdata.read_mb(path=None, resolution='10M', SpatialType='RG', NUTS_LVL=0, m_year=2016, projection=4326)

Reads the shp file with the specifications given in the input to load the map data.

Parameters:
  • path (String, optional) – Path of the file, that is to be loaded. The file has to be a .shp file. If None is given, the function loads the shp file in the emipy project, that is specified in the config file. The default is None.
  • resolution (String) – Resolution of the map. The default is ‘10M’.
  • SpatialType (String) – Format of data presentation. The default is ‘RG’.
  • NUTS_LVL (Int, optional) – NUTS-classification level, defined by the eurostat. The default is 0.
  • m_year (Int) – Year of publication of the geographical data. The default is 2016.
  • projection (Int) – Projection on the globe. The default is 4326.
Returns:

mb – DataFrame with geometry data.

Return type:

DataFrame

emipy.processdata.rename_columns(db)

Renames column names of the DataFrame, specified by the “COLUMNNAMES” dict in the config file.

Parameters:db (DataFrame) – DataFrame which’s column names should be changed.
Returns:db – DataFrame with changed column names.
Return type:DataFrame
emipy.processdata.row_reduction(db)

Reduces DataFrame to columns specified in the config file.

Parameters:db (DataFrame) – DataFrame which data shall be reduced.
Returns:db – DataFrame with reduced number of columns.
Return type:DatFrame

Module visualizedata

This module contains all functions to visualize the data set.

emipy.visualizedata.add_MarkerSize(gdf, MaxMarker)

adds column MarkerSize to GeoDataFrame. If MaxMarker=0, all markers have size 1. Else, they are normalized to max value and multiplied by value of MaxMarker.

Parameters:
  • gdf (GeoDataFrame) – GeoDataFrame, which gets additional column.
  • MaxMarker (Int) – defines the marker size of the biggest marker. If 0, all markers have same size.
Returns:

gdf – GeoDataFrame with added column ‘MarkerSize’.

Return type:

GeoDataFrame

emipy.visualizedata.change_proj(gdf, OutProj=None)

Changes The projection of the input GeoDataFrame to the projection defined with OutProj. If no CRS is given for the geometry, the function tries to recover information from gdf.

Parameters:
Returns:

gdf – Data with new projection in the geometry.

Return type:

GeoDataFrame

emipy.visualizedata.create_GDFWithRightProj(dfgdf, OutProj=None)

Converts DataFrame into GeoDataFrame and changes the projection if new projection is given as input.

Parameters:
  • dfgdf (DataFrame/GeoDataFrame) – Data that is about to be converted into a GeoDataFrame and experience a projection change if wanted.
  • OutProj (String, optional) – Target projection of the geometry of the data. The default is None.
Returns:

gdf – Data stored as GeoDataFrame and with eventually changed geometry CRS.

Return type:

GeoDataFrame

emipy.visualizedata.exclude_DataOutsideBorders(borders, gdf)

seperates data, that are inside and outside given borders

Parameters:
  • borders (list) – x,y min/max.
  • gdf (GeoDataFrame) – GeoDataFrame that is to process.
Returns:

  • gdft (DataFrame) – GeoDataFrame with data inside the borders.
  • gdff (DataFrame) – GeoDataFrame with data outside the borders.

emipy.visualizedata.export_fig(fig, path=None, filename=None, **kwargs)

Exports the choosen figure to a given path or to the export folder of the project if no path is given.

Parameters:
  • fig (figure) – The figure that is to export.
  • path (String, optional) – Path under which the file is stored. The filename has to be included. The default is None.
  • filename (String, optional) – Filename under which the figure is stored in the Export folder of the project. The default is None.
  • **kwargs (TYPE) – Matplotlib.savefig() input arguments.
Returns:

Return type:

None.

emipy.visualizedata.get_ImpurityVolume(db, target, FirstOrder='FacilityReportID', ReleaseMediumName='Air', absolute=False, FacilityFocus=True, impurity=None, statistics=False)

Creates a table with the impurities of the target pollutant, sorted by the FirstOrder parameter. Putting the absolute parameter to True, gives absolute values instead of relative.

Parameters:
  • db (DataFrame) – Data to look for impurities.
  • target (String) – Pollutant name of the pollutant, which is not seen as impurity.
  • FirstOrder (String, optional) – Order to sort the impurities by. E.g. NACERegionGeoCode, FacilityReportID, NACEMainEconomicActivityCode. The default is ‘FacilityReportID’.
  • ReleaseMediumName (String, optional) – The release medium name in which the target is emitted and in which can be impurities. The default is ‘Air’.
  • absolute (Boolean, optional) – If this parameter is set on False, this function returns the impurity relative to the target pollutant emission. If it is set on True, the absolute emission value is returned. The default is False.
  • FacilityFocus (Boolean, optional) – If this parameter is true, only the impurities in the facilities in which the target is emittet is taken in to consideration. If it is false, all data are taken into consideration. The default is True.
  • impurity (String, optional) – With this parameter, you can specify the impurity pollutant you want to return. Otherwise, all present impurities are shown. The default is None.
  • statistics (Boolean, optional) – If this argument is True, the statistics (determined by .describe()) of the output DataFrame are returned, instead of the usual impurity table. The default is False.
Returns:

  • d2 (DataFrame) – Data table with the rows beeing the different present order values, and in the columns their respective emission of the target pollutant and the absolute emission of the impurities.
  • d3 (DataFrame) – Data table with the rows beeing the different present order values, and in the columns their respective emission of the target pollutant and the relative emission of the impurities.

emipy.visualizedata.get_PollutantVolume(db, FirstOrder=None, SecondOrder=None)

Sorts the input data table, to the named order parameters, which are all possible column names.

Parameters:
  • db (DataFrame) – input data table.
  • FirstOrder (String, optional) – Name of column, the data are sorted in the first order. The default is None.
  • SecondOrder (TYPE, optional) – Name of column, the data are sorted in the second order. The default is None.
Returns:

data – Data table, sorted to the announced order parameters.

Return type:

DataFrame

emipy.visualizedata.get_PollutantVolumeChange(db, FirstOrder=None, SecondOrder=None)

Derives the pollutant volume change to the previous year.

Parameters:
  • db (DataFrame) – the filtered input DataFrame.
  • FirstOrder (String, optional) – Name of column, the data are sorted in the first order. The default is None.
  • SecondOrder (String, optional) – Name of column, the data are sorted in the second order. The default is None.
Returns:

data – The change of TotalQuantity to the previous data entry

Return type:

DataFrame

emipy.visualizedata.get_PollutantVolumeRel(db, FirstOrder=None, SecondOrder=None, normtop=None, normtov=None)

Normalises the volume values to one specific value. This value is either the present max value of the returned data table or is specifed by normtop(osition) or normtov(alue).

Parameters:
  • db (DataFrame) – input data table.
  • FirstOrder (String, optional) – Name of column, the data are sorted in the first order. The default is None.
  • SecondOrder (String, optional) – Name of column, the data are sorted in the second order. The default is None.
  • normtop (list, optional) – With this parameter you can choose a entry of your data table, that the entries should be normalised too. The first item of the list has to be one value of the FirstOrder. If SecondOrder is called, the second value has to be a value of the SecondOrder. The default is None.
  • normtov (float, optional) – With this parameter you can define a value, that the PollutantVolume entries are normalised to. The default is None
Returns:

data – Data table sorted to the announced parameters. The values are normed to one specific max value. If normtop and normtov are both unequal None, no normalization is applied, since there is no concrete value, that can be normed to.

Return type:

DataFrame

emipy.visualizedata.get_mb_borders(mb)

Generates a list with the borders of the objects of a GeoDataFrame.

Parameters:mb (GeoDataFrame) – Table of geo objects which over all borders are wanted.
Returns:borders – The x,y min/max values.
Return type:List
emipy.visualizedata.map_PollutantRegions(db, mb, ReturnMarker=0, *args, **kwargs)

Visualizes the pollutant emission of regions with a color map. The classification of regions is selected with the choice of mb. If ReturnMarker is put on 1, the function returns a DataFrame with the plotted data. If ReturnMarker is put on 2, the function returns the DataFrame with Data that have no complementary NUTSID in the mapdata.

Parameters:
  • db (DataFrame) – Pollution data that are plotted.
  • mb (TYPE) – Map data for plotting. The region selection corresponds to the selection of mb.
  • ReturnMarker (int) – If it has the value 0, the function returns the plot. If put on 1, the function returns a DataFrame with all data that are plotted. If put on 2, the function returns a DataFrame with all data that are not plotted, because their NUTS_ID is not present in the mapdata.
  • *args (TYPE) – Geopandas.plot() input arguments.
  • **kwargs (TYPE) – Geopandas.plot() input arguments.
Returns:

  • ax (Axes) – Axes with colormap of the pollution emission.
  • dbp (DataFrame) – Data that are plotted
  • dbna (DataFrame) – Data that are not plotted, because the NUTS_ID is not present in the mapdata.

emipy.visualizedata.map_PollutantSource(db, mb, category=None, MarkerSize=0, OutProj=None, ReturnMarker=0, *args, **kwargs)

maps pollutant sources given by db on map given by mb.

Parameters:
  • db (DataFrame/GeoDataFrame) – Data table on pollutant sources.
  • mb (DataFrame) – geo data table.
  • category (String) – The column name of db, which gets new colors for every unique entry.
  • MarkerSize (Int) – maximal size of the largest marker.
  • OutProj (DataType) – Code for targeted output projection. See http://pyproj4.github.io/pyproj/stable/api/crs/crs.html#pyproj.crs.CRS.from_user_input for input possibilities. The default is None.
  • ReturnMarker (Int) – If put on 1, the function returns a DataFrame with all data that are plotted. If put on 2, the function returns a DataFrame with all data that are not plotted, because their coordinates are outside the geo borders.
  • *args (TYPE) – Geopandas.plot() input arguments.
  • **kwargs (TYPE) – Geopandas.plot() input arguments.
Returns:

  • ax (Axes) – Plot with pollutant sources on map.
  • gdfp (GeoDataFrame) – GeoDataFrame with all sources that are within geo borders and therefore plotted.
  • gdfd (GeoDataFrame) – GeoDataFrame with all sources that are outside geo borders and therefore dropped.

emipy.visualizedata.plot_ImpurityVolume(db, target, impurity, FirstOrder='FacilityReportID', ReleaseMediumName='Air', absolute=False, FacilityFocus=True, statistics=False, PlotNA=True, *args, **kwargs)

Plots the impurities for the different FirstOrder values or the statistics of the entries.

Parameters:
  • db (DataFrame) – The data to be plotted.
  • target (String) – The target pollutant which is impured.
  • impurity (String) – The impurity which is to be analyzed.
  • FirstOrder (String, optional) – Name of column, the data are sorted in the first order. The default is ‘FacilityReportID’.
  • ReleaseMediumName (TYPE, optional) – The release medium name in which the target is emitted and in which can be impurities. The default is ‘Air’.
  • absolute (Boolean, optional) – If this parameter is set on False, this function returns the impurity relative to the target pollutant emission. If it is set on True, the absolute emission value is returned. The default is False.
  • FacilityFocus (Boolean, optional) – If this parameter is true, only the impurities in the facilities in which the target is emittet is taken in to consideration. If it is false, all data are taken into consideration. The default is True.
  • statistics (Boolean, optional) – If this parameter is True, the statistics of the data are plotted. If it is False, the actual values are plotted. The default is False.
  • PlotNA (Boolean, optional) – This argument is a option for discarding the na values if plotting the impurities. The default is True.
  • *args (TYPE) – pandas.plot() input variables.
  • **kwargs (TYPE) – pandas.plot() input variables.
Returns:

ax – Plot of the impurities in db, or the statistics of these impurities.

Return type:

Axes

emipy.visualizedata.plot_PollutantVolume(db, FirstOrder=None, SecondOrder=None, stacked=False, *args, **kwargs)

Plots the filtered data set. The first order is the x-axis, the second order is a differentiation of the y-values.

Parameters:
  • db (DataFrame) – The data to be plotted.
  • FirstOrder (String, optional) – Name of column, the data are sorted in the first order. The default is None.
  • SecondOrder (String, optional) – Name of column, the data are sorted in the second order. The default is None.
  • stacked (Boolean, optional) – Stacks the bars for second order. The default is False.
  • *args (TYPE) – pandas.plot() input variables.
  • **kwargs (TYPE) – pandas.plot() input variables.
Returns:

ax – Plot of the data in db, sorted by FirstOrder and SecondOrder if given.

Return type:

Axes

emipy.visualizedata.plot_PollutantVolumeChange(db, FirstOrder=None, SecondOrder=None, stacked=False, *args, **kwargs)
Plots the volume change of the data set. The first order is the x-axis, the second order
is a differentiation of the y-values.
Parameters:
  • db (DataFrame) – The data to be plotted.
  • FirstOrder (String, optional) – Name of column, the data are sorted in the first order. The default is None.
  • SecondOrder (String, optional) – Name of column, the data are sorted in the second order.. The default is None.
  • stacked (Boolean, optional) – Stacks the bars for second order. The default is False.
  • *args (TYPE) – pandas.plot() input variables.
  • **kwargs (TYPE) – pandas.plot() input variables.
Returns:

ax – Plot of the data in db, sorted by FirstOrder and SecondOrder if given.

Return type:

Axes

emipy.visualizedata.plot_PollutantVolumeRel(db, FirstOrder=None, SecondOrder=None, normtop=None, normtov=None, stacked=False, *args, **kwargs)

Plots the normed pollutant volume of the data set, The first order is the x-axis, the second order is a differentiation of the y-values.

Parameters:
  • db (DataFrame) – The data to be plotted.
  • FirstOrder (String, optional) – Name of column, the data are sorted in the first order. The default is None.
  • SecondOrder (String, optional) – Name of column, the data are sorted in the second order.. The default is None.
  • normtop (list, optional) – With this parameter you can choose a entry of your data table, that the entries should be normalised too. The first item of the list has to be one value of the FirstOrder. If SecondOrder is called, the second value has to be a value of the SecondOrder. The default is None.
  • normtov (float, optional) – With this parameter you can define a value, that the PollutantVolume entries are normalised to. The default is None.
  • stacked (Boolean, optional) – Stacks the bars for second order. The default is False.
  • *args (TYPE) – pandas.plot() input variables.
  • **kwargs (TYPE) – pandas.plot() input variables.
Returns:

ax – Plot of the data in db, sorted by FirstOrder and SecondOrder if given.

Return type:

Axes

Module exporttocalliope

emipy.exporttocalliope.export_calliope(data, path=None, yamlfilename='emipy2calliope.yaml', csvfilename='emipy2calliope.csv', sc=0.07)

Exports the data to a csv file readable by the calliope project.

Parameters:
  • data (DataFrame) – Data that are to be exported.
  • path (String, optional) – Path to the storage place. If None is given, emipy uses the path, stored in the config file. The default ist None.
  • yamlfilename (String, optional) – filename for the yaml file. The default is emipy2calliope.yaml.
  • csvfilename (String, optional) – filename for the csv file. The default is emipy2calliope.csv.
  • sc (int, optional) – monetary cost factor. The default is 0.07.
Returns:

Return type:

None.

emipy.exporttocalliope.get_default_config()

Returns the default configuration

Returns:d – dictionary with default configuration.
Return type:dict
emipy.exporttocalliope.prepare_csv(data)

Creates a DataFrame with the emission volume of the different facilitys distributed over a time series.

Parameters:data (DataFrame) – Data from which a time series is to be generated.
Returns:
  • df (DataFrame) – Time series of the pollutant emission for all present facility ID’s.
  • coords (dict) – Dictionary that stores the coordinates of each facility.
  • FacilityIDDict (dict) – Dictionary that stores the facility names of each facility.