Skip to content

Diff between 2 netcdf files fails #65

@vernaym

Description

@vernaym

The comparison of two netcdf files with a "vortex.diff" fails due to an import chercker of the netcdf package.

Minimal code to reproduce the issue :

 import vortex
   
vortex.input(   
    nativefmt='netcdf',
    unknown=True,
    remote='netcdf1.nc',
    local="input.nc",
)

vortex.diff(   
    nativefmt='netcdf',
    unknown=True,
    remote='netcdf2.nc',
    local="reference.nc",
)

Traceback:

 File "/home/cnrm_other/cen/mrns/vernaym/tmp/test_diff_netcdf/diff_init_TG.py", line 21, in <module>
    vortex.diff(   
  File "/home/cnrm_other/cen/mrns/vernaym/venv/vortex2/lib/python3.10/site-packages/vortex/toolbox.py", line 871, in diff
    rc = t.sh.diff(
  File "/home/cnrm_other/cen/mrns/vernaym/venv/vortex2/lib/python3.10/site-packages/vortex/tools/systems.py", line 126, in formatted_method
    return fmtcall(*args, **kw)
  File "/home/cnrm_other/cen/mrns/vernaym/venv/vortex2/lib/python3.10/site-packages/vortex/tools/systems.py", line 3746, in netcdf_diff
    if b_netcdf_checker.is_available():
  File "/home/cnrm_other/cen/mrns/vernaym/venv/vortex2/lib/python3.10/site-packages/bronx/syntax/externalcode.py", line 138, in is_available
    raise RuntimeError('No import was attempted yet for package {!s}.'
RuntimeError: No import was attempted yet for package netdcf.

The issue seems to have been introduced by commit #b1a66ac238deb36b54679fe302096a6f6242125d in the method "netcdf_diff" of tools/systems.py, when the line :

from bronx.datagrip import netcdf as b_netcdf

has been replaced by :

        with b_netcdf_checker as npregister:
            from bronx.datagrip import netcdf as b_netcdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions