From 9d5afb7aee707dd54fb2fa0f4cd6faf4351f698d Mon Sep 17 00:00:00 2001 From: Shawn Crawley Date: Mon, 16 Dec 2024 16:49:42 +0000 Subject: [PATCH] Generalize notebook to work for any user Refs #995 --- .../Align MAPX dtypes with DB.ipynb | 55 +++---------------- 1 file changed, 7 insertions(+), 48 deletions(-) diff --git a/Core/Manual_Workflows/Align MAPX dtypes with DB.ipynb b/Core/Manual_Workflows/Align MAPX dtypes with DB.ipynb index cbb98893..8a713ccc 100644 --- a/Core/Manual_Workflows/Align MAPX dtypes with DB.ipynb +++ b/Core/Manual_Workflows/Align MAPX dtypes with DB.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "22943b62-1ee7-408d-95f7-b628d4ff07cc", "metadata": { "tags": [] @@ -10,7 +10,7 @@ "outputs": [], "source": [ "import os\n", - "with open('../Secrets.env') as f:\n", + "with open('/home/ec2-user/SageMaker/Secrets.env') as f:\n", " for l in f.readlines():\n", " if l.strip():\n", " var, val = l.strip().split(\"=\", 1)\n", @@ -19,41 +19,12 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "fe247ea4-86b6-48bb-be4b-ffca3fdb2f20", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "static_stage_based_catfim.mapx :: \"Stage-Based CatFIM Sites\" :: reference.stage_based_catfim_sites_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_sites_public\n", - "static_stage_based_catfim.mapx :: \"1 ft Invervals Above Action\" :: reference.stage_based_catfim_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_public\n", - "static_stage_based_catfim.mapx :: \"Stage-Based CatFIM: Action Threshold\" :: reference.stage_based_catfim_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_public\n", - "static_stage_based_catfim.mapx :: \"1 ft Invervals Above Minor\" :: reference.stage_based_catfim_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_public\n", - "static_stage_based_catfim.mapx :: \"Stage-Based CatFIM: Minor Threshold\" :: reference.stage_based_catfim_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_public\n", - "static_stage_based_catfim.mapx :: \"1 ft Invervals Above Moderate\" :: reference.stage_based_catfim_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_public\n", - "static_stage_based_catfim.mapx :: \"Stage-Based CatFIM: Moderate Threshold\" :: reference.stage_based_catfim_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_public\n", - "static_stage_based_catfim.mapx :: \"1 ft Invervals Above Major\" :: reference.stage_based_catfim_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_public\n", - "static_stage_based_catfim.mapx :: \"Stage-Based CatFIM: Major Threshold\" :: reference.stage_based_catfim_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_public\n", - "static_stage_based_catfim.mapx :: \"Stage-Based CatFIM: Record Threshold\" :: reference.stage_based_catfim_public does not exist.\n", - "hydrovis.reference.stage_based_catfim_public\n", - "static_hand_catchments_0_branches_prvi_noaa.mapx :: \"Branch 0 FIM Catchment Boundaries\" :: fim_catchments.catchments_0_braches_prvi does not exist.\n", - "hydrovis.fim_catchments.catchments_0_braches_prvi\n" - ] - } - ], + "outputs": [], "source": [ "from requests import Session\n", "from pathlib import Path\n", @@ -62,7 +33,7 @@ "import os\n", "\n", "THIS_DIR = Path.cwd()\n", - "CORE_DIR = THIS_DIR / \"hydrovis\" / \"Core\"\n", + "CORE_DIR = THIS_DIR.parent\n", "SERVICES_DIR = CORE_DIR / \"LAMBDA\" / \"viz_functions\" / \"viz_publish_service\" / \"services\"\n", "\n", "ESRI_TYPE_TO_DB_TYPES = {\n", @@ -86,6 +57,8 @@ "\n", "server_services = []\n", "for root, dirs, files in os.walk(SERVICES_DIR):\n", + " print(\"COOL\")\n", + " continue\n", " for fname in files:\n", " if fname.endswith('.mapx'):\n", " fpath = Path(root) / fname\n", @@ -170,20 +143,6 @@ " fpath.write_text(json.dumps(mapx, separators=(',', ' : '), indent=2))\n", "\n" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "17cea5a6-4275-47a4-ad56-48a98ba41a0a", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "from shared_functions import sql_to_dataframe\n", - "\n", - "sql_to_dataframe(\"SELECT DISTINCT nwm_features_flooded_percent FROM services.mrf_gfs_10day_rapid_onset_flooding_hucs_alaska\", db_type=\"egis\")" - ] } ], "metadata": {