LSST Applications
21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
|
Public Member Functions | |
def | __init__ (self, uri, create) |
def | __repr__ (self) |
def | write (self, butlerLocation, obj) |
def | read (self, butlerLocation) |
def | butlerLocationExists (self, location) |
def | exists (self, location) |
def | locationWithRoot (self, location) |
def | copyFile (self, fromLocation, toLocation) |
def | getLocalFile (self, path) |
def | instanceSearch (self, path) |
def | getReadFormatter (cls, objType) |
def | getWriteFormatter (cls, objType) |
def | registerFormatters (cls, formatable, readFormatter=None, writeFormatter=None) |
def | getRepositoryCfg (cls, uri) |
def | putRepositoryCfg (cls, cfg, loc=None) |
def | getMapperClass (cls, root) |
def | relativePath (cls, fromPath, toPath) |
def | absolutePath (cls, fromPath, relativePath) |
Static Public Member Functions | |
def | relativePath (fromPath, toPath) |
def | absolutePath (fromPath, relativePath) |
def | getRepositoryCfg (uri) |
def | putRepositoryCfg (cfg, loc=None) |
def | getMapperClass (root) |
def | getParentSymlinkPath (root) |
def | v1RepoExists (root) |
def | search (root, path, searchParents=False) |
def | storageExists (uri) |
Public Attributes | |
log | |
root | |
Defines the interface for a storage location on the local filesystem. Parameters ---------- uri : string URI or path that is used as the storage location. create : bool If True a new repository will be created at the root location if it does not exist. If False then a new repository will not be created. Raises ------ NoRepositroyAtRoot If create is False and a repository does not exist at the root specified by uri then NoRepositroyAtRoot is raised.
Definition at line 45 of file posixStorage.py.
def lsst.daf.persistence.posixStorage.PosixStorage.__init__ | ( | self, | |
uri, | |||
create | |||
) |
initialzer
Reimplemented from lsst.daf.persistence.storageInterface.StorageInterface.
Definition at line 63 of file posixStorage.py.
def lsst.daf.persistence.posixStorage.PosixStorage.__repr__ | ( | self | ) |
Definition at line 71 of file posixStorage.py.
|
inherited |
Get an absolute path for the path from fromUri to toUri Parameters ---------- fromPath : the starting location A location at which to start. It can be a relative path or an absolute path. relativePath : the location relative to fromPath A relative path. Returns ------- string Path that is an absolute path representation of fromPath + relativePath, if one exists. If relativePath is absolute or if fromPath is not related to relativePath then relativePath will be returned.
Definition at line 373 of file storageInterface.py.
|
static |
Get an absolute path for the path from fromUri to toUri Parameters ---------- fromPath : the starting location A location at which to start. It can be a relative path or an absolute path. relativePath : the location relative to fromPath A relative path. Returns ------- string Path that is an absolute path representation of fromPath + relativePath, if one exists. If relativePath is absolute or if fromPath is not related to relativePath then relativePath will be returned.
Definition at line 100 of file posixStorage.py.
def lsst.daf.persistence.posixStorage.PosixStorage.butlerLocationExists | ( | self, | |
location | |||
) |
Implementation of PosixStorage.exists for ButlerLocation objects.
Definition at line 283 of file posixStorage.py.
def lsst.daf.persistence.posixStorage.PosixStorage.copyFile | ( | self, | |
fromLocation, | |||
toLocation | |||
) |
Copy a file from one location to another on the local filesystem. Parameters ---------- fromLocation : path Path and name of existing file. toLocation : path Path and name of new file. Returns ------- None
Reimplemented from lsst.daf.persistence.storageInterface.StorageInterface.
Definition at line 351 of file posixStorage.py.
def lsst.daf.persistence.posixStorage.PosixStorage.exists | ( | self, | |
location | |||
) |
Check if location exists. Parameters ---------- location : ButlerLocation or string A a string or a ButlerLocation that describes the location of an object in this storage. Returns ------- bool True if exists, else False.
Reimplemented from lsst.daf.persistence.storageInterface.StorageInterface.
Definition at line 299 of file posixStorage.py.
def lsst.daf.persistence.posixStorage.PosixStorage.getLocalFile | ( | self, | |
path | |||
) |
Get a handle to a local copy of the file, downloading it to a temporary if needed. Parameters ---------- A path the the file in storage, relative to root. Returns ------- A handle to a local copy of the file. If storage is remote it will be a temporary file. If storage is local it may be the original file or a temporary file. The file name can be gotten via the 'name' property of the returned object.
Reimplemented from lsst.daf.persistence.storageInterface.StorageInterface.
Definition at line 367 of file posixStorage.py.
|
inherited |
Get the mapper class associated with a repository root. Parameters ---------- root : string The location of a persisted RepositoryCfg is (new style repos). Returns ------- A class object or a class instance, depending on the state of the mapper when the repository was created.
Definition at line 333 of file storageInterface.py.
|
static |
Get the mapper class associated with a repository root. Supports the legacy _parent symlink search (which was only ever posix-only. This should not be used by new code and repositories; they should use the Repository parentCfg mechanism. Parameters ---------- root : string The location of a persisted ReositoryCfg is (new style repos), or the location where a _mapper file is (old style repos). Returns ------- A class object or a class instance, depending on the state of the mapper when the repository was created.
Definition at line 164 of file posixStorage.py.
|
static |
For Butler V1 Repositories only, if a _parent symlink exists, get the location pointed to by the symlink. Parameters ---------- root : string A path to the folder on the local filesystem. Returns ------- string or None A path to the parent folder indicated by the _parent symlink, or None if there is no _parent symlink at root.
Definition at line 215 of file posixStorage.py.
|
inherited |
Search in the registered formatters for the objType read formatter. Parameters ---------- objType : class type The type of class to find a formatter for. Returns ------- formatter callable The formatter callable used to read the object from the storageInterface.
Definition at line 86 of file storageInterface.py.
|
inherited |
Get a persisted RepositoryCfg Parameters ---------- uri : URI or path to a RepositoryCfg Description Returns ------- A RepositoryCfg instance or None
Definition at line 294 of file storageInterface.py.
|
static |
Get a persisted RepositoryCfg Parameters ---------- uri : URI or path to a RepositoryCfg Description Returns ------- A RepositoryCfg instance or None
Definition at line 125 of file posixStorage.py.
|
inherited |
Search in the registered formatters for the objType write formatter. Parameters ---------- objType : class type The type of class to find a formatter for. Returns ------- formatter callable The formatter callable used to write the object to the storageInterface.
Definition at line 102 of file storageInterface.py.
def lsst.daf.persistence.posixStorage.PosixStorage.instanceSearch | ( | self, | |
path | |||
) |
Search for the given path in this storage instance. If the path contains an HDU indicator (a number in brackets before the dot, e.g. 'foo.fits[1]', this will be stripped when searching and so will match filenames without the HDU indicator, e.g. 'foo.fits'. The path returned WILL contain the indicator though, e.g. ['foo.fits[1]']. Parameters ---------- path : string A filename (and optionally prefix path) to search for within root. Returns ------- string or None The location that was found, or None if no location was found.
Reimplemented from lsst.daf.persistence.storageInterface.StorageInterface.
Definition at line 391 of file posixStorage.py.
def lsst.daf.persistence.posixStorage.PosixStorage.locationWithRoot | ( | self, | |
location | |||
) |
Get the full path to the location. :param location: :return:
Reimplemented from lsst.daf.persistence.storageInterface.StorageInterface.
Definition at line 319 of file posixStorage.py.
|
static |
Definition at line 150 of file posixStorage.py.
|
inherited |
Serialize a RepositoryCfg to a location. When loc == cfg.root, the RepositoryCfg is to be written at the root location of the repository. In that case, root is not written, it is implicit in the location of the cfg. This allows the cfg to move from machine to machine without modification. Parameters ---------- cfg : RepositoryCfg instance The RepositoryCfg to be serailized. loc : string, optional The URI location (can be relative path) to write the RepositoryCfg. If loc is None, the location will be read from the root parameter of loc. Returns ------- None
Definition at line 309 of file storageInterface.py.
def lsst.daf.persistence.posixStorage.PosixStorage.read | ( | self, | |
butlerLocation | |||
) |
Read from a butlerLocation. Parameters ---------- butlerLocation : ButlerLocation The location & formatting for the object(s) to be read. Returns ------- A list of objects as described by the butler location. One item for each location in butlerLocation.getLocations()
Reimplemented from lsst.daf.persistence.storageInterface.StorageInterface.
Definition at line 262 of file posixStorage.py.
|
inherited |
Register read and/or write formatters for a storageInterface subclass Parameters ---------- cls : StorageInterface subclass The type of StorageInterface the formatter is being registered for. formatable : class object The class object whose instances can be formatted by the formatter. readFormatter : a read formatter callable The formatter function that can be used by the StorageInterface instance to read the object from the storage. writeFormatter : a write formatter callable The formatter function that can be used by the StorageInterface instance to write the object to the storage. Raises ------ RuntimeError For each object type and StorageInterface subclass the read and write formatters should only be registered once. If a second registration occurs for either a RuntimeError is raised.
Definition at line 118 of file storageInterface.py.
|
inherited |
Get a relative path from a location to a location. Parameters ---------- fromPath : string A path at which to start. It can be a relative path or an absolute path. toPath : string A target location. It can be a relative path or an absolute path. Returns ------- string A relative path that describes the path from fromPath to toPath.
Definition at line 351 of file storageInterface.py.
|
static |
Get a relative path from a location to a location. Parameters ---------- fromPath : string A path at which to start. It can be a relative path or an absolute path. toPath : string A target location. It can be a relative path or an absolute path. Returns ------- string A relative path that describes the path from fromPath to toPath.
Definition at line 80 of file posixStorage.py.
|
static |
Look for the given path in the current root. Also supports searching for the path in Butler v1 repositories by following the Butler v1 _parent symlink If the path contains an HDU indicator (a number in brackets, e.g. 'foo.fits[1]', this will be stripped when searching and so will match filenames without the HDU indicator, e.g. 'foo.fits'. The path returned WILL contain the indicator though, e.g. ['foo.fits[1]']. Parameters ---------- root : string The path to the root directory. path : string The path to the file within the root directory. searchParents : bool, optional For Butler v1 repositories only, if true and a _parent symlink exists, then the directory at _parent will be searched if the file is not found in the root repository. Will continue searching the parent of the parent until the file is found or no additional parent exists. Returns ------- string or None The location that was found, or None if no location was found.
Reimplemented from lsst.daf.persistence.storageInterface.StorageInterface.
Definition at line 412 of file posixStorage.py.
|
static |
Ask if a storage at the location described by uri exists Parameters ---------- root : string URI to the the root location of the storage Returns ------- bool True if the storage exists, false if not
Definition at line 496 of file posixStorage.py.
|
static |
Test if a Version 1 Repository exists. Version 1 Repositories only exist in posix storages, do not have a RepositoryCfg file, and contain either a registry.sqlite3 file, a _mapper file, or a _parent link. Parameters ---------- root : string A path to a folder on the local filesystem. Returns ------- bool True if the repository at root exists, else False.
Definition at line 328 of file posixStorage.py.
def lsst.daf.persistence.posixStorage.PosixStorage.write | ( | self, | |
butlerLocation, | |||
obj | |||
) |
Writes an object to a location and persistence format specified by ButlerLocation Parameters ---------- butlerLocation : ButlerLocation The location & formatting for the object to be written. obj : object instance The object to be written.
Reimplemented from lsst.daf.persistence.storageInterface.StorageInterface.
Definition at line 240 of file posixStorage.py.
lsst.daf.persistence.posixStorage.PosixStorage.log |
Definition at line 64 of file posixStorage.py.
lsst.daf.persistence.posixStorage.PosixStorage.root |
Definition at line 65 of file posixStorage.py.