Recent Releases of mescal

mescal - 1.2.4

What is new?

  • Contribution analysis plotting function plot_contribution_analysis (in plot.py) to visualize the contribution of processes and elementary flows. Thanks @ArthurChuat !

What has changed?

  • Upper limits in AMPL files from 1e10 to Infinity for better numerical stability (in generate_lcia_obj_ampl.py).

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str 2 months ago

mescal - 1.2.3

What is new?

  • Support for the decommissioning phase of energy technologies as a separate LCI dataset type in the ESM database. Datasets of Type "Decommission" can now be defined in the mapping file. The unit_conversion and technology_compositions files
    should be updated accordingly. To handle cases where end-of-life intermediary flows are included in the "Construction" LCI datasets, the _add_decommission_datasets method (in decommission.py) builds on the double_counting_removal method
    (in double_counting.py) to extract end-of-life flows and aggregate them in the new "Decommission" datasets. The add_decommission_datasets method is activated when setting extract_eol_from_construction to True in the ESM class.
  • The method compute_territorial_impact_scores (in impact_assessment.py) to compute territorial impact scores (i.e., impacts occurring in esm_location over the life-cycle). The compute_territorial_impact_scores method requires a contribution analysis of processes obtained
    from the compute_impact_scores method. The normalize_lca_metrics (in normalization.py) and generate_mod_file_ampl (in generate_lcia_obj_ampl.py) methods have been updated accordingly to handle the integration of territorial and abroad impact scores in ESMs.
  • Generic examples of user input data files on ReadTheDocs. These include examples of mapping, unit_conversion, model, and mapping_esm_flows_to_CPC_cat derived from our applications with the EnergyScope model.
  • The integration of ABContributionAnalysis class from Activity-Browser and the use of pypardiso to improve LCIA computation speed.
  • The formulation of LCA equations in AMPL for the EnergyScope core version (in normalization.py and generate_lcia_obj_ampl.py).
  • The comparison of system-level results in the validation_double_counting and validation_direct_carbon_emissions methods, i.e., the system-level primary energy use and system-level direct carbon emissions, respectively.
  • The load_dependencies argument to the Database class (in database.py) to control whether dependencies are loaded when loading databases.

What has changed?

  • Formatting of columns of the impact_scores DataFrame returned by the compute_impact_scores method (in impact_assessment.py). The following columns were added: Impact_category_unit, Functional unit, Impact_category (level x) where x typically ranges from 1 to 3, depending on the LCIA method.

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str 5 months ago

mescal - 1.2.2

What has changed?

  • The Plot class works without setting a brightway project (in plot.py), in preparation for EnergyScope Symposium 2025.
  • The optimization variables modeling the environmental impacts can be negative, thus allowing for net-negative configurations (in generate_lcia_obj_ampl.py).

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str 7 months ago

mescal - 1.2.1

What is new?

  • The background_double_counting_removal method (in double_counting.py) that creates a new version of the technosphere matrix where flows included in the ESM end-use demands are set to zero, thus preventing double-counting. This step is needed if the ESM end-use demands include the production and operation of new infrastructures.
  • The req_technosphere argument to the compute_impact_scores method (in impact_assessment.py). If True, the method returns the technosphere flows requirements (life-cycle inventory) of the ESM technologies and resources.
  • The esm_end_use_demands and remove_double_counting_to arguments to the ESM class in order to apply the double-counting removal process to infrastructure and resource datasets (in addition to operation datasets).
  • The stop_background_search_when_first_flow_found argument in the ESM class to stop or continue the background search for double-counting removal when the first flow of the targeted category is found (in esm.py).
  • The _validation_double_counting method (in double_counting.py, included in the create_esm_database method) to compare the flows removed during the double-counting removal process and the flows in the ESM.
  • The validation_direct_carbon_emissions method (in impact_assessment.py) comparing direct carbon emissions in the ESM and from the impact assessment phase (direct emissions module).

What has changed?

  • The type of the regionalize_foregrounds argument in the ESM class is now a string or list of string (instead of a boolean) in order to apply the foreground regionalization process only to certain types of LCI datasets (instead of all or none of them).
  • The harmonize_with_esm argument of the create_new_database_with_esm_results method has been replaced by the two arguments harmonize_efficiency_with_esm and harmonize_capacity_factor_with_esm to be able to harmonize the efficiency and capacity factor separately (in esm_back_to_lca.py).

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str 8 months ago

