Skip to content
Open
Show file tree
Hide file tree
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
51 changes: 42 additions & 9 deletions awsm/tests/basins/Gold-NetCDF-Compare.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
"id": "5070313f-db14-438e-8c18-dd2ce0b95621",
"metadata": {},
"source": [
"### Test basin"
"### Test basin\n",
"Pick one of the available below. This will ensure proper comparison path setup:\n",
"* Lakes: Lakes with HRRR\n",
"* Lakes_lidar: Lakes with HRRR and lidar update\n",
"* RME: RME with station data"
]
},
{
Expand All @@ -55,7 +59,21 @@
"metadata": {},
"outputs": [],
"source": [
"basin_name = \"Lakes\""
"basin_name = \"Lakes_lidar\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "277416bc-035f-42f6-941e-813843bf5b42",
"metadata": {},
"outputs": [],
"source": [
"basins = {\n",
" \"Lakes\": (\"Lakes\", \"gold_hrrr\"),\n",
" \"Lakes_lidar\": (\"Lakes\", \"gold_hrrr_update\"),\n",
" \"RME\": (\"RME\", \"gold\"),\n",
"}"
]
},
{
Expand Down Expand Up @@ -110,19 +128,30 @@
"metadata": {},
"outputs": [],
"source": [
"filename = \"model_lidar_change.nc\"\n",
"variables = lidar_change"
"filename = \"em.nc\"\n",
"variables = em_variables"
]
},
{
"cell_type": "markdown",
"id": "b5dcab09-9890-409f-8b92-443422919d1a",
"metadata": {},
"source": [
"## NOTE\n",
"When changing between Lakes and Lakes with lidar update, ensure that the gold path is updated below\n",
"* Lakes: `gold_hrrr`\n",
"* Lakes with lidar: `gold_hrrr_update`"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "eac36c8e-4863-4733-9c3c-a7854eb70f02",
"id": "86a76ade-3f51-415f-829a-a7304f2af080",
"metadata": {},
"outputs": [],
"source": [
"old_nc = xr.open_dataset(f\"{basin_name}/gold_hrrr_update/{filename}\").drop_vars(\"projection\")\n",
"new_nc_file = list(Path('.').glob(f\"{basin_name}/output/*/*/*/*/{filename}\"))[0]\n",
"old_nc = xr.open_dataset(f\"{basins[basin_name][0]}/{basins[basin_name][1]}/{filename}\").drop_vars(\"projection\")\n",
"new_nc_file = list(Path('.').glob(f\"{basins[basin_name][0]}/output/*/*/*/*/{filename}\"))[0]\n",
"new_nc = xr.open_dataset(new_nc_file).drop_vars(\"projection\")"
]
},
Expand Down Expand Up @@ -167,6 +196,8 @@
" \n",
" plots.set_titles(\"{value}\")\n",
" plots.fig.suptitle(f\"Variable: {variable}\")\n",
"\n",
" plots.fig.savefig(f\"{variable}_xy.png\", dpi=120)\n",
" \n",
" return plots"
]
Expand Down Expand Up @@ -221,7 +252,9 @@
" \n",
" for i in range(num_times):\n",
" data[variable].isel(time=i).plot.hist(ax=axes[i], bins=30, color='skyblue')\n",
" axes[i].set_xlabel(\"\")"
" axes[i].set_xlabel(\"\")\n",
"\n",
" fig.savefig(f\"{variable}_hist.png\", dpi=120)"
]
},
{
Expand All @@ -238,7 +271,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e5b4b7d9-6c11-4ed3-b015-0bd6fde9b5d1",
"id": "cbfaa1be-e013-4301-a711-b8cb43e93fdf",
"metadata": {},
"outputs": [],
"source": []
Expand Down
Binary file modified awsm/tests/basins/Lakes/gold_hrrr/em.nc
Binary file not shown.
Binary file modified awsm/tests/basins/Lakes/gold_hrrr_update/em.nc
Binary file not shown.
Loading