Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"Data Release: <a href=\"https://dp1.lsst.io/\">Data Preview 1</a> <br>\n",
"Container Size: large <br>\n",
"LSST Science Pipelines version: r29.2.0 <br>\n",
"Last verified to run: 2025-09-02 <br>\n",
"Last verified to run: 2026-04-07 <br>\n",
"Repository: <a href=\"https://github.com/lsst/tutorial-notebooks\">github.com/lsst/tutorial-notebooks</a> <br>"
]
},
Expand Down Expand Up @@ -547,7 +547,40 @@
"id": "85394b0f-7222-4624-89af-4c1f9c70d7d8",
"metadata": {},
"source": [
"Users cannot write to the main DP1 Butler repository. Instead, make a writable repository where custom coadd outputs will be written. The call to `use_local_butler` creates a new directory that will contain the local Butler repository, within the `$SCRATCH_DIR` temporary space that gets deleted weekly. Use this temporary space because the custom coadd processing produces of order a gigabyte of intermediate files."
"Users cannot write to the main DP1 Butler repository. Instead, make a writable repository where custom coadd outputs will be written. \n",
"\n",
"The call to `use_local_butler` sets a directory that will contain the local Butler repository, within the `$SCRATCH_DIR` temporary space (on the Rubin Science Platform, RSP) that gets deleted every Sunday around noon Pacific Time. Use this temporary space because the custom coadd processing produces of order a gigabyte of intermediate files. **Do not** run this step (and following steps) right before or during the Sunday cleaning time. \n",
"\n",
"Note `use_local_butler` does not create a top-level directory, but rather one in the scratch space; it does not create `$SCRATCH_DIR`. Thus, check whether that user scratch exists first before using it and create it if it does not.\n",
"\n",
"Remove and recreate `scratch_path` if somehow it is not a directory but does exist. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "108cb108-1ee3-4164-b6e9-b6a01a9fe639",
"metadata": {},
"outputs": [],
"source": [
"scratch_dir = os.getenv(\"SCRATCH_DIR\")\n",
"if scratch_dir is not None:\n",
" scratch_path = Path(scratch_dir)\n",
"\n",
"if not scratch_path.exists():\n",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If SCRATCH_DIR wasn't set then scratch_path will not be defined.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that will throw an error. But I mentioned in the description text that the user should not run this step (and following steps) during / right before the cleaning time. And the undefined scratch_path also prevents the user from running further steps (especially writing large files to local space). So I think that's fine.
Please let me know if you have any other comments.

" scratch_path.mkdir(parents=True)\n",
"\n",
"elif not scratch_path.is_dir():\n",
" scratch_path.unlink()\n",
" scratch_path.mkdir()"
]
},
{
"cell_type": "markdown",
"id": "a055e8f6-865e-4658-a814-aa928ca44c8d",
"metadata": {},
"source": [
"Set the directory that will contain the local Butler repository."
]
},
{
Expand All @@ -557,7 +590,7 @@
"metadata": {},
"outputs": [],
"source": [
"local_repo_path = Path(os.getenv(\"SCRATCH_DIR\"), \"my_local_repo\")\n",
"local_repo_path = Path(scratch_path, \"my_local_repo\")\n",
"out_butler = executor.use_local_butler(local_repo_path)"
]
},
Expand Down Expand Up @@ -625,7 +658,7 @@
"fig = plt.figure(figsize=(10, 8))\n",
"afw_display = afwDisplay.Display(frame=fig)\n",
"afw_display.scale('asinh', 'zscale')\n",
"afw_display.mtv(deepCoadd.image)\n",
"afw_display.image(deepCoadd.image)\n",
"plt.gca().axis('on')\n",
"plt.show()"
]
Expand Down Expand Up @@ -736,8 +769,8 @@
"metadata": {},
"outputs": [],
"source": [
"%reset -f\n",
"! rm -r $SCRATCH_DIR/my_local_repo"
"# %reset -f\n",
"# ! rm -r $SCRATCH_DIR/my_local_repo"
]
}
],
Expand Down
Loading