Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tickets/dm 8254 #12

Merged
merged 1 commit into from
Nov 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 13 additions & 3 deletions python/lsst/obs/base/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,19 @@ def map(self, mapper, dataId, write=False):
if not os.path.isabs(path):
path = os.path.join(self.root, path)
if not write:
newPath = mapper._parentSearch(path)
if newPath:
path = newPath
# This allows mapped files to be compressed, ending in .gz or .fz, without any indication from the
# policy that the file should be compressed, easily allowing repositories to contain a combination
# of comporessed and not-compressed files.
# If needed we can add a policy flag to allow compressed files or not, and perhaps a list of
# allowed extensions that may exist at the end of the template.
for ext in (None, '.gz', '.fz'):
if ext and path.endswith(ext):
continue # if the path already ends with the extension
extPath = path + ext if ext else path
newPath = mapper._parentSearch(extPath)
if newPath:
path = newPath
break
assert path, "Fully-qualified filename is empty."

addFunc = "add_" + self.datasetType # Name of method for additionalData
Expand Down
12 changes: 12 additions & 0 deletions tests/MinMapper2.paf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ images: {
persistable: "ImageF"
tables: raw
}
someGz: {
template: "gz/bar-%(ccd)02d.fits" # the file will end in ...fits.gz but butler will still find it.
python: "lsst.afw.image.ExposureF"
persistable: "ExposureF"
tables: raw
}
someFz: {
template: "fz/bar-%(ccd)02d.fits" # the file will end in ...fits.fz but butler will still find it.
python: "lsst.afw.image.ExposureF"
persistable: "ExposureF"
tables: raw
}
}
calibrations: {
flat: {
Expand Down