How to delete a user defined butler collection?

I was looking at the tutorial notebook DP02_14_Injecting_Synthetic_Sources.

In section 3.3 it is explaining how to ingest a synthetic source catalog into a butler collection.
The tutorial is carefully explaining that it is not possible to overwrite an already existing collection.
Is it possible for a user to see the collections that he defined, and eventually delete some of them?


Hi @Vincenzo , thank you for this question.

Seeing user-defined collections: Yes, it is possible to see all the collections you defined. If you named them using the convention defined in tutorial NB 14 (and/or NB 09) of including your username in the collection name, then you can list them all using the following code (which comes from Section 1.3 in NB 09b):

import getpass
from lsst.daf.butler import Butler
my_username = getpass.getuser()
butler_repo = 'dp02'
tempButler = Butler(butler_repo)
for c in sorted(tempButler.registry.queryCollections('*'+my_username+'*')):

Deleting collections: Yes it is possible to delete collections, but we are not yet teaching users how to delete butler collections due to the lack of safeguards in place in the early, DP0-era of the Rubin Science Platform – safeguards that would prevent a user from accidentally deleting other users’ collections. Until those safeguards are in place, it is my understanding that it is much preferred that users just take up extra space by creating new collections. Thanks for your patience, I know it’s a bit annoying to do things this way.


Within the DP0.2 documentation website, there’s also some discussion (with a bit more detail) about the risks of attempting to remove collections on the DP0-era RSP:


1 Like