Skip to content

Replace nccmp with xarray in test_remap_pp_components.py#827

Open
Copilot wants to merge 4 commits intomainfrom
copilot/remove-replace-nccmp-test-remap-pp-components
Open

Replace nccmp with xarray in test_remap_pp_components.py#827
Copilot wants to merge 4 commits intomainfrom
copilot/remove-replace-nccmp-test-remap-pp-components

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

Describe your changes

Remove nccmp subprocess calls from two test files, replacing with native xarray comparisons.

fre/app/remap_pp_components/tests/test_remap_pp_components.py:

  • nccmp -dxr.testing.assert_equal for 3 data comparison tests
  • Renamed test_nccmp_*test_compare_*

fre/pp/tests/test_split_netcdf.py:

  • nccmp -d --forcexr.testing.assert_equal in test_split_file_data
  • nccmp -mg --forcexr.testing.assert_identical in test_split_file_metadata (covers both global attrs and variable metadata)

Both files use context managers for dataset cleanup:

with xr.open_dataset(path1, decode_cf=False, decode_times=False) as ds1, \
     xr.open_dataset(path2, decode_cf=False, decode_times=False) as ds2:
    xr.testing.assert_equal(ds1, ds2)

xarray is already a project dependency; no new dependencies added.

Issue ticket number and link (if applicable)

Checklist before requesting a review

  • I ran my code
  • I tried to make my code readable
  • I tried to comment my code
  • I wrote a new test, if applicable
  • I wrote new instructions/documentation, if applicable
  • I ran pytest and inspected it's output
  • I ran pylint and attempted to implement some of it's feedback
  • No print statements; all user-facing info uses logging module

Copilot AI and others added 2 commits April 1, 2026 16:13
- In test_remap_pp_components.py: replaced 3 nccmp -d calls with
  xr.testing.assert_equal, renamed test_nccmp_* to test_compare_*
- In test_split_netcdf.py: replaced nccmp -d with xr.testing.assert_equal
  for data tests, replaced nccmp -mg with xr.testing.assert_identical
  for metadata tests

Agent-Logs-Url: https://github.com/NOAA-GFDL/fre-cli/sessions/288da653-c4d3-4b41-bc3b-d062092ae272

Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove and replace nccmp from test_remap_pp_components.py Replace nccmp with xarray in test_remap_pp_components.py and test_split_netcdf.py Apr 1, 2026
Copilot AI requested a review from ilaflott April 1, 2026 16:19
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.12%. Comparing base (7e80492) to head (f7fe253).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #827   +/-   ##
=======================================
  Coverage   84.12%   84.12%           
=======================================
  Files          71       71           
  Lines        4944     4944           
=======================================
  Hits         4159     4159           
  Misses        785      785           
Flag Coverage Δ
unittests 84.12% <ø> (ø)

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


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e80492...f7fe253. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ilaflott ilaflott requested a review from cwhitlock-NOAA April 1, 2026 17:19
@ilaflott ilaflott marked this pull request as ready for review April 1, 2026 18:16
@ilaflott ilaflott changed the title Replace nccmp with xarray in test_remap_pp_components.py and test_split_netcdf.py Replace nccmp with xarray in test_remap_pp_components.py Apr 1, 2026
@ilaflott ilaflott changed the title Replace nccmp with xarray in test_remap_pp_components.py Replace nccmp with xarray in test_remap_pp_components.py Apr 1, 2026
@ilaflott ilaflott added the beta1 label Apr 1, 2026
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.

remove+replace nccmp from fre/app/remap_pp_components/tests/test_remap_pp_components.py

2 participants