In `cf.read`, skip caching elements from compression index variables. by davidhassell · Pull Request #671 · NCAS-CMS/cf-python
Expand Up
@@ -154,6 +154,7 @@ def _create_data(
parent_ncvar=None,
coord_ncvar=None,
cfa_term=None,
compression_index=False,
):
"""Create data for a netCDF or CFA-netCDF variable.
Expand Down Expand Up @@ -181,6 +182,12 @@ def _create_data(
.. versionadded:: 3.15.0
compression_index: `bool`, optional True if the data being created are compression indices.
.. versionadded:: 3.15.2
:Returns:
`Data` Expand All @@ -201,12 +208,19 @@ def _create_data( # one dask chunk if data.npartitions == 1: data._cfa_set_write(True)
if self.implementation.get_construct_type(construct) != "field": # Only cache values from non-field data, on the # assumption that field data is, in general, so large # that finding the cached values takes too long. See # method `_cache_data_elements` for details. if ( not compression_index and self.implementation.get_construct_type(construct) != "field" ): # Only cache values from non-field data and # non-compression-index data, on the assumptions that: # # a) Field data is, in general, so large that finding # the cached values takes too long. # # b) Cached values are never really required for # compression index data. self._cache_data_elements(data, ncvar)
return data Expand Down
Expand Down Expand Up @@ -181,6 +182,12 @@ def _create_data(
.. versionadded:: 3.15.0
compression_index: `bool`, optional True if the data being created are compression indices.
.. versionadded:: 3.15.2
:Returns:
`Data` Expand All @@ -201,12 +208,19 @@ def _create_data( # one dask chunk if data.npartitions == 1: data._cfa_set_write(True)
if self.implementation.get_construct_type(construct) != "field": # Only cache values from non-field data, on the # assumption that field data is, in general, so large # that finding the cached values takes too long. See # method `_cache_data_elements` for details. if ( not compression_index and self.implementation.get_construct_type(construct) != "field" ): # Only cache values from non-field data and # non-compression-index data, on the assumptions that: # # a) Field data is, in general, so large that finding # the cached values takes too long. # # b) Cached values are never really required for # compression index data. self._cache_data_elements(data, ncvar)
return data Expand Down