Metadata-Version: 2.4
Name: fridapy
Version: 1.0.0
Summary: Integrated Assessment Model, based on FRIDA, written in python using sostrades
Project-URL: Repository, https://github.com/SallyDa/fridapy
Project-URL: Issues, https://github.com/SallyDa/fridapy/issues
License: MIT License
        
        Copyright (c) 2026 the fridapy developers
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        ---
        
        fridapy is based on the WorldTrans FRIDA integrated assessment model
        (https://github.com/metno/WorldTransFRIDA), which is distributed under the MIT
        License. It builds on the SoSTrades framework (sostrades-core,
        https://github.com/os-climate/sostrades-core). Reference uncertainty data is
        derived from Schoenberg, W. (2025), "FRIDA v2.1 Endogenous Model Behavior (EMB)
        100000 member ensemble", Zenodo, https://doi.org/10.5281/zenodo.15396799
        (CC-BY-4.0).
License-File: LICENSE
Keywords: FRIDA,climate,earth-system,integrated-assessment-model,sostrades,system-dynamics
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.12
Requires-Dist: numpy<3,>=1.26
Requires-Dist: pandas>=2.2
Provides-Extra: diagnostics
Requires-Dist: matplotlib>=3.9; extra == 'diagnostics'
Requires-Dist: scipy>=1.13; extra == 'diagnostics'
Description-Content-Type: text/markdown

# fridapy

A coupled climate–economy–society system-dynamics model, based on the
[WorldTrans FRIDA v2.1](https://github.com/metno/WorldTransFRIDA)
integrated assesment model and re-implemented in Python as a set of
[SoSTrades](https://github.com/os-climate/sostrades-core)
disciplines solved by an MDA (multidisciplinary analysis) coupling.

## Installation

`fridapy` depends on **`sostrades-core`**, which is not published on PyPI, so it
must be installed first from GitHub (this is *not* our package — see
[os-climate/sostrades-core](https://github.com/os-climate/sostrades-core)):

```bash
pip install git+https://github.com/os-climate/sostrades-core.git@v5.3.4
pip install fridapy            # or, from a checkout:  pip install -e .
```

Equivalently, install the pinned runtime in one step:

```bash
pip install -r requirements.txt
pip install -e .
```

For the diagnostic / ensemble / plotting scripts under `diagnostics/`, install the
extra:

```bash
pip install -e ".[diagnostics]"     # adds matplotlib, scipy
```

## Quickstart

Run the full model for a single climate case:

```python
import numpy as np
from sostrades_core.execution_engine.execution_engine import ExecutionEngine

DISCIPLINES = [
    'Demographics', 'Economy', 'Energy', 'Emissions', 'Climate', 'LandUse',
    'GovernmentRegulations', 'BehavioralChoices', 'BehavioralChange',
    'Resources', 'SeaLevel', 'SeaLevelRiseImpacts', 'PlanetaryBoundaries',
]
time = np.arange(1980, 2150 + 1e-9, 1.0)

study = 'fridapy'
ee = ExecutionEngine(study)
ee.select_root_process(repo='fridapy', mod_id='process')
ee.configure()

values = {f'{study}.{study}.{d}.time': time for d in DISCIPLINES}
values[f'{study}.{study}.Climate.climate_case'] = 50          # 1–100
ee.load_study_from_input_dict(values)
ee.dm.set_values_from_dict({
    f'{study}.{study}.max_mda_iter': 300,
    f'{study}.{study}.tolerance': 1e-3,
    f'{study}.{study}.inner_mda_name': 'MDAGaussSeidel',
})
ee.execute()

gdp = ee.dm.get_value(f'{study}.Real_GDP')
```

See [`diagnostics/baseline/usecase.py`](diagnostics/baseline/usecase.py) for a
complete 9-panel example, and
[`diagnostics/baseline/run_ensemble.py`](diagnostics/baseline/run_ensemble.py)
for ensemble runs (local or Modal).

## Repository structure

| Path | Contents |
|---|---|
| `fridapy/disciplines/` | the 13 SoSTrades disciplines |
| `fridapy/process/` | the MDA process builder |
| `fridapy/data/` | packaged runtime reference data (forcing series, climate cases) |
| `diagnostics/` | ensemble runners, calibration, validation, plotting |
| `docs/` | design notes for each major mechanism |
| `data/` | full development dataset (Stella `FRIDA.isdb` source, calibration inputs) |

## Data sources

The packaged `fridapy/data/` files (`frida_input_data.csv`, `climate_cases.json`)
are derived from the FRIDA v2.1 model. The FRIDA reference uncertainty envelopes used by some diagnostics come from Schoenberg, W. (2025), 
*FRIDA v2.1 Endogenous Model Behavior (EMB) 100000 member ensemble*, Zenodo,
[10.5281/zenodo.15396799](https://doi.org/10.5281/zenodo.15396799) (CC-BY-4.0);
that ~270 MB archive is **not** bundled — see
[`diagnostics/baseline/analyze_ensemble.py`](diagnostics/baseline/analyze_ensemble.py)
for how to obtain it.