mescal - 1.2.0

What is new?

  • PathwayESM class (in esm.py) to create databases and impact score dataframes for all ESM time steps at once.
  • Contribution analysis of processes in compute_impact_scores (in impact_assessment.py) by setting contribution_analysis to processes.
  • max_depth_double_counting_search argument in the ESM class to limit the depth of the search in the double-counting removal process (in double_counting.py).
  • Harmonization of efficiency and capacity factor with the ESM in the ESM results database (in esm_back_to_lca.py and adapt_efficiency.py).
  • Loss coefficient (based on the one of the original dataset) for datasets in the ESM results database (in esm_back_to_lca.py).

What has changed?

  • Corrected unit conversion for elementary flows contribution analysis in compute_impact_scores (in impact_assessment.py).
  • Improved double-counting removal process for market-type activities in the ESM results database (i.e., removal of infrastructure flows) (in esm_back_to_lca.py and double_counting.py).
  • If specified in tech_specifics, double-counting removal during background search is allowed even if a flows has already been set to zero (in double_counting.py).
  • Relinking of the main database with the ESM results database can be based on activity names and/or product names, and for a user-defined set of geographies locations (in esm_back_to_lca.py).
  • Default esm_location is GLO and default accepted_locations is [esm_location] in the ESM class (in esm.py).

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str 11 months ago

mescal - 1.1.4

What is new?

  • Contribution analysis of elementary flows in the MultiLCA class of compute_impact_scores (in impact_assessment.py) by setting contribution_analysis to True.
  • Use of logging and tqdm for improved logging and progress tracking in the create_esm_database function (in double_counting.py), compute_impact_scores function (in impact_assessment.py), and create_new_database_with_esm_results, connect_esm_results_to_database functions (in esm_back_to_lca.py).
  • Check for duplicates in input dataframes in the check_inputs function (in esm.py).

What has changed?

  • Corrected tuple item assignment for creating the direct emissions database in compute_impact_scores (in impact_assessment.py).

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str about 1 year ago

mescal - 1.1.3

What is new?

  • A mapping between existing ecoinvent products and their CPC categories (data/mapping_existing_products_to_CPC.json) and a method to add CPC categories, when missing, based on this mapping (add_CPC_categories_based_on_existing_activities in CPC.py).
  • Handling error due to missing category ('air', 'lower stratosphere + upper troposphere') for "Carbon dioxide, non-fossil" in ecoinvent 3.10 and earlier.

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str about 1 year ago

mescal - 1.1.2

What is new?

  • A spatialized biosphere database and the regionalized EF 3.1 methods (in dev/ef regionalized/EF 3.1 regionalized.ipynb). Your ecoinvent database then needs to be spatialized (see Regioinvent or Regiopremise).
  • The function add_carbon_capture_to_plant (in modify_inventory.py) that adds a carbon capture and storage (CCS) process to a power plant and modifies its direct emissions accordingly.
  • The main_database_name argument of the ESM class that specifies the name of your ecoinvent database in case the input database in an aggregation of several databases.
  • The assessment_type argument in normalize_lca_metrics (in normalization.py) and generate_mod_file_ampl (in generate_lcia_obj_ampl.py) functions to differentiate between life-cycle impacts computation (by default) and direct emissions impact computation (assessment_type="direct emissions").
  • Plotting methods (Plot class in plot.py) to visualize the results of the compute_impact_scores function (in impact_assessment.py).
  • The connect_esm_results_to_database method (in esm_back_to_lca.py) to connect the LCI datasets created from ESM results to another LCI database. The create_new_database_with_esm_results method now only creates a new database with the LCI datasets from ESM results.
  • The biosphere_db_name argument in the ESM class to specify the name of the biosphere database.

What has changed?

  • Corrected error occurring in correct_esm_and_lca_efficiency_differences (in adapt_efficiency.py) when several input fuel flows were present in an operation LCI dataset.
  • The mapping_ecoinvent_version_ipynb notebook (to change the ecoinvent version of your mapping file) has been updated to work with version 3.10.1 of ecoinvent.
  • Variables and parameters naming for direct emissions indicators in the AMPL files (in normalization.py and generate_lcia_obj_ampl.py) to be more explicit.
  • Inequality for equality constraints in the AMPL files (in generate_lcia_obj_ampl.py) in case there is no LCA objective function or constraint.

