Skip to content

Commit

Permalink
[update] tutorial and explore data notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
polaya07 committed Feb 27, 2024
1 parent a27e26d commit 641afdc
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 15 deletions.
82 changes: 71 additions & 11 deletions Explore_Data.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "5035495c-6cc4-45fc-aced-f0a1e4a70544",
"metadata": {},
"source": [
"# Notebook for Exploring Cropped Subregions\n",
"\n",
"After successfully running the tutorial notebook, you can use this jupyter notebook to read and explore the cropped subregion of interest. We present you with two functions to load the data and to statically visualize it. **You can expand the analysis of your selected data as required.** \n"
]
},
{
"cell_type": "markdown",
"id": "4da02578-6a33-4ac1-8196-8ecaab2366bf",
"metadata": {},
"source": [
"## Preparing your Environment \n",
"\n",
"The following cell prepares the environment necessary for reading and plotting the data. Upon completion, a message will be displayed to notify you that the cell execution has finished."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -8,29 +28,62 @@
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt"
"import matplotlib.pyplot as plt\n",
"print(\"You have successfully prepared your environment.\")"
]
},
{
"cell_type": "markdown",
"id": "44ed9213-fe42-47d8-94a2-f3f622e2942c",
"metadata": {},
"source": [
"## Enter the name of your Subregion File\n",
"Enter the name of the downloaded file."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "860bbfe3-fe43-4a7a-b937-e801b3fd437e",
"id": "f1fa2a34-486d-46fa-b370-4ddcf2572f02",
"metadata": {},
"outputs": [],
"source": [
"data=np.load('data3.npz')\n",
"data"
"data_file = \"Enter the name of your file\"\n",
"print(\"You have successfully named your data file.\")"
]
},
{
"cell_type": "markdown",
"id": "ca7f46de-7571-47fa-ac52-deed5f5e9b08",
"metadata": {},
"source": [
"## Reading the Data in the Subregion File\n",
"\n",
"The following cell loads the data and extracts the coordinates and terrain parameter value."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5cf68811-44dc-4bb4-8ff7-03275a167ff7",
"id": "860bbfe3-fe43-4a7a-b937-e801b3fd437e",
"metadata": {},
"outputs": [],
"source": [
"data=np.load(data_file)\n",
"data\n",
"actual_data=data['data']\n",
"metadata=data['lon_lat']"
"metadata=data['lon_lat']\n",
"print(\"You have successfully loaded your data and metadata.\")"
]
},
{
"cell_type": "markdown",
"id": "5baa1cf5-d4a8-4af4-9497-c1f5e25e0e58",
"metadata": {},
"source": [
"## Visualizing the Subregion Data\n",
"\n",
"The following cell plots the subregion."
]
},
{
Expand All @@ -48,15 +101,15 @@
"fig, axs = plt.subplots(1, 1, figsize=(10, 8))\n",
"axs.set_xlim(lat_min, lat_max)\n",
"axs.set_ylim(lon_min, lon_max)\n",
"axs.set_title(\"Selected Sub-Region Of Interest\")\n",
"axs.set_title(\"Selected Subregion Of Interest\")\n",
"axs.set_xlabel(\"Longitude (Degrees)\")\n",
"axs.set_ylabel(\"Latitude (Degrees)\")\n",
"data_fig = axs.imshow(\n",
" actual_data,\n",
" cmap=cmap_instance,\n",
" vmin=actual_data.min(),\n",
" vmax=actual_data.max(),\n",
" origin=\"lower\",\n",
" vmin=30,\n",
" vmax=1999,\n",
" extent=(lat_min, lat_max, lon_min, lon_max),\n",
")\n",
"\n",
Expand All @@ -65,9 +118,16 @@
" fraction=0.046 * actual_data.shape[0] / actual_data.shape[1],\n",
" pad=0.04,\n",
")\n",
"cbar_ticks = np.linspace(30, 1999, 8)\n",
"cbar.set_ticks(cbar_ticks)"
"cbar_ticks = np.linspace(actual_data.min(),actual_data.max(), 8)\n",
"cbar.set_ticks(cbar_ticks)\n",
"print(\"You have successfully plotted your data.\")"
]
},
{
"cell_type": "markdown",
"id": "faa74642-ac27-42fd-8be3-4d0fe23fa0e5",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down
8 changes: 4 additions & 4 deletions Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,8 @@
"metadata": {},
"outputs": [],
"source": [
"## Stop this cell before running another visualization dashboard\n",
"%%capture\n",
"## Stop this cell before running another visualization dashboard\n",
"!python -m panel serve openvisuspy/src/openvisuspy/dashboards --log-file \"files/log.log\" --dev --allow-websocket-origin='*' --address=\"{ADDRESS}\" --port \"{PORT}\" --args \"{URL}\" "
]
},
Expand Down Expand Up @@ -1034,12 +1034,12 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e621c2b4-e43a-4f59-b6dc-490a3863c54c",
"id": "0596942a-9307-439d-bf27-e75c77a91ea0",
"metadata": {},
"outputs": [],
"source": [
"## Stop this cell before running another visualization dashboard\n",
"%%capture\n",
"## Stop this cell before running another visualization dashboard\n",
"!python -m panel serve openvisuspy/src/openvisuspy/dashboards --log-file \"files/log.log\" --dev --allow-websocket-origin='*' --address=\"{ADDRESS}\" --port \"{PORT}\" --args \"{URL}\""
]
},
Expand Down Expand Up @@ -1080,8 +1080,8 @@
"metadata": {},
"outputs": [],
"source": [
"## Stop this cell before running another visualization dashboard\n",
"%%capture\n",
"## Stop this cell before running another visualization dashboard\n",
"!python -m panel serve openvisuspy/src/openvisuspy/dashboards --log-file \"files/log.log\" --dev --allow-websocket-origin='*' --address=\"{ADDRESS}\" --port \"{PORT}\" --args \"{URL}\""
]
},
Expand Down

0 comments on commit 641afdc

Please sign in to comment.