Skip to content

feat(hidr): suporte ao formato f64 (832 bytes) com detecção automática#93

Merged
rjmalves merged 1 commit into
mainfrom
feat/hidr-f64
Jun 10, 2026
Merged

feat(hidr): suporte ao formato f64 (832 bytes) com detecção automática#93
rjmalves merged 1 commit into
mainfrom
feat/hidr-f64

Conversation

@rjmalves

Copy link
Copy Markdown
Owner

Resumo

Adiciona suporte ao formato estendido do arquivo hidr.dat, em que os coeficientes dos polinômios volume-cota e cota-área são armazenados em precisão dupla (registros de 832 bytes). Paridade com a funcionalidade equivalente do idecomp.

Funcionalidade

  • Novo registro RegistroUHEHidrF64 (832 bytes) para os coeficientes em 64 bits.
  • Hidr detecta o formato automaticamente pelo tamanho do arquivo, reconhecendo cadastros de 320 ou 600 usinas em registros de 792 ou 832 bytes. Tamanhos não reconhecidos geram aviso e assumem o formato f32. A detecção pode ser forçada com version="f32" / version="f64".
  • Propriedade tamanho_registro e método converte_tamanho_registro para inspecionar e converter entre os formatos (a conversão f64→f32 perde precisão nos polinômios).

Versão

  • Bump para 1.3.0 com entrada correspondente no CHANGELOG.md.

Notas

  • O conteúdo de teste no formato f64 é gerado a partir do mock f32 existente (conversão f32→f64, que é exata). Não há um mock f64 real no repositório.
  • Mantida a dependência cfinterface>=1.9.0 (o recurso não depende do modo compact).

Testes

  • pytest ./tests579 testes (16 novos para o hidr, cobrindo as 4 combinações 320/600 × f32/f64, conversões e o tamanho não reconhecido).
  • ruff check, ruff format --check, mypy ./idessem (strict, 108 arquivos) — sem problemas.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.94%. Comparing base (ab7916d) to head (0688218).

Files with missing lines Patch % Lines
idessem/dessem/hidr.py 97.87% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #93      +/-   ##
==========================================
+ Coverage   95.93%   95.94%   +0.01%     
==========================================
  Files         103      103              
  Lines        7740     7786      +46     
==========================================
+ Hits         7425     7470      +45     
- Misses        315      316       +1     
Flag Coverage Δ
unittests 95.94% <98.07%> (+0.01%) ⬆️

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.

Add RegistroUHEHidrF64 for hidr.dat files that store the volume-cota
and cota-area polynomial coefficients in double precision (832-byte
records). Hidr auto-detects the format from the file size, recognizing
cadastros of 320 or 600 usinas in 792- or 832-byte records, and can
convert between precisions via converte_tamanho_registro. Adds a real
f64 hidr.dat fixture (320 usinas, full double precision).

Also vectorize the cadastro DataFrame construction (build in bulk
instead of row-by-row), matching idecomp and substantially speeding up
hidr.dat reads; integer columns now use the nullable Int64 dtype.

Releases as 1.3.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rjmalves rjmalves merged commit 7468777 into main Jun 10, 2026
10 checks passed
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