Skip to content

Commit

Permalink
Update notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
robbibt committed Oct 30, 2024
1 parent f81d849 commit 7cfeac2
Showing 1 changed file with 160 additions and 13 deletions.
173 changes: 160 additions & 13 deletions docs/notebooks/Model_tides.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 3/3 [00:00<00:00, 22.93it/s]\n"
"100%|██████████| 3/3 [00:00<00:00, 22.35it/s]\n"
]
},
{
Expand Down Expand Up @@ -494,7 +494,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 2/2 [00:00<00:00, 17.37it/s]\n"
"100%|██████████| 2/2 [00:00<00:00, 16.90it/s]\n"
]
},
{
Expand Down Expand Up @@ -698,7 +698,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 2/2 [00:00<00:00, 17.63it/s]\n"
"100%|██████████| 2/2 [00:00<00:00, 16.66it/s]\n"
]
},
{
Expand Down Expand Up @@ -798,7 +798,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 6/6 [00:00<00:00, 32.15it/s]\n"
"100%|██████████| 6/6 [00:00<00:00, 29.64it/s]\n"
]
},
{
Expand Down Expand Up @@ -984,7 +984,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 6/6 [00:00<00:00, 25.30it/s]\n"
"100%|██████████| 6/6 [00:00<00:00, 26.52it/s]\n"
]
},
{
Expand Down Expand Up @@ -1229,13 +1229,160 @@
"* `tide_model`: a column listing the tide model used\n",
"* `tide_phase`: the modelled tidal phase (\"high-flow\", \"high-ebb\", \"low-ebb\", \"low-flow\").\n",
"\n",
"To change the time offset used to calculate tide phase from the 15 minute default, pass a custom value to `time_offset`:"
"`model_phases` accepts all parameters accepted by `model_tides`; e.g. `model` and `output_format`:\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Modelling tides using EOT20, GOT5.5 in parallel\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 2/2 [00:00<00:00, 15.78it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Modelling tides using EOT20, GOT5.5 in parallel\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 2/2 [00:00<00:00, 16.09it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Converting to a wide format dataframe\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th></th>\n",
" <th>tide_model</th>\n",
" <th>EOT20</th>\n",
" <th>GOT5.5</th>\n",
" </tr>\n",
" <tr>\n",
" <th>time</th>\n",
" <th>x</th>\n",
" <th>y</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2018-01-01 00:00:00</th>\n",
" <th>122.2186</th>\n",
" <th>-18.0008</th>\n",
" <td>high-flow</td>\n",
" <td>high-flow</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-01-01 05:00:00</th>\n",
" <th>122.2186</th>\n",
" <th>-18.0008</th>\n",
" <td>low-ebb</td>\n",
" <td>low-ebb</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-01-01 10:00:00</th>\n",
" <th>122.2186</th>\n",
" <th>-18.0008</th>\n",
" <td>low-flow</td>\n",
" <td>low-flow</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-01-01 15:00:00</th>\n",
" <th>122.2186</th>\n",
" <th>-18.0008</th>\n",
" <td>high-ebb</td>\n",
" <td>high-ebb</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2018-01-01 20:00:00</th>\n",
" <th>122.2186</th>\n",
" <th>-18.0008</th>\n",
" <td>low-ebb</td>\n",
" <td>low-ebb</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"tide_model EOT20 GOT5.5\n",
"time x y \n",
"2018-01-01 00:00:00 122.2186 -18.0008 high-flow high-flow\n",
"2018-01-01 05:00:00 122.2186 -18.0008 low-ebb low-ebb\n",
"2018-01-01 10:00:00 122.2186 -18.0008 low-flow low-flow\n",
"2018-01-01 15:00:00 122.2186 -18.0008 high-ebb high-ebb\n",
"2018-01-01 20:00:00 122.2186 -18.0008 low-ebb low-ebb"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model_phases(\n",
" x=122.2186,\n",
" y=-18.0008,\n",
" time=pd.date_range(start=\"2018-01-01\", end=\"2018-01-02\", freq=\"5h\"),\n",
" model=[\"EOT20\", \"GOT5.5\"],\n",
" output_format=\"wide\",\n",
" directory=directory,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To change the default 15 minute time offset used to calculate tide phases, pass a custom value to `time_offset`:"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -1329,7 +1476,7 @@
"2018-01-01 20:00:00 122.2186 -18.0008 EOT20 low-ebb"
]
},
"execution_count": 13,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1348,13 +1495,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Optionally, we can choose to return tide heights too by providing `return_tides=True`.\n",
"This will include a new `tide_height` column in our dataframe:"
"Optionally, we can choose to return also tide heights by providing `return_tides=True`.\n",
"This will include an additional `tide_height` column in our dataframe:"
]
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1456,7 +1603,7 @@
"2018-01-01 02:00:00 122.2186 -18.0008 EOT20 2.476600 high-flow"
]
},
"execution_count": 14,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1478,12 +1625,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"If we plot our `tide_height` and `tide_phase` data, we can see it follows a logical progression from \"high-flow\" > \"high-ebb\" > \"low-ebb\" > \"low-flow\":"
"If we plot our `tide_height` and `tide_phase` data, we can see it follows a logical progression from `high-flow -> high-ebb -> low-ebb -> low-flow -> ...`, repeating with every tide cycle:"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand Down

0 comments on commit 7cfeac2

Please sign in to comment.