What has been removed?

  • The spatialized_database argument of the ESM class. It is now set to True if spatialized_biosphere_db is not None.

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str about 1 year ago

mescal - 1.1.1

What is new?

  • Arguments specific_lcia_methods, specific_lcia_categories and specific_lcia_abbrev in the normalize_lca_metrics (in normalization.py) and generate_mod_file_ampl (in generate_lcia_obj_ampl.py) functions to specify the LCIA methods or impact categories to be used when generating the AMPL .mod and .dat files.

What has changed?

  • Set the refactor parameter in the normalize_lca_metrics function (in normalization.py) depending on the AoP (in impact_abbrev.csv) rather than the impact category.

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str over 1 year ago

mescal - 1.1.0

What is new?

  • The function change_direct_carbon_emissions_by_factor (in modify_inventory.py) changes all direct carbon emissions by a factor.
  • The function add_carbon_dioxide_flow (in modify_inventory.py) adds a fossil carbon dioxide flow to an LCI dataset.

What has changed?

  • Major update: the mescal package has been restructured from functional programming to object-oriented programming. The classes ESM (in esm.py), Database (in database.py) and Dataset (in database.py) have been created to perform operations on the ESM database, the LCI databases and the LCI datasets respectively. All functions from v1.0.3 are still available but have been reorganized in the classes.

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str over 1 year ago

mescal - 1.0.3

What is new?

  • The function change_fossil_carbon_flows_of_biofuels (in modify_inventory.py) changes fossil carbon emissions to biogenic carbon emissions if biofuels are used in the foreground.
  • Metadata has been added at the beginning of AMPL files (in normalized_lca_metric from normalization.py and generate_lci_obj from generate_lci_obj_ampl.py).
  • Correction of CA-QC heat flows in the ecoinvent database for global markets (in remove_quebec_flow_in_global_heat_market from modify_inventory.py).
  • Option added to check for duplicated activities in terms of (product, name, location) tuple when merging several databases (in merge_databases from utils.py).
  • A specific category for imports and exports has been added in technology_specifics.csv to avoid their regionalization to the ESM geography.

What has changed?

  • The efficiency harmonization functions (in adapt_efficiency.py) can now accept multiple types of input flows instead of just one.
  • The arguments of the regionalization functions have been renamed to differentiate between regionalization and spatialization.
  • Renamed AMPL files (by default, techs_lcia.dat and objectives.mod are used regardless of the LCIA method employed).
  • For AMPL files generation, the refactor parameter is computed based on the LCA indicator data rather than being a user input.

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str over 1 year ago

mescal - 1.0.2

What is new?

  • regionalization of biosphere flows in the regionalize_activity_foreground function, and added conditions to prevent the regionalization when unnecessary
  • correction of efficiency differences between the ESM and LCI databases (scale direct emissions accordingly) in the correct_esm_and_lca_efficiency_differences function
  • possibility to return the database instead of writing it (or both) in the create_esm_database and create_new_database_with_esm_results functions

What has changed?

  • concatenate_database function renamed load_multiple_databases to avoid confusion with new merge_databases function
  • unit_conversion.csv file has its columns From and To renamed ESM and LCA for better clarity
  • Reformatted and added new information to the double-counting removal output csv files

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str almost 2 years ago

mescal - 1.0.1

What is already available in Mescal?

  • Perform double-counting removal
  • Compute your LCA metrics for a set of impact categories
  • Reformat the results as .mod and .dat files if you are using AMPL
  • Feed the ESM results back in the LCI database
  • Add CPC categories to additional LCI datasets, e.g., from Premise
  • Relink a mapping to a new database / a new version of ecoinvent
  • Regionalize the foreground of LCI datasets

What is coming next?

  • Ease the use of Mescal with transition models (generation of metrics for various time steps and scenarios)

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str almost 2 years ago

mescal - First release

What is already available in Mescal?

  • Perform double-counting removal
  • Compute your LCA metrics for a set of impact categories
  • Reformat the results as .mod and .dat files if you are using AMPL
  • Feed the ESM results back in the LCI database
  • Add CPC categories to additional LCI datasets, e.g., from Premise
  • Relink a mapping to a new database / a new version of ecoinvent
  • Regionalize the foreground of LCI datasets

What is coming next?

  • Ease the use of Mescal with transition models (generation of metrics for various time steps and scenarios)

Energy Systems - Energy System Modeling Frameworks - Jupyter Notebook
Published by matthieu-str almost 2 years ago