Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netcdf4 version causes error #2960

Closed
thja-pml opened this issue Oct 31, 2024 · 0 comments · Fixed by #2961
Closed

netcdf4 version causes error #2960

thja-pml opened this issue Oct 31, 2024 · 0 comments · Fixed by #2961
Assignees
Labels

Comments

@thja-pml
Copy link

Describe the bug
The cf_writer checks nercdf4 lib versions and seems to accept those with 'dev' in the name but not 'development'.

To Reproduce
Install the netcdf4 library with .netcdf4libversion 4.9.3-development
Try to write out file

# Your code here

import satpy
from satpy.readers import FSFile
from pygac_fdr.config import read_config
from pygac_fdr.reader import read_gac

config = read_config(conf_file)
scene = read_gac(
    LAC_test, reader_kwargs=config["controls"].get("reader_kwargs")
)

writer = NetcdfWriter(
    output_dir=config["output"].get("output_dir"),
    global_attrs=config.get("global_attrs"),
    gac_header_attrs=config.get("gac_header_attrs"),
    fname_fmt=config["output"].get("fname_fmt"),
    encoding=config["netcdf"].get("encoding"),
    engine=config["netcdf"].get("engine"),
    debug=config["controls"].get("debug"),
)

writer.write(scene=scene)

Expected behavior
The write fails due to a libnetcdf version error

Actual results
File /conda_path/AVHRR_FCDR/lib/python3.10/site-packages/satpy/writers/cf_writer.py:395, in _get_backend_versions()
391 def _get_backend_versions():
392 import netCDF4
393 return {
394 "netCDF4": Version(netCDF4.version),
--> 395 "libnetcdf": Version(netCDF4.netcdf4libversion),
396 "xarray": Version(xr.version)
397 }

File /conda_path/AVHRR_FCDR/lib/python3.10/site-packages/packaging/version.py:200, in Version.init(self, version)
198 match = self._regex.search(version)
199 if not match:
--> 200 raise InvalidVersion(f"Invalid version: '{version}'")
202 # Store the parsed out pieces of the version
203 self._version = _Version(
204 epoch=int(match.group("epoch")) if match.group("epoch") else 0,
205 release=tuple(int(i) for i in match.group("release").split(".")),
(...)
211 local=_parse_local_version(match.group("local")),
212 )

InvalidVersion: Invalid version: '4.9.3-development

Screenshots
If applicable, add screenshots to help explain your problem.

Environment Info:

  • OS: linux
  • Satpy Version: 0..48.0
  • PyResample Version: 1.28.3
  • Readers and writers dependencies (when relevant): [run from satpy.utils import check_satpy; check_satpy()]

Additional context
Add any other context about the problem here.

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 a pull request may close this issue.

2 participants