malcolmSQ
chore: UI/UX cleanup, grouped accordions, tooltips as labels, compact mortality layout, reset button
2f8199f | #!/usr/bin/env python | |
| """ | |
| Main pipeline script for running the ER model calculations. | |
| """ | |
| import sys | |
| from pathlib import Path | |
| import yaml | |
| import click | |
| from er_model_core.er_model import ERModel | |
| # Add the project root to the Python path | |
| sys.path.append(str(Path(__file__).parent.parent)) | |
| def main(config: Path, output: Path) -> None: | |
| """Run the ER model pipeline.""" | |
| # Create output directory if it doesn't exist | |
| output.parent.mkdir(parents=True, exist_ok=True) | |
| # Initialize and run model | |
| model = ERModel(config) | |
| results, species_results, scenario_results = model.run() | |
| # Save results | |
| model.save_results(output) | |
| # Save additional results | |
| species_output = output.parent / "species_results.csv" | |
| scenario_output = output.parent / "scenario_results.csv" | |
| species_results.to_csv(species_output, index=False) | |
| scenario_results.to_csv(scenario_output, index=False) | |
| # Print summary | |
| print("\nResults Summary:") | |
| print("-" * 40) | |
| print(f"Total years: {len(results)}") | |
| print(f"Total gross carbon: {results['gross_carbon'].sum():.2f} tCO2") | |
| print(f"Total net carbon: {results['net_carbon'].sum():.2f} tCO2") | |
| print(f"\nResults saved to:") | |
| print(f"- Main results: {output}") | |
| print(f"- Species results: {species_output}") | |
| print(f"- Scenario results: {scenario_output}") | |
| if __name__ == "__main__": | |
| main() |