# Path: openpathsampling/netcdfplus/stores/value.py
# class ValueStore(ObjectStore):
#     """
#     Store that stores a value by integer index
# 
#     Usually used to save additional attributes for objects
# 
#     See Also
#     --------
#     `PseudoAttribute`, `PseudoAttributeStore`
#     """
#     def __init__(
#             self,
#             key_class,
#             allow_incomplete=False,
#             chunksize=256
#     ):
#         super(ValueStore, self).__init__(None)
#         self.key_class = key_class
#         self.object_index = None
#         self.allow_incomplete = allow_incomplete
#         self.chunksize = chunksize
# 
#         self.object_pos = None
#         self._len = 0
# 
#     def to_dict(self):
#         return {
#             'key_class': self.key_class,
#             'allow_incomplete': self.allow_incomplete,
#             'chunksize': self.chunksize
#         }
# 
#     def create_uuid_index(self):
#         return dict()
# 
#     def register(self, storage, prefix):
#         super(ValueStore, self).register(storage, prefix)
#         self.object_pos = self.storage._objects[self.key_class].pos
# 
#     def __len__(self):
#         return len(self.variables['value'])
# 
#     # ==========================================================================
#     # LOAD/SAVE DECORATORS FOR CACHE HANDLING
#     # ==========================================================================
# 
#     def load(self, idx):
#         pos = self.object_pos(idx)
#         if pos is None:
#             return None
# 
#         if self.allow_incomplete:
#             # we want to load by uuid and it was not in cache.
#             if pos in self.index:
#                 n_idx = self.index[pos]
#             else:
#                 return None
#             if n_idx < 0:
#                 return None
#         else:
#             if pos < self._len:
#                 n_idx = pos
#             else:
#                 return None
# 
#         # if it is in the cache, return it
#         try:
#             obj = self.cache[n_idx]
#             return obj
# 
#         except KeyError:
#             pass
# 
#         obj = self.vars['value'][n_idx]
# 
#         self.cache[n_idx] = obj
# 
#         return obj
# 
#     def __setitem__(self, idx, value):
#         pos = self.object_pos(idx)
# 
#         if pos is None:
#             return
# 
#         if self.allow_incomplete:
#             if pos in self.index:
#                 return
# 
#             n_idx = len(self.index)
# 
#             self.cache.update_size(n_idx)
# 
#         else:
#             if pos < self._len:
#                 return
# 
#             n_idx = idx
# 
#         if self.allow_incomplete:
#             # only if partial storage is used store index and update
#             self.vars['index'][n_idx] = pos
#             self.index[pos] = n_idx
# 
#         self.vars['value'][n_idx] = value
#         self.cache[n_idx] = value
#         self._len = max(self._len, n_idx + 1)
# 
#     def fill_cache(self):
#         self.cache.load_max()
# 
#     def restore(self):
#         if self.allow_incomplete:  # only if partial storage is used
#             for pos, idx in enumerate(self.vars['index'][:]):
#                 self.index[idx] = pos
# 
#         self._len = len(self)
#         self.initialize_cache()
# 
#     def initialize(self):
#         self.initialize_cache()
# 
#     def initialize_cache(self):
#         self.cache = LRUChunkLoadingCache(
#             chunksize=self.chunksize,
#             variable=self.vars['value']
#         )
#         self.cache.update_size()
# 
#     def __getitem__(self, item):
#         # enable numpy style selection of objects in the store
#         try:
#             if isinstance(item, self.key_class):
#                 return self.load(item)
#             elif type(item) is list:
#                 return [self.load(idx) for idx in item]
#         except KeyError:
#             pass
# 
#         return None
# 
#     def get(self, item):
#         if self.allow_incomplete:
#             try:
#                 return self.load(item)
#             except KeyError:
#                 return None
#         else:
#             return self.load(item)


