Skip to content

Commit

Permalink
Formatting feedback messages in 0a, 0b.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaj committed Jan 10, 2025
1 parent 9325e4f commit a99a02c
Showing 1 changed file with 54 additions and 31 deletions.
85 changes: 54 additions & 31 deletions 0b_Create_poi_files.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,7 @@
{
"cell_type": "markdown",
"id": "5dc94a91-16fa-4a51-9f22-b1ede42cd8f0",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"metadata": {},
"source": [
"## 3. Merge segment parameter values from the parameter file with segment GeoDataFrame"
]
Expand Down Expand Up @@ -359,7 +357,11 @@
"cell_type": "code",
"execution_count": null,
"id": "09c9554e-4a10-42c1-a1f1-c6ba00af6f5c",
"metadata": {},
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"# NWIS data pull functions from pyPRMS\n",
Expand Down Expand Up @@ -561,7 +563,11 @@
"cell_type": "code",
"execution_count": null,
"id": "49534463-5cb4-4d1d-9c9a-8b76c4e09e53",
"metadata": {},
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"# Reads/Creates NWIS stations file if not already created\n",
Expand Down Expand Up @@ -682,12 +688,10 @@
{
"cell_type": "markdown",
"id": "192ae690-f22d-46c9-af17-237604436615",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"metadata": {},
"source": [
"## Create default_gages.csv for your model extraction.\n",
"##### This will be composed of the gages that are in the model, but also include NWIS gages that may be added later to the model. Time-series data for streamflow observations will be collected using this gage list."
"##### This will be composed of the gages listed in the NHMx parameter file, and NWIS gages that may be added. Time-series data for streamflow observations will be collected using this gage list."
]
},
{
Expand All @@ -712,15 +716,20 @@
" columns=[\"poi_id\", \"nhm_seg\", \"poi_gage_segment\", \"poi_type\"], inplace=True\n",
" )\n",
" non_NWIS_gages_from_poi_df.rename(columns={\"poi_gage_id\": \"poi_id\"}, inplace=True)\n",
" # non_NWIS_gages_from_poi_df"
" # non_NWIS_gages_from_poi_df\n",
"\n",
" non_NWIS_gages_from_poi_list = non_NWIS_gages_from_poi_df.poi_id.to_list()\n",
" non_NWIS_gages_from_poi_df_txt = f\"WARNING: {len(non_NWIS_gages_from_poi_list)} of the {len(poi_df)} gages {non_NWIS_gages_from_poi_df.poi_id.to_list()} in the parameter file are not in NWIS.\"\n",
"else:\n",
" non_NWIS_gages_from_poi_df_txt = (\n",
" f\"All {len(poi_df)} gages in the parameter file are present in NWIS.\"\n",
" )"
]
},
{
"cell_type": "markdown",
"id": "593c4eba-8bd3-40f6-8b3a-2043354fef4f",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"metadata": {},
"source": [
"#### Make a dataframe for all non-NWIS gages (if present) in the parameter file and all NWIS gages in the model domain\n",
"##### Note: the NWIS gages in the poi_df (gages in the parameter file) should be in NWIS_sites_aoi df."
Expand Down Expand Up @@ -755,9 +764,7 @@
{
"cell_type": "markdown",
"id": "7d484280-803f-46fb-b4b1-680c320a0313",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"metadata": {},
"source": [
"#### Save the default station file (gage file) as a .csv file"
]
Expand Down Expand Up @@ -800,14 +807,6 @@
"## Update gages_df if gages.csv was created"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "27faffa3-91ea-4db7-a2bc-fb43fd9b6991",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -838,14 +837,14 @@
" # Make poi_id the index\n",
" gages_df.set_index(\"poi_id\", inplace=True)\n",
"\n",
" con.print(f\"The appended gage file will be used and has {len(gages_df)} gages.\")\n",
" gage_df_txt = f\"The appended gage file will be used and has {len(gages_df)} gages.\"\n",
"else:\n",
" gages_df = pd.read_csv(default_gages_file, dtype=cols)\n",
"\n",
" # Make poi_id the index\n",
" gages_df.set_index(\"poi_id\", inplace=True)\n",
"\n",
" con.print(f\"The default gage file will be used and has {len(gages_df)} gages.\")"
" gage_df_txt = f\"The default gage file that includes all gages in NWIS will be used and has {len(gages_df)} gages.\""
]
},
{
Expand Down Expand Up @@ -911,9 +910,14 @@
"missing_meta_df = poi_df[\n",
" poi_df[[\"latitude\", \"longitude\", \"poi_name\"]].isna().any(axis=1)\n",
"] # poi_df[poi_df.isna().any(axis=1)]\n",
"con.print(\n",
" f\"WARNING: Gage {missing_meta_df.poi_gage_id.values} missing metadata and will be dropped from the poi_gdf.\"\n",
")\n",
"missing_meta_list = missing_meta_df.poi_gage_id.values\n",
"\n",
"if missing_meta_list:\n",
" missing_meta_txt = f\"WARNING: Gage {missing_meta_list} missing metadata and will be dropped from the poi_gdf and will not be plotted on maps in the notebook.\"\n",
"else:\n",
" missing_meta_txt = f\"All gages in the default gage file have metadata and will be plotted on maps in the notebook.\"\n",
"\n",
"\n",
"# poi_df.notna(inplace=True, ignore_index=False)\n",
"# poi_df.reset_index(drop=True, inplace=True)\n",
"\n",
Expand Down Expand Up @@ -960,7 +964,18 @@
"con.print(\n",
" f\"An additional {len(additional_gages)} streamflow gages are in the model domain and not in the parameter file; {len(nwis_gages_in_additional_gages_list)} are in NWIS.\"\n",
")\n",
"# nwis_gages_aoi_list = nwis_gages_aoi.poi_id.to_list()"
"# nwis_gages_aoi_list = nwis_gages_aoi.poi_id.to_list()\n",
"\n",
"\n",
"con.print(\n",
" \"NHM-Assist gage file details:\",\n",
" \"\\n\",\n",
" non_NWIS_gages_from_poi_df_txt,\n",
" \"\\n\",\n",
" gage_df_txt,\n",
" \"\\n\",\n",
" missing_meta_txt,\n",
")"
]
},
{
Expand All @@ -970,7 +985,7 @@
"metadata": {},
"outputs": [],
"source": [
"hru_gdb"
"# hru_gdb"
]
},
{
Expand All @@ -980,6 +995,14 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "c842e1f6-f277-45a1-bd33-2ebf0e8a7d6a",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit a99a02c

Please sign in to comment.