Skip to content

Bw2io excel import for temporal distributions#177

Open
muelleram wants to merge 5 commits intomainfrom
bw2io_excel_import_tds
Open

Bw2io excel import for temporal distributions#177
muelleram wants to merge 5 commits intomainfrom
bw2io_excel_import_tds

Conversation

@muelleram
Copy link
Copy Markdown
Collaborator

works with using the new TD import strategies on my forked branch of bw2io (https://github.com/muelleram/brightway2-io/tree/td_excel_import).

I think it can be discussed if the proposed json format for the import is the best solution. I proposed it because we can then use the bw_temporalis method .from_json() to create TDs, and don't have to write a separate method.

I also think this format is better than an one similar to uncertainty, as proposed in trails (https://trails.readthedocs.io/en/latest/user_guide.html#trails-specific-temporal-fields) because it contains less fields, which i hope is potentially less confusing to the user. But happy to discuss this.

The PR contains additional code for the excel import in our notebook and a excel for the standalone case study. This works on my computer.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.56%. Comparing base (db2ac38) to head (eca5bed).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #177       +/-   ##
===========================================
+ Coverage   59.39%   72.56%   +13.17%     
===========================================
  Files           8        9        +1     
  Lines        1384     1520      +136     
===========================================
+ Hits          822     1103      +281     
+ Misses        562      417      -145     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TimoDiepers
Copy link
Copy Markdown
Member

One upside to having similar fields to uncertainty data is that that way, it's easier to "input" the data in the excel directly, as you can use the convenience functions for e.g. uniform, normal, triangular etc. distributions that are currently built into bw_temporalis. In the current approach here, you'd need to directly input all dates and amounts "manually", no?

@muelleram
Copy link
Copy Markdown
Collaborator Author

One upside to having similar fields to uncertainty data is that that way, it's easier to "input" the data in the excel directly, as you can use the convenience functions for e.g. uniform, normal, triangular etc. distributions that are currently built into bw_temporalis. In the current approach here, you'd need to directly input all dates and amounts "manually", no?

Yes, I agree. This upside could weigh enough to argue in favour of a input format with the uncertainty-structure.

a work-around within the current implementation would be to create complicated TDs using the convenience functions built into bw_temporalis in code, then use the .to_json() to print the corresponding json-formats and paste in the excel. But that's not super user-friendly.

@jakobsarthur
Copy link
Copy Markdown
Collaborator

Ok, if you want you can have a look. Please install bw2io from https://github.com/jakobsarthur/brightway2-io/tree/temporal_distribution, do a fresh pull from this branch for the updated excel file and have a look.

Remaining todo would e the dpcumentation for timex.

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.

3 participants