From d21543ec620c7034ebb778783cfa0646c6bd2e5b Mon Sep 17 00:00:00 2001 From: Carsten Hinz <chinz@linux.fritz.box> Date: Fri, 26 Apr 2024 08:22:07 +0200 Subject: [PATCH] notebook should now run without issues - added creation of subdiretories - added some output --- tests/get_sample_data.ipynb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/get_sample_data.ipynb b/tests/get_sample_data.ipynb index f540ba2..d46fe5e 100644 --- a/tests/get_sample_data.ipynb +++ b/tests/get_sample_data.ipynb @@ -8,6 +8,7 @@ "source": [ "from datetime import datetime\n", "\n", + "#samping monthly or daily\n", "sampling = \"monthly\"\n", "start = datetime(2010,1,1)\n", "end = datetime(2011,1,1)\n", @@ -86,8 +87,13 @@ "metadata": {}, "outputs": [], "source": [ - "with open(f\"data/{sampling}_{start.date()}_{end.date()}.zip\", \"w+b\") as sample_file:\n", - " sample_file.write(response.content)" + "from pathlib import Path\n", + "outDir = Path(\"data\")\n", + "outDir.mkdir(parents=False, exist_ok=True)\n", + "fn = outDir / f\"{sampling}_{start.date()}_{end.date()}.zip\"\n", + "with open(fn, \"w+b\") as sample_file:\n", + " sample_file.write(response.content)\n", + "print(f\"Wrote outout to file [path/to/toargridding]/tests/{fn}\")" ] } ], @@ -107,7 +113,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.6" + "version": "3.11.5" } }, "nbformat": 4, -- GitLab