Skip to content

Commit

Permalink
Only pass flags and hdu when provided by user.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Jul 28, 2017
1 parent c7de476 commit ce7e05b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions python/lsst/daf/persistence/posixStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,11 @@ def write(self, butlerLocation, obj):
return

if storageName == "FitsCatalogStorage":
flags = additionalData.getInt("flags", 0)
obj.writeFits(logLoc.locString(), flags=flags)
if additionalData.exists("flags"):
kwds = dict(flags=additionalData.getInt("flags"))
else:
kwds = {}
obj.writeFits(logLoc.locString(), **kwds)
return

# Create a list of Storages for the item.
Expand Down Expand Up @@ -368,10 +371,12 @@ def read(self, butlerLocation):
elif storageName == "FitsCatalogStorage":
if not os.path.exists(logLoc.locString()):
raise RuntimeError("No such FITS catalog file: " + logLoc.locString())
INT_MIN = -(1 << 31)
hdu = additionalData.getInt("hdu", INT_MIN)
flags = additionalData.getInt("flags", 0)
finalItem = pythonType.readFits(logLoc.locString(), hdu, flags)
kwds = {}
if additionalData.exists("hdu"):
kwds["hdu"] = additionalData.getInt("hdu")
if additionalData.exists("flags"):
kwds["flags"] = additionalData.getInt("flags")
finalItem = pythonType.readFits(logLoc.locString(), **kwds)
elif storageName == "ConfigStorage":
if not os.path.exists(logLoc.locString()):
raise RuntimeError("No such config file: " + logLoc.locString())
Expand Down

0 comments on commit ce7e05b

Please sign in to comment.