Skip to content

feat: flexible stock and initial stock - #125

Draft
JakobBD wants to merge 19 commits into
pik-piam:mainfrom
JakobBD:flexible_stock
Draft

feat: flexible stock and initial stock#125
JakobBD wants to merge 19 commits into
pik-piam:mainfrom
JakobBD:flexible_stock

Conversation

@JakobBD

@JakobBD JakobBD commented Nov 12, 2025

Copy link
Copy Markdown
Collaborator

Purpose of this PR

This could be broken into two PR's, where f18d93a is the first commit of the second PR:

Flexible stock

Adds a FlexibleDSM class which uses either stock driven or inflow driven compute routine, depending on what you pass it.
Deletes the lapack solver on the way.

TODO (apart from the usual):

  • Make it throw an error if both are set.
  • Export FlexibleDSM in init (check line from compute_processes branch)

Deleting the lapack solver is a break of backwards compatibility, which seems fine, as I doubt anyone is using it.

Initial stock

  • Add initial stocks to DSM
  • Add possibility to differentiate inflow by cohort (used product imports)
  • Retrieve stock_by_cohort and outflow_by_cohort as flodym arrays

TODO (apart from the usual):

  • check TODO general points in stocks.py inline comments (copied here):
    • np allclose in all
    • make work for inflow_by_cohort?
    • proper treatment of prescribed inflow and stock at initial year
      (for inflow: only represents/replaces the newest cohort!)
    • add inflow_by_cohort to FlexibleDSM
    • move adapt_stock / adapt_inflow to respective subclasses
  • check for backwars compatibility

Builds on #124, so that should be merged first

Type of change

(Make sure to delete from the Type-of-change list the items not relevant to your PR)

  • Bug fix
  • Refactoring
  • New feature
  • Minor change
  • Major change

Checklist:

  • I have updated the in-code documentation of all changed classes and functions
  • I have added in-code documentation and type hints to all new classes and functions
  • I have adapted the howtos
  • I have adapted the examples
  • If this change should entail a version update, I have bumped the version in the pyproject.toml file accordingly

@JakobBD JakobBD mentioned this pull request Nov 12, 2025
10 tasks
@JakobBD
JakobBD marked this pull request as draft November 13, 2025 08:30
@JakobBD JakobBD mentioned this pull request Dec 11, 2025
10 tasks
@JakobBD JakobBD changed the title Flexible stock feat: flexible stock Jul 8, 2026
@JakobBD JakobBD changed the title feat: flexible stock feat: flexible stock and initial stock Jul 8, 2026
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.

2 participants