from .named import UniqueNamedObjectStore
from openpathsampling.netcdfplus.attribute import PseudoAttribute
from openpathsampling.netcdfplus.stores.value import ValueStore
        Return the storage.vars[''] variable that contains the values

        Parameters
        ----------
        cv : :class:`openpathsampling.netcdf.PseudoAttribute`
            the objectdict you request the attached variable store
        template : :obj:`openpathsampling.engines.BaseSnapshot`
            an optional snapshot to be used to compute a test value of the CV.
            This will determine the type and shape of the
        allow_incomplete : bool
            if `True` the added store can hold a part of all values. Useful if
            the values are large and/or complex and you do not need them for all
            snapshots
        chunksize : int
            for partial storage you can set a chunksize and speedup
        """

        if template is None:
            if cv.diskcache_template is not None:
                template = cv.diskcache_template
            elif len(self.key_store(cv)) > 0:
                template = self.key_store(cv)[0]

            else:
                raise RuntimeError(
                    'Need either at least one stored object to use as a '
                    'template to determine type and shape of the CV. '
                    'No items in store: ' + str(self.key_store(cv)))

        self.key_store(cv).add_attribute(

# Path: openpathsampling/netcdfplus/stores/value.py
# class ValueStore(ObjectStore):
#     """
#     Store that stores a value by integer index
# 
#     Usually used to save additional attributes for objects
# 
#     See Also
#     --------
#     `PseudoAttribute`, `PseudoAttributeStore`
#     """
#     def __init__(
#             self,
#             key_class,
#             allow_incomplete=False,
#             chunksize=256
#     ):
#         super(ValueStore, self).__init__(None)
#         self.key_class = key_class
#         self.object_index = None
#         self.allow_incomplete = allow_incomplete
#         self.chunksize = chunksize
# 
#         self.object_pos = None
#         self._len = 0
# 
#     def to_dict(self):
#         return {
#             'key_class': self.key_class,
#             'allow_incomplete': self.allow_incomplete,
#             'chunksize': self.chunksize
#         }
# 
#     def create_uuid_index(self):
#         return dict()
# 
#     def register(self, storage, prefix):
#         super(ValueStore, self).register(storage, prefix)
#         self.object_pos = self.storage._objects[self.key_class].pos
# 
#     def __len__(self):
#         return len(self.variables['value'])
# 
#     # ==========================================================================
#     # LOAD/SAVE DECORATORS FOR CACHE HANDLING
#     # ==========================================================================
# 
#     def load(self, idx):
#         pos = self.object_pos(idx)
#         if pos is None:
#             return None
# 
#         if self.allow_incomplete:
#             # we want to load by uuid and it was not in cache.
#             if pos in self.index:
#                 n_idx = self.index[pos]
#             else:
#                 return None
#             if n_idx < 0:
#                 return None
#         else:
#             if pos < self._len:
#                 n_idx = pos
#             else:
#                 return None
# 
#         # if it is in the cache, return it
#         try:
#             obj = self.cache[n_idx]
#             return obj
# 
#         except KeyError:
#             pass
# 
#         obj = self.vars['value'][n_idx]
# 
#         self.cache[n_idx] = obj
# 
#         return obj
# 
#     def __setitem__(self, idx, value):
#         pos = self.object_pos(idx)
# 
#         if pos is None:
#             return
# 
#         if self.allow_incomplete:
#             if pos in self.index:
#                 return
# 
#             n_idx = len(self.index)
# 
#             self.cache.update_size(n_idx)
# 
#         else:
#             if pos < self._len:
#                 return
# 
#             n_idx = idx
# 
#         if self.allow_incomplete:
#             # only if partial storage is used store index and update
#             self.vars['index'][n_idx] = pos
#             self.index[pos] = n_idx
# 
#         self.vars['value'][n_idx] = value
#         self.cache[n_idx] = value
#         self._len = max(self._len, n_idx + 1)
# 
#     def fill_cache(self):
#         self.cache.load_max()
# 
#     def restore(self):
#         if self.allow_incomplete:  # only if partial storage is used
#             for pos, idx in enumerate(self.vars['index'][:]):
#                 self.index[idx] = pos
# 
#         self._len = len(self)
#         self.initialize_cache()
# 
#     def initialize(self):
#         self.initialize_cache()
# 
#     def initialize_cache(self):
#         self.cache = LRUChunkLoadingCache(
#             chunksize=self.chunksize,
#             variable=self.vars['value']
#         )
#         self.cache.update_size()
# 
#     def __getitem__(self, item):
#         # enable numpy style selection of objects in the store
#         try:
#             if isinstance(item, self.key_class):
#                 return self.load(item)
#             elif type(item) is list:
#                 return [self.load(idx) for idx in item]
#         except KeyError:
#             pass
# 
#         return None
# 
#     def get(self, item):
#         if self.allow_incomplete:
#             try:
#                 return self.load(item)
#             except KeyError:
#                 return None
#         else:
#             return self.load(item)


# Path: openpathsampling/netcdfplus/stores/attribute.py
from .named import UniqueNamedObjectStore
from openpathsampling.netcdfplus.attribute import PseudoAttribute
from openpathsampling.netcdfplus.stores.value import ValueStore

        Return the storage.vars[''] variable that contains the values

        Parameters
        ----------
        cv : :class:`openpathsampling.netcdf.PseudoAttribute`
            the objectdict you request the attached variable store
        template : :obj:`openpathsampling.engines.BaseSnapshot`
            an optional snapshot to be used to compute a test value of the CV.
            This will determine the type and shape of the
        allow_incomplete : bool
            if `True` the added store can hold a part of all values. Useful if
            the values are large and/or complex and you do not need them for all
            snapshots
        chunksize : int
            for partial storage you can set a chunksize and speedup
        """

        if template is None:
            if cv.diskcache_template is not None:
                template = cv.diskcache_template
            elif len(self.key_store(cv)) > 0:
                template = self.key_store(cv)[0]

            else:
                raise RuntimeError(
                    'Need either at least one stored object to use as a '
                    'template to determine type and shape of the CV. '
                    'No items in store: ' + str(self.key_store(cv)))

        self.key_store(cv).add_attribute(

            ValueStore,