Skip to content

test: add 19 tests for GFS dataset module (Issue #120)#129

Open
Raakshass wants to merge 1 commit intoopenclimatefix:mainfrom
Raakshass:feature/gfs-test-coverage
Open

test: add 19 tests for GFS dataset module (Issue #120)#129
Raakshass wants to merge 1 commit intoopenclimatefix:mainfrom
Raakshass:feature/gfs-test-coverage

Conversation

@Raakshass
Copy link

  • Add 19 tests for gfs_dataset.py (open_gfs, handle_nan_values, GFSDataSampler)
  • Add conftest.py for cross-version ocf_data_sampler compatibility
  • Tests cover: zarr loading, dim renaming, NaN handling, time filtering, data slicing, normalization formula, and channel mismatch handling

Pull Request

Description

This PR improves the test coverage for the GFS dataset module by adding a comprehensive suite of unit tests. It includes:

  • 19 new tests for gfs_dataset.py covering key functions like open_gfs, handle_nan_values, and the GFSDataSampler class.
  • A conftest.py file to handle ocf_data_sampler version compatibility by pre-mocking necessary modules.
  • Verification of zarr loading, dimension renaming, NaN handling, and data normalization logic.

Fixes #120

How Has This Been Tested?

I ran the test suite locally using pytest.

  • Executed pytest tests/nwp/test_gfs_dataset.py

  • Verified that all 19 tests passed successfully.

  • Confirmed compatibility with ocf_data_sampler via the added conftest.py.

  • Yes

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

- Add 19 tests for gfs_dataset.py (open_gfs, handle_nan_values, GFSDataSampler)
- Add conftest.py for cross-version ocf_data_sampler compatibility
- Tests cover: zarr loading, dim renaming, NaN handling, time filtering,
  data slicing, normalization formula, and channel mismatch handling
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.

Code Coverage

1 participant