Location

class lsst.daf.butler.Location(datastoreRootUri: Union[lsst.daf.butler.core.location.ButlerURI, str], path: str)

Bases: object

Identifies a location within the Datastore.

Parameters:
datastoreRootUri : ButlerURI or str

Base URI for this datastore, must include an absolute path.

path : str

Relative path within datastore. Assumed to be using the local path separator if a file scheme is being used for the URI, else a POSIX separator.

Attributes Summary

netloc The URI network location.
path Path corresponding to location.
pathInStore Path corresponding to location relative to Datastore root.
relativeToPathRoot Returns the path component of the URI relative to the network location.
uri URI string corresponding to fully-specified location in datastore.

Methods Summary

getExtension() Return the file extension(s) associated with this location.
updateExtension(ext) Update the file extension associated with this Location.

Attributes Documentation

netloc

The URI network location.

path

Path corresponding to location.

This path includes the root of the Datastore, but does not include non-path components of the root URI. If a file URI scheme is being used the path will be returned with the local OS path separator.

pathInStore

Path corresponding to location relative to Datastore root.

Uses the same path separator as supplied to the object constructor.

relativeToPathRoot

Returns the path component of the URI relative to the network location.

Effectively, this is the path property with POSIX separator stripped from the left hand side of the path.

uri

URI string corresponding to fully-specified location in datastore.

Methods Documentation

getExtension() → str

Return the file extension(s) associated with this location.

Returns:
ext : str

The file extension (including the .). Can be empty string if there is no file extension. Will return all file extensions as a single extension such that file.fits.gz will return a value of .fits.gz.

updateExtension(ext: Optional[str]) → None

Update the file extension associated with this Location.

All file extensions are replaced.

Parameters:
ext : str

New extension. If an empty string is given any extension will be removed. If None is given there will be no change.