11import cfdm
22
33from ...mixin_container import Container
4- from .locks import netcdf_lock
5- from .mixin import ActiveStorageMixin , ArrayMixin , FileArrayMixin , IndexMixin
4+ from .mixin import ActiveStorageMixin , ArrayMixin , FileArrayMixin
65
76
87class H5netcdfArray (
98 ActiveStorageMixin ,
10- IndexMixin ,
119 FileArrayMixin ,
1210 ArrayMixin ,
1311 Container ,
@@ -23,59 +21,3 @@ class H5netcdfArray(
2321 .. versionadded:: NEXTVERSION
2422
2523 """
26-
27- def __dask_tokenize__ (self ):
28- """Return a value fully representative of the object.
29-
30- .. versionadded:: NEXTVERSION
31-
32- """
33- return super ().__dask_tokenize__ () + (self .get_mask (),)
34-
35- @property
36- def _lock (self ):
37- """Set the lock for use in `dask.array.from_array`.
38-
39- Returns a lock object because concurrent reads are not
40- currently supported by the HDF5 library. The lock object will
41- be the same for all `NetCDF4Array` and `H5netcdfArray`
42- instances, regardless of the dataset they access, which means
43- that access to all netCDF and HDF files coordinates around the
44- same lock.
45-
46- .. versionadded:: NEXTVERSION
47-
48- """
49- return netcdf_lock
50-
51- def _get_array (self , index = None ):
52- """Returns a subspace of the dataset variable.
53-
54- .. versionadded:: NEXTVERSION
55-
56- .. seealso:: `__array__`, `index`
57-
58- :Parameters:
59-
60- {{index: `tuple` or `None`, optional}}
61-
62- :Returns:
63-
64- `numpy.ndarray`
65- The subspace.
66-
67- """
68- if index is None :
69- index = self .index ()
70-
71- # We need to lock because the netCDF file is about to be accessed.
72- self ._lock .acquire ()
73-
74- # It's cfdm.H5netcdfArray.__getitem__ that we want to
75- # call here, but we use 'Container' in super because
76- # that comes immediately before cfdm.H5netcdfArray in
77- # the method resolution order.
78- array = super (Container , self ).__getitem__ (index )
79-
80- self ._lock .release ()
81- return array
0 commit comments