diff --git a/DP1/100_How_to_Use_RSP_Tools/105_Image_reprocessing/105_6_Create_custom_coadd_images.ipynb b/DP1/100_How_to_Use_RSP_Tools/105_Image_reprocessing/105_6_Create_custom_coadd_images.ipynb index 7a884ef..64c12b3 100644 --- a/DP1/100_How_to_Use_RSP_Tools/105_Image_reprocessing/105_6_Create_custom_coadd_images.ipynb +++ b/DP1/100_How_to_Use_RSP_Tools/105_Image_reprocessing/105_6_Create_custom_coadd_images.ipynb @@ -22,7 +22,7 @@ "Data Release: Data Preview 1
\n", "Container Size: large
\n", "LSST Science Pipelines version: r29.2.0
\n", - "Last verified to run: 2025-09-02
\n", + "Last verified to run: 2026-04-07
\n", "Repository: github.com/lsst/tutorial-notebooks
" ] }, @@ -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", + " 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." ] }, { @@ -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)" ] }, @@ -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()" ] @@ -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" ] } ],