Skip to main content

Collection of dynamic characterization functions for life cycle inventories with temporal information

Project description

dynamic_characterization

Read the Docs PyPI - Version Conda Version Conda - License

This is a collection of dynamic characterization functions for life cycle inventories with temporal information.

Here's an overview of what is currently included:

impact category metric covered emissions source
climate change radiative forcing CO2, CH4 bw_temporalis
climate change radiative forcing 247 GHGs from IPCC AR6 Ch.7 bw_timex

What do dynamic characterization functions do?

The functions are meant to work with a common input format of the dynamic inventory, collected in a pandas DataFrame that looks like this:

date amount flow activity
101 33 1 2
312 21 4 2

Each function takes one row of this dynamic inventory dataframe (i.e. one emission at one point in time) and transform it according to some metric. The output generated by applying a very simple function to both rows of the input dataframe could look like:

date amount flow activity
101 33 1 2
102 31 1 2
103 31 1 2
312 21 4 2
313 20 4 2
314 19 4 2

What do dynamic characterization functions look like?

Here's an example of what such a function could look like:

def characterize_something(series, period: int = 100, cumulative=False) -> pd.DataFrame:
    date_beginning: np.datetime64 = series["date"].to_numpy()
    date_characterized: np.ndarray = date_beginning + np.arange(
        start=0, stop=period, dtype="timedelta64[Y]"
    ).astype("timedelta64[s]")

    decay_multipliers: list = np.array(
        [
            1.234 * (1 - np.exp(-year / 56.789))
            for year in range(period)
        ]
    )

    forcing = pd.Series(data=series.amount * decay_multipliers, dtype="float64")
    if not cumulative:
        forcing = forcing.diff(periods=1).fillna(0)

    return pd.DataFrame(
        {
            "date": pd.Series(data=date_characterized, dtype="datetime64[s]"),
            "amount": forcing,
            "flow": series.flow,
            "activity": series.activity,
        }
    )

Installation

You can install dynamic_characterization via [pip] from [PyPI]:

$ pip install dynamic_characterization

Alternatively, you can also use conda:

$ conda install -c diepers dynamic_characterization

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the BSD 3 Clause license, dynamic_characterization is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynamic_characterization-0.0.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

dynamic_characterization-0.0.2-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file dynamic_characterization-0.0.2.tar.gz.

File metadata

File hashes

Hashes for dynamic_characterization-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2b5e4f8071223fe2abc7f4dba4d45e0ed74cbe4bf4b05187719627d3f5ea4c36
MD5 c322512d12e17447b18b8bfd825078bd
BLAKE2b-256 1b6c8a68eeece05de191c902032221884e7fb111ea3916551aa3ef20d9cb414e

See more details on using hashes here.

File details

Details for the file dynamic_characterization-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dynamic_characterization-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 931230b87db5e6b6a67c4654473b9636c4753b47816cbd272a3c832c05a1983e
MD5 a9fd7c4fbc135192fa4b3bce353e290f
BLAKE2b-256 b5cc1a79a422594f7b583dba53eeb52bb192d4fa0de83138c5451784a12f4fba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page