Skip to content

Commit 9e2c88c

Browse files
Update to V0.5.6 (#85)
* poetry dev dependencies update * Replace unnecessary memmap by arrays (#84) * Replace unnecessary memmap by arrays * black * Fix order not known * quick fix for tests * better record handling Should be improve even further but it lays the basis to select which variables to record, and how (just as arrays or as memmaps) --------- Co-authored-by: sjuhel <pro@sjuhel.org> * Bump actions/upload-pages-artifact from 1 to 3 (#83) Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 1 to 3. - [Release notes](https://github.com/actions/upload-pages-artifact/releases) - [Commits](actions/upload-pages-artifact@v1...v3) --- updated-dependencies: - dependency-name: actions/upload-pages-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/deploy-pages from 1 to 4 (#82) Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 1 to 4. - [Release notes](https://github.com/actions/deploy-pages/releases) - [Commits](actions/deploy-pages@v1...v4) --- updated-dependencies: - dependency-name: actions/deploy-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/upload-artifact from 1 to 4 (#81) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 1 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v1...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Samuel Juhel <10011382+spjuhel@users.noreply.github.com> * Bump actions/configure-pages from 3 to 4 (#80) Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 3 to 4. - [Release notes](https://github.com/actions/configure-pages/releases) - [Commits](actions/configure-pages@v3...v4) --- updated-dependencies: - dependency-name: actions/configure-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/checkout from 2 to 4 (#79) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v2...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: sjuhel <pro@sjuhel.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 73fe777 commit 9e2c88c

File tree

8 files changed

+114
-194
lines changed

8 files changed

+114
-194
lines changed

.github/workflows/draft-pdf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
# This should be the path to the paper within your repo.
1515
paper-path: paper.md
1616
- name: Upload
17-
uses: actions/upload-artifact@v1
17+
uses: actions/upload-artifact@v4
1818
with:
1919
name: paper
2020
# This is the output path where Pandoc will write the compiled

.github/workflows/gitlabsync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
name: Git Repo Sync
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 0
1515
- uses: wangchucheng/git-repo-sync@v0.1.0

.github/workflows/static_html_deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Checkout
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
3333
- name: Setup Pages
34-
uses: actions/configure-pages@v3
34+
uses: actions/configure-pages@v4
3535
- name: Upload artifact
36-
uses: actions/upload-pages-artifact@v1
36+
uses: actions/upload-pages-artifact@v3
3737
with:
3838
# Upload entire repository
3939
path: 'docs/build/html'
4040
- name: Deploy to GitHub Pages
4141
id: deployment
42-
uses: actions/deploy-pages@v1
42+
uses: actions/deploy-pages@v4

boario/simulation.py

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def __init__(
257257
self.records_storage: pathlib.Path = self.results_storage / "records"
258258
"""pathlib.Path: Place where records are stored if stored"""
259259

260+
self._vars_to_record = []
260261
self._files_to_record = []
261262

262263
if save_records != []:
@@ -481,34 +482,53 @@ def next_step(
481482
# and updates the internal model production_cap decrease and rebuild_demand
482483
self._check_happening_events()
483484

484-
if "_inputs_evolution" in self._files_to_record:
485+
if ("_inputs_evolution" in self._files_to_record) or (
486+
"_inputs_evolution" in self._vars_to_record
487+
):
485488
self._write_stocks()
486489

487490
# 0)
488491
if self.current_temporal_unit > 1:
489492
self.model.calc_overproduction()
490493

491-
if "_overproduction_evolution" in self._files_to_record:
494+
if ("_overproduction_evolution" in self._files_to_record) or (
495+
"_overproduction_evolution" in self._files_to_record
496+
):
492497
self._write_overproduction()
493-
if "_rebuild_demand_evolution" in self._files_to_record:
498+
if ("_rebuild_demand_evolution" in self._files_to_record) or (
499+
"_rebuild_demand_evolution" in self._vars_to_record
500+
):
494501
self._write_rebuild_demand()
495-
if "_final_demand_evolution" in self._files_to_record:
502+
if ("_final_demand_evolution" in self._files_to_record) or (
503+
"_final_demand_evolution" in self._vars_to_record
504+
):
496505
self._write_final_demand()
497-
if "_io_demand_evolution" in self._files_to_record:
506+
if ("_io_demand_evolution" in self._files_to_record) or (
507+
"_io_demand_evolution" in self._vars_to_record
508+
):
498509
self._write_io_demand()
499510

500511
# 1)
501512
constraints = self.model.calc_production(self.current_temporal_unit)
502513

503-
if "_limiting_inputs_evolution" in self._files_to_record:
514+
if ("_limiting_inputs_evolution" in self._files_to_record) or (
515+
"_limiting_inputs_evolution" in self._vars_to_record
516+
):
504517
self._write_limiting_stocks(constraints)
505-
if "_production_evolution" in self._files_to_record:
518+
if ("_production_evolution" in self._files_to_record) or (
519+
"_production_evolution" in self._vars_to_record
520+
):
506521
self._write_production()
507-
if "_production_cap_evolution" in self._files_to_record:
522+
if ("_production_cap_evolution" in self._files_to_record) or (
523+
"_production_cap_evolution" in self._vars_to_record
524+
):
508525
self._write_production_max()
509526
if (
510527
"_regional_sectoral_productive_capital_destroyed_evolution"
511528
in self._files_to_record
529+
) or (
530+
"_regional_sectoral_productive_capital_destroyed_evolution"
531+
in self._vars_to_record
512532
):
513533
self._write_productive_capital_lost()
514534

@@ -522,9 +542,13 @@ def next_step(
522542
events_to_remove = self.model.distribute_production(
523543
rebuildable_events, self.scheme
524544
)
525-
if "_final_demand_unmet_evolution" in self._files_to_record:
545+
if ("_final_demand_unmet_evolution" in self._files_to_record) or (
546+
"_final_demand_unmet_evolution" in self._vars_to_record
547+
):
526548
self._write_final_demand_unmet()
527-
if "_rebuild_production_evolution" in self._files_to_record:
549+
if ("_rebuild_production_evolution" in self._files_to_record) or (
550+
"_rebuild_production_evolution" in self._vars_to_record
551+
):
528552
self._write_rebuild_prod()
529553
except RuntimeError:
530554
logger.exception("An exception happened:")
@@ -796,15 +820,19 @@ def _init_records(self, save_records):
796820
)
797821
else:
798822
raise RuntimeError(f"shapev {shapev} unrecognised")
799-
memmap_array = TempMemmap(
800-
filename=(self.records_storage / filename),
801-
dtype=dtype,
802-
mode="w+",
803-
shape=shape,
804-
save=save,
805-
)
823+
if save:
824+
memmap_array = TempMemmap(
825+
filename=(self.records_storage / filename),
826+
dtype=dtype,
827+
mode="w+",
828+
shape=shape,
829+
save=save,
830+
)
831+
self._files_to_record.append(attr_name)
832+
else:
833+
memmap_array = np.ndarray(shape=shape, dtype=dtype, order="C")
834+
self._vars_to_record.append(attr_name)
806835
memmap_array.fill(fillv)
807-
self._files_to_record.append(attr_name)
808836
setattr(self, attr_name, memmap_array)
809837

810838
def _reset_records(

0 commit comments

Comments
 (0)