Skip to content

Conversation

@SpacemanPaul
Copy link
Contributor

@SpacemanPaul SpacemanPaul commented Dec 23, 2025

Reason for this pull request

Distracting messages when reading from non-netcdf files when netCDF4 is not installed as per #2282

Proposed changes

  • Ensure netCDF driver can be loaded enough to cleanly report that it cannot be loaded enough to actually use

  • Prevent datacube.driver.netcdf.__init__ from importing stuff that might break.

  • Closes #xxxx

  • Tests added / passed

  • Pull Request Title will make sense in ODC Release Notes


📚 Documentation preview 📚: https://opendatacube--2305.org.readthedocs.build/en/2305/

@SpacemanPaul SpacemanPaul marked this pull request as ready for review December 23, 2025 01:05
@codecov
Copy link

codecov bot commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.12%. Comparing base (9ccc81b) to head (e5a3f8d).

Files with missing lines Patch % Lines
datacube/drivers/netcdf/driver.py 62.50% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2305      +/-   ##
===========================================
- Coverage    86.13%   86.12%   -0.02%     
===========================================
  Files          155      154       -1     
  Lines        16955    16949       -6     
===========================================
- Hits         14605    14598       -7     
- Misses        2350     2351       +1     

☔ View full report in Codecov by Sentry.
📢 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.

_LOG.warning("Error was: %s", repr(e))
return None

try:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how things are wired up, but isn't there a missing if driver_init is None: before this try?

It's possible I'm in the wrong place, but there should be a check for the new None value returned from reader_driver_init and writer_driver_init somewhere.

Copy link
Contributor

@pjonsson pjonsson left a comment

Choose a reason for hiding this comment

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

Please add the missing None check where it should be before merging this.

Besides that I think this looks great, can't wait to not have those warnings in the logs!

Edit: I've spent a fair amount of time on debugging ODC-related things now and I find it difficult to read and navigate both git commit logs and git blame when the same logical change is spread out over multiple commits. The scattered commits also frequently have a commit message that mostly makes sense when read in sequence of the commit stack of the PR, not when looking at an individual commit. For this particular PR, I'm guessing it should consist of one or at most two commits.

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.

3 participants