Add --gzip-large-csvs flag to compress large result CSVs#117
Merged
Conversation
…hold After all *Results() writers finish but before the run-status sentinel JSON is written, scan the output directory and rewrite every oT_Result_*.csv whose uncompressed size is at least --gzip-threshold-mb (default 5 MB) as .csv.gz. Pandas reads .csv.gz transparently with compression='infer', so downstream tooling needs no change. Opt-in: default behaviour is bit-for-bit identical to before. The sentinel JSON gains three new fields (gzip_threshold_mb, gzip_files, gzip_mb_saved) reporting what the pass did. Verified on the bundled 9n case: 2 of 87 CSVs cleared the 5 MB threshold and shrank ~6x (6.46 -> 1.05 MB, 6.98 -> 1.11 MB); pandas read-back parity matches shape and frame equality with the plain-CSV baseline. EOF
Changes:
- Drop --gzip-threshold-mb; add --gzip-patterns (comma-separated
name-prefixes, applied after the leading 'oT_Result_').
- Default pattern set: Generation, Consumption, Balance, MarketResults,
Network — exposed as openTEPES.DEFAULT_GZIP_PATTERNS for reuse.
- Help text now flags the Excel caveat explicitly (.csv.gz cannot be
opened directly in Excel).
- Sentinel JSON: gzip_threshold_mb -> gzip_patterns.
Verified on bundled 9n: under default patterns, 49 of 87 oT_Result_*.csv
files compress, saving 31 MB (56 MB -> 25 MB total). Read-back parity
passes on the largest tables (shape + frame equality).
EOF
arght
approved these changes
May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--gzip-large-csvs(+--gzip-threshold-mb,default 5) for
openTEPES_Main.openTEPES_runrewritesoT_Result_*.csvfilesat or above the threshold as
.csv.gz. Pandas reads the resultnatively; downstream tooling unchanged.
gzip_threshold_mb,gzip_files,gzip_mb_savedfor batch monitoring.Behaviour
writer has finished. Pure rename pass, no chained-DataFrame churn.
Test plan
baseline (sentinel reports
gzip_files: 0).--gzip-large-csvsat default 5 MB → 2/87 CSVscompressed (~6x shrink); pandas read-back parity passes
(
shape,.equals()).