Skip to content

Release 1.12.0: mlt.dat & renovaveis.csv readers, dadger IA/UE fixes - #93

Merged
rjmalves merged 8 commits into
mainfrom
feat/idecomp-upstream-fixes
Jul 24, 2026
Merged

Release 1.12.0: mlt.dat & renovaveis.csv readers, dadger IA/UE fixes#93
rjmalves merged 8 commits into
mainfrom
feat/idecomp-upstream-fixes

Conversation

@rjmalves

Copy link
Copy Markdown
Owner

Release 1.12.0. Adds two file readers and corrects three dadger register issues surfaced by the cobre-bridge converter.

Adicionado

  • Mlt (mlt.dat) — long-term-mean monthly flows (12×320 int32, month-major), exposed as a valores DataFrame (one row per month, one column per posto, m³/s).
  • Renovaveis (renovaveis.csv) — parques eólicos equivalentes: five PEE register classes + accessors. Uses IDENTIFIER_DIGITS = len + 1 so the identifier window absorbs the leading-space padding on registry cards while still matching the flush-left generation card.

Corrigido

  • IA parsed the ten per-patamar exchange limits into data[4:14] but exposed no accessors, so ia(df=True) dropped them. Added limite_de_para / limite_para_de (interleaved, mirroring RI).
  • ue() was wired to the UH register class and returned hydro-plant data instead of the pumping stations. Now points at UE.
  • IA precision: its FloatFields used decimal_digits=0, rounding fractional exchange limits to integers on write (the last decimal_digits=0 fields after the 1.10.0 precision sweep). Raised to decimal_digits=2, with a fractional round-trip regression test.

Alterado

  • Minimum cfinterface raised to 1.10.1 (the built/tested version).

Verification

  • All four readers/fixes validated against the real decomp-jul-26-rv3 deck (counts, anchor rows, and — for IA — cross-checked against the raw record bytes).
  • Full suite: 347 tests. New coverage for Mlt, Renovaveis, IA limits/precision, and the ue() rewiring.

🤖 Generated with Claude Code

rjmalves and others added 7 commits July 24, 2026 13:40
The IA register parsed the ten per-patamar exchange limits into
data[4:14] but exposed no accessors, so ia(df=True) dropped them. The
ue() accessor was wired to the UH register class, so it returned
hydro-plant data instead of the pumping-station registers.

Expose the limits as limite_de_para / limite_para_de list-properties
(interleaved de->para / para->de per patamar, mirroring RI) and point
ue() at the UE register class.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
DECOMP ships the long-term-mean monthly flows (MLT) as a raw
little-endian int32 blob with no reader in the library. The layout is
month-major (12 months x 320 postos, 15360 bytes); the naive
posto-major reshape yields garbage.

Add a BINARY SectionFile (Mlt + SecaoMlt) mirroring Vazoes, exposing
the table as a valores DataFrame with one row per month and one column
per posto, in m3/s.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The renovaveis.csv card file (parques eólicos equivalentes) had no
reader. Its registry cards are written space-padded while the
generation card is flush-left; cfinterface matches identifiers by a
regex search within the first IDENTIFIER_DIGITS characters, so an
exact-length window silently drops every padded line.

Add the five PEE register classes and the Renovaveis file, each with
IDENTIFIER_DIGITS = len(IDENTIFIER) + 1 so the window absorbs the
optional leading space and handles both conventions uniformly. The
period cards carry stage indices (not calendar months), so their fields
are integers rather than dates.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add reference pages and index entries for the new mlt.dat and
renovaveis.csv readers, record the changes in the changelog, and bump
the package version.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Raise the cfinterface floor to the version the library is built and
tested against, so the declared dependency matches reality.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rite

The IA FloatFields used decimal_digits=0, which rounds the exchange
limits to integers on write — the same precision-loss class fixed for
the other registers in 1.10.0, and the only decimal_digits=0 FloatFields
left. Exchange limits are integer MW in current decks, but a fractional
limit would be silently corrupted. Raise to decimal_digits=2 (matching
LU, the other width-10 field) and add a fractional round-trip test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.97571% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.04%. Comparing base (ef7f8e0) to head (9e927cc).

Files with missing lines Patch % Lines
idecomp/decomp/mlt.py 95.00% 2 Missing ⚠️
idecomp/decomp/modelos/dadger.py 90.47% 2 Missing ⚠️
idecomp/decomp/modelos/mlt.py 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #93      +/-   ##
==========================================
+ Coverage   92.82%   93.04%   +0.22%     
==========================================
  Files          93       97       +4     
  Lines        8442     8688     +246     
==========================================
+ Hits         7836     8084     +248     
+ Misses        606      604       -2     
Flag Coverage Δ
unittests 93.04% <97.97%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

ruff 0.16.0 expanded its default rule set (RUF012, D419, several B
rules), failing `ruff check` on code that passed under earlier ruff. The
RUF012 findings on cfinterface-inherited class attributes (REGISTERS,
SECTIONS, BLOCKS, VERSIONS) cannot be resolved with ClassVar without
breaking mypy --strict (cannot override a base instance variable with a
class variable). Pin ruff below 0.16 to keep the lint set the project
was built against; revisit as a dedicated modernization if desired.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rjmalves
rjmalves merged commit e36988e into main Jul 24, 2026
10 checks passed
@rjmalves
rjmalves deleted the feat/idecomp-upstream-fixes branch July 24, 2026 19:29
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.

1 participant