Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 660 create an example to run damages and losses without input files #661

Conversation

ArdtK
Copy link
Contributor

@ArdtK ArdtK commented Dec 13, 2024

Issue addressed

Solves #660

Code of conduct

  • I HAVE NOT added sensitive or compromised (test) data to the repository.
  • I HAVE NOT added vulnerabilities to the repository.
  • I HAVE discussed my solution with (other) members of the RA2CE team.

What has been done?

  • Remove check in input files in init of Losses
  • Move creation of analysis_collection to Ra2ceHandler.configure so the analyses can be manipulated between the init and the execute.
  • Refactor readers (shouldn't be dataclasses - wrongly changed in feat: 595 adaptation run and combine losses and damages #616)
  • Add an example notebook to prove running Damages and Losses without input files is possible.

Checklist

  • Code is formatted using our custom black and isort definitions.
  • Tests are either added or updated.
  • Branch is up to date with master.
  • Updated documentation if needed.

Additional Notes (optional)

Add any additional notes or information that may be helpful.

@ArdtK ArdtK linked an issue Dec 13, 2024 that may be closed by this pull request
@ArdtK ArdtK changed the base branch from master to feat/654-experiment-with-damages-and-losses-without-input-files December 13, 2024 10:01
ArdtK and others added 3 commits December 13, 2024 11:30
…ut-files' into feat/660-create-an-example-to-run-damages-and-losses-without-input-files
Base automatically changed from feat/654-experiment-with-damages-and-losses-without-input-files to master December 13, 2024 13:37
@MatthiasHauthDeltares
Copy link
Contributor

This is a really nice start!
A few observations/comments:

  • I find it difficult to figure out what are the keys in the dictionaries made of Enum:
list(_resilience_curves.resilience_curves.keys())[0]

returns the key: (<RoadTypeEnum.SECONDARY: 7>, (0.0, 0.2)),
This comment is also valid for _values_of_time and _traffic_intensities

  • For the damage curve:
_manual_damage_functions.damage_functions["all_road_types"].damage_fraction.data

This should probably only contains the data as a numpy array instead of a weird dataframe with 2 rows for the title.
Same comment for _manual_damage_functions.damage_functions["all_road_types"].max_damage

@ArdtK
Copy link
Contributor Author

ArdtK commented Jan 8, 2025

@MatthiasHauthDeltares the keys of _resilience_curves are a composite (tupe) of a link_type (enum) and a hazard intensity range (list[float]).
For _values_of_time and _traffic_intensities it is quite straighforward, isn't it.

Regarding your comment on the damage function, it returns an interpolator.

We could discuss how to improve/clarify this.

@sahand-asgarpour FYI

@ArdtK ArdtK marked this pull request as ready for review January 8, 2025 19:03
@ArdtK ArdtK requested a review from Carsopre January 8, 2025 19:03
Copy link
Collaborator

@Carsopre Carsopre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some remarks that need attention, specially behavioral changes to the analysis_runner_factory.py.

ra2ce/analysis/analysis_collection.py Show resolved Hide resolved
ra2ce/analysis/analysis_collection.py Outdated Show resolved Hide resolved
ra2ce/analysis/losses/losses_base.py Outdated Show resolved Hide resolved
ra2ce/runners/analysis_runner_factory.py Outdated Show resolved Hide resolved
@ArdtK ArdtK merged commit 65f5a53 into master Jan 20, 2025
4 checks passed
@ArdtK ArdtK deleted the feat/660-create-an-example-to-run-damages-and-losses-without-input-files branch January 20, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create an example to run damages and losses without input files
3 participants