Skip to content

Commit 90b4a0a

Browse files
committed
Use 'safe-access' version of netCDF4.VLType to satisfy coding-standards checker.
1 parent f33ce39 commit 90b4a0a

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

lib/iris/fileformats/netcdf/_thread_safe_nc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# Doesn't need thread protection, but this allows all netCDF4 refs to be
2121
# replaced with thread_safe refs.
2222
default_fillvals = netCDF4.default_fillvals
23+
VLType = netCDF4.VLType
2324

2425

2526
class _ThreadSafeWrapper(ABC):

lib/iris/fileformats/netcdf/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _get_cf_var_data(cf_var, filename):
219219
# arrays as the size of the array can only be known by reading the data.
220220
# "Variable length" netCDF types have a datatype of `nc.VLType`.
221221
if isinstance(
222-
getattr(cf_var, "datatype", None), _thread_safe_nc.netCDF4.VLType
222+
getattr(cf_var, "datatype", None), _thread_safe_nc.VLType
223223
): # TODO(ChrisB): I am accessing netCDF4 directly here - is this ok? Just for type comparison.
224224
# We can't know the size of VLen data without reading the variable from disk
225225
# first; see https://github.com/Unidata/netcdf-c/issues/1893

lib/iris/tests/unit/fileformats/netcdf/loader/test__get_cf_var_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
from unittest import mock
1212

1313
import dask.array as da
14-
from netCDF4 import VLType
1514
import numpy as np
1615

1716
from iris._lazy_data import _optimum_chunksize
1817
import iris.fileformats.cf
18+
from iris.fileformats.netcdf._thread_safe_nc import VLType
1919
from iris.fileformats.netcdf.loader import CHUNK_CONTROL, _get_cf_var_data
2020

2121

0 commit comments

Comments
 (0)