Skip to content

Fix GCV reader, plotting, packaging and CI; add regression tests - #13

Merged
cfbastarz merged 1 commit into
mainfrom
codex/revise-codigo-e-corrija-bugs
Sep 30, 2026
Merged

cfbastarz merged 1 commit into
mainfrom
codex/revise-codigo-e-corrija-bugs

Conversation

@cfbastarz

Copy link
Copy Markdown
Collaborator

Motivation

  • Remove multiple robustness and usability issues found while reading .gcv matrices and when producing plots, and make packaging/CI sane for modern Python tooling.
  • Ensure plotting helpers behave predictably with unit conversions and that human-readable matrix names can be changed without corrupting the API.

Description

  • Improve the GCV reader in gsiberror/__init__.py to validate header/record sizes, reject truncated or invalid files, detect Git LFS pointer files with an actionable message, and produce a non-duplicated cyclic longitude axis (endpoint=False for longitudes).
  • Fix Berror.my_name so it no longer overwrites itself and provide get_name to return the configured display name, defaulting to the filename.
  • Harden plotting utilities in gsiberror/plot_functions.py by validating inputs, raising descriptive ValueError for unknown variables, applying global min/max after unit conversions (e.g. pressure and humidity scalings), and returning the created matplotlib figure objects.
  • Clean up setup.py and environment.yml metadata and dependency constraints (project_urls, extras_require, relax Cartopy pin, align numpy/python requirements).
  • Add regression tests tests/test_berror.py and tests/test_plot_functions.py covering LFS pointer detection, truncated files, name-setting, var_name validation, and global_minmax scaling behaviour.
  • Add a CI job in .github/workflows/ci.yml to run lint/format checks and pytest on pull requests and limit docs deployment to pushes on main.

Testing

  • Ran PYTHONWARNINGS=error python -m compileall -q gsiberror tests setup.py which completed without warnings.
  • Ran ruff check . --exclude notebooks and ruff format --check gsiberror tests setup.py which passed after automatic fixes.
  • Ran git diff --check and static checks to ensure formatting and no leftover issues, which passed.
  • Ran pytest -q in the local image but collection failed due to missing runtime dependencies (ModuleNotFoundError: No module named 'numpy' and inability to import the package because the test runner environment did not have the package installed), so unit tests could not be executed locally; the CI job added to the workflow installs pip install -e ".[dev]" before running tests to ensure dependencies are available.
  • Attempts to install missing packages (pip install) and to create a remote issue via gh failed in this environment because network/proxy and GitHub authentication are not available, and python setup.py --name could not run here because setuptools is not present in the image.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de8f26577b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Point the pip cache at an existing dependency file

In the added test job, actions/setup-python@v5 enables the pip cache without cache-dependency-path, so it searches its default dependency manifests (requirements.txt or pyproject.toml). This commit contains neither file—the dependencies are declared in setup.py—causing setup-python to stop before the install, lint, and test steps. Set cache-dependency-path to setup.py/environment.yml or disable caching.

Useful? React with 👍 / 👎.

Comment thread tests/test_berror.py
Comment on lines +13 to +14
with pytest.raises(ValueError, match="git lfs pull"):
gb.Berror(SAMPLE).read_records()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Create an LFS pointer fixture instead of using tracked data

When tests run in a normal clone where Git LFS smudged the sample—or after following the reader's own git lfs pull advice—SAMPLE is real GCV data, so read_records() does not raise the expected pointer error and this test fails. The current CI hides the problem with lfs: false; write a pointer into tmp_path so the test remains deterministic regardless of checkout state.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de8f26577b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Point the pip cache at an existing dependency file

In the added test job, actions/setup-python@v5 enables the pip cache without cache-dependency-path, so it searches its default dependency manifests (requirements.txt or pyproject.toml). This commit contains neither file—the dependencies are declared in setup.py—causing setup-python to stop before the install, lint, and test steps. Set cache-dependency-path to setup.py/environment.yml or disable caching.

Useful? React with 👍 / 👎.

Comment thread tests/test_berror.py
Comment on lines +13 to +14
with pytest.raises(ValueError, match="git lfs pull"):
gb.Berror(SAMPLE).read_records()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Create an LFS pointer fixture instead of using tracked data

When tests run in a normal clone where Git LFS smudged the sample—or after following the reader's own git lfs pull advice—SAMPLE is real GCV data, so read_records() does not raise the expected pointer error and this test fails. The current CI hides the problem with lfs: false; write a pointer into tmp_path so the test remains deterministic regardless of checkout state.

Useful? React with 👍 / 👎.

@cfbastarz
cfbastarz merged commit 710e6c6 into main Sep 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant