Example #1
0
def write_generation_process_database_to_dict(gen_database, regions=None):
    """
    Create olca formatted dictionaries of individual processes

    Parameters
    ----------
    gen_database : DataFrame
        Each row represents information about a single emission from a fuel category
        in a single region.
    regions : str, optional
        Not currently used (the default is 'all', which [default_description])

    Returns
    -------
    dict
        A dictionary of dictionaries, each of which contains information about
        emissions from a single fuel type in a single region.
    """
    from electricitylci.generation import olcaschema_genprocess

    if regions is None:
        regions = config.model_specs.regional_aggregation

    gen_dict = olcaschema_genprocess(gen_database, subregion=regions)

    return gen_dict
Example #2
0
def write_gen_fuel_database_to_dict(gen_plus_fuel_df,
                                    upstream_dict,
                                    subregion=None):
    """
    Write the generation dataframe that has been augmented with fuel inputs
    to a dictionary for conversion to openlca.

    Parameters
    ----------
    gen_plus_fuel_df : dataframe
        The dataframe returned by add_fuels_to_gen
    upstream_dict : dictionary
        This is the dictionary of upstream "unit processes" as generated by
        electricitylci.upstream_dict after the upstream_dict has been written
        to json-ld. This is important because the uuids for the upstream
        "unit processes" are only generated when written to json-ld.
    subregion : str, optional
        The level of subregion that the data will be aggregated to. Choices
        are 'all', 'NERC', 'BA', 'US', by default 'BA', by default "BA"

    Returns
    -------
    dictionary
        A dictionary of generation unit processes ready to be written to
        openLCA.
    """
    from electricitylci.generation import olcaschema_genprocess
    if subregion is None:
        subregion = config.model_specs.regional_aggregation
        #Another change to accomodate FERC consumption pulling BAs.
    #Removing the statements below for now. This is preventing the generation
    #of dictionaries for other levels of aggregation. This logic will need to
    #be implemented in main.py so that FERC consumption mixes can be made
    #using the required BA aggregation.
    # if subregion in ["BA","FERC","US"]:
    #     subregion="BA"
    print("Converting generator dataframe to dictionaries...")
    gen_plus_fuel_dict = olcaschema_genprocess(gen_plus_fuel_df,
                                               upstream_dict,
                                               subregion=subregion)
    return gen_plus_fuel_dict
Example #3
0
def write_gen_fuel_database_to_dict(gen_plus_fuel_df,
                                    upstream_dict,
                                    subregion=None):
    """
    Write the generation dataframe that has been augmented with fuel inputs
    to a dictionary for conversion to openlca.

    Parameters
    ----------
    gen_plus_fuel_df : dataframe
        The dataframe returned by add_fuels_to_gen
    upstream_dict : dictionary
        This is the dictionary of upstream "unit processes" as generated by
        electricitylci.upstream_dict after the upstream_dict has been written
        to json-ld. This is important because the uuids for the upstream
        "unit processes" are only generated when written to json-ld.
    subregion : str, optional
        The level of subregion that the data will be aggregated to. Choices
        are 'all', 'NERC', 'BA', 'US', by default 'BA', by default "BA"

    Returns
    -------
    dictionary
        A dictionary of generation unit processes ready to be written to
        openLCA.
    """
    from electricitylci.alt_generation import olcaschema_genprocess
    if subregion is None:
        #        subregion = model_specs['regional_aggregation']
        #Another change to accomodate FERC consumption pulling BAs.
        subregion = "BA"
    print("Converting generator dataframe to dictionaries...")
    gen_plus_fuel_dict = olcaschema_genprocess(gen_plus_fuel_df,
                                               upstream_dict,
                                               subregion=subregion)
    return gen_plus_fuel_dict
Example #4
0
def write_generation_process_database_to_dict(gen_database, regions='all'):
    from electricitylci.generation import olcaschema_genprocess
    gen_dict = olcaschema_genprocess(gen_database, subregion=regions)
    return gen_dict