openpathsampling.storage.Storage
- class openpathsampling.storage.Storage(filename, mode=None, template=None, fallback=None)[source]
Create a netCDF+ storage for OPS Objects
A netCDF4 wrapper to store trajectories based on snapshots of an OpenMM simulation. This allows effective storage of shooting trajectories
- Parameters:
filename (string) – filename of the netcdf file to be used or created
mode (string, default: None) – the mode of file creation, one of ‘w’ (write), ‘a’ (append) or None, which will append any existing files.
template (
openpathsampling.Snapshot
) – a Snapshot instance that contains a reference to a Topology, the number of atoms and used units
- __init__(filename, mode=None, template=None, fallback=None)[source]
Create a storage for complex objects in a netCDF file
- Parameters:
filename (string) – filename of the netcdf file to be used or created
mode (str) – the mode of file creation, one of ‘w’ (write), ‘a’ (append) or ‘r’ (read-only) None, which will append any existing files (equal to append), is the default.
fallback (
openpathsampling.Storage
) – the _fallback_ storage to be loaded from if an object is not present in this storage. By default you will not try to resave objects that could be found in the fallback. Note that the fall back does only work if use_uuid is enabled
Notes
A single file can be opened by multiple storages, but only one can be used for writing
Methods
__init__
(filename[, mode, template, fallback])Create a storage for complex objects in a netCDF file
analysis_cache_sizes
()Cache Sizes for analysis sessions
cache_image
()Return an dict containing information about all caches
check_version
()close
()`close(self)`
createCompoundType
(datatype, datatype_name)`createCompoundType(self, datatype, datatype_name)`
createDimension
(dimname[, size])`createDimension(self, dimname, size=None)`
createEnumType
(datatype, datatype_name, ...)`createEnumType(self, datatype, datatype_name, enum_dict)`
createGroup
(groupname)`createGroup(self, groupname)`
createVLType
(datatype, datatype_name)`createVLType(self, datatype, datatype_name)`
createVariable
(varname, datatype[, ...])`createVariable(self, varname, datatype, dimensions=(), compression=None, zlib=False, complevel=4, shuffle=True, fletcher32=False, contiguous=False, chunksizes=None, szip_coding='nn', szip_pixels_per_block=8, blosc_shuffle=1, endian='native', least_significant_digit=None, significant_digits=None, quantize_mode='BitGroom', fill_value=None, chunk_cache=None)`
create_dimension
(dim_name[, size])Initialize a new dimension in the storage.
create_store
(name, store[, register_attr])Create a special variable type obj.name that can hold storable objects
create_type_delegate
(var_type)Create a variable value delegator for var_type
create_variable
(var_name, var_type, dimensions)Create a new variable in the netCDF storage.
create_variable_delegate
(var_name)Create a delegate property that wraps the netcdf.Variable and takes care of type conversions
default_cache_sizes
()Cache sizes for standard sessions for medium production and analysis.
delncattr
(name)`delncattr(self,name,value)`
filepath
([encoding])`filepath(self,encoding=None)`
finalize_stores
()Run initializations for all added stores.
find_store
(obj)Return the default store used for an storable object
fromcdl
(cdlfilename[, ncfilename, mode, format])`fromcdl(cdlfilename, ncfilename=None, mode='a',format='NETCDF4')`
get_value_parameters
(value)Compute netcdfplus compatible parameters to store a value
get_var_types
()List all allowed variable type to be used in create_variable
get_variables_by_attributes
(**kwargs)`get_variables_by_attributes(self, **kwargs)`
getncattr
(name[, encoding])`getncattr(self,name)`
has_blosc_filter
()`has_blosc_filter(self)` returns True if blosc compression filter is available
has_bzip2_filter
()`has_bzip2_filter(self)` returns True if bzip2 compression filter is available
has_szip_filter
()`has_szip_filter(self)` returns True if szip compression filter is available
has_zstd_filter
()`has_zstd_filter(self)` returns True if zstd compression filter is available
identify_var_type
(instance)Identify common python and numpy types
idx
(obj)Return the index used to store the given object in this storage
isopen
()`isopen(self)`
list_storable_objects
()Return a list of storable object base classes
list_stores
()Return a list of registered stores
load
(uuid)Load an object from the storage
lowmemory_cache_sizes
()Cache sizes for very low memory
memtest_cache_sizes
()Cache Sizes for memtest debugging sessions
ncattrs
()`ncattrs(self)`
no_cache_sizes
()Set cache sizes to no caching at all.
production_cache_sizes
()Cache Sizes for production runs
register_store
(name, store[, register_attr])Add a object store to the file
renameAttribute
(oldname, newname)`renameAttribute(self, oldname, newname)`
renameDimension
(oldname, newname)`renameDimension(self, oldname, newname)`
renameGroup
(oldname, newname)`renameGroup(self, oldname, newname)`
renameVariable
(oldname, newname)`renameVariable(self, oldname, newname)`
repr_json
(obj)Return the JSON representation in the storage if available
save
(obj[, idx])Save a storable object into the correct Storage in the netCDF file
set_always_mask
(value)`set_always_mask(self, True_or_False)`
set_auto_chartostring
(value)`set_auto_chartostring(self, True_or_False)`
set_auto_mask
(value)`set_auto_mask(self, True_or_False)`
set_auto_maskandscale
(value)`set_auto_maskandscale(self, True_or_False)`
set_auto_scale
(value)`set_auto_scale(self, True_or_False)`
set_caching_mode
([mode])Set default values for all caches
set_fill_off
()`set_fill_off(self)`
set_fill_on
()`set_fill_on(self)`
set_ncstring_attrs
(value)`set_ncstring_attrs(self, True_or_False)`
setncattr
(name, value)`setncattr(self,name,value)`
setncattr_string
(name, value)`setncattr_string(self,name,value)`
setncatts
(attdict)`setncatts(self,attdict)`
sync
()`sync(self)`
sync_all
()Convenience function to use
self.cvs
andself
at once.to_uuid_chunks
(x)tocdl
([coordvars, data, outfile])`tocdl(self, coordvars=False, data=False, outfile=None)`
unlimited_cache_sizes
()Set cache sizes to no caching at all.
update_delegates
()Updates the set of delegates in self.vars
update_storable_classes
()var_type_to_nc_type
(var_type)Return the compatible netCDF variable type for var_type
write_meta
()Attributes
USE_FEATURE_SNAPSHOTS
auto_complex
cmptypes
data_model
dimensions
disk_format
enumtypes
file_format
file_size
file_size_str
filename
groups
keepweakref
name
string name of Group instance
objects
Return a dictionary of all objects stored.
parent
path
support_simtk_unit
tags
variables
vltypes