Skip to content

Commit

Permalink
include link to DSAS user guide
Browse files Browse the repository at this point in the history
  • Loading branch information
neon-ninja committed Sep 2, 2024
1 parent e396d10 commit 4554f24
Showing 1 changed file with 26 additions and 31 deletions.
57 changes: 26 additions & 31 deletions DSAS.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 209,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -820,7 +820,7 @@
"[228613 rows x 20 columns]"
]
},
"execution_count": 55,
"execution_count": 209,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -832,16 +832,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"rates.set_index(\"UniqueID\", inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": 202,
"execution_count": 218,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -880,6 +871,7 @@
" <th>WSE</th>\n",
" <th>TCD</th>\n",
" <th>Region</th>\n",
" <th>UniqueID</th>\n",
" <th>Start_date</th>\n",
" <th>End_date</th>\n",
" <th>Duration</th>\n",
Expand All @@ -888,7 +880,7 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1.005226e+11</th>\n",
" <th>124687</th>\n",
" <td>5.0</td>\n",
" <td>0.240000</td>\n",
" <td>0.430000</td>\n",
Expand All @@ -904,13 +896,14 @@
" <td>2.100000</td>\n",
" <td>0.0</td>\n",
" <td>Taranaki</td>\n",
" <td>1.005226e+11</td>\n",
" <td>1970-02-10</td>\n",
" <td>2022-01-14</td>\n",
" <td>51</td>\n",
" <td>POINT (1680425.889 5669776.879)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1.005226e+11</th>\n",
" <th>0</th>\n",
" <td>5.0</td>\n",
" <td>0.237582</td>\n",
" <td>0.427684</td>\n",
Expand All @@ -926,6 +919,7 @@
" <td>2.098247</td>\n",
" <td>NaN</td>\n",
" <td>Taranaki</td>\n",
" <td>1.005226e+11</td>\n",
" <td>1970-02-10</td>\n",
" <td>2022-01-14</td>\n",
" <td>52</td>\n",
Expand All @@ -936,30 +930,31 @@
"</div>"
],
"text/plain": [
" ShrCount LRR LR2 LCI LSE EPR \\\n",
"1.005226e+11 5.0 0.240000 0.430000 0.370000 6.550000 0.300000 \n",
"1.005226e+11 5.0 0.237582 0.427684 0.373421 6.553639 0.299401 \n",
" ShrCount LRR LR2 LCI LSE EPR EPRunc \\\n",
"124687 5.0 0.240000 0.430000 0.370000 6.550000 0.300000 0.200000 \n",
"0 5.0 0.237582 0.427684 0.373421 6.553639 0.299401 0.201854 \n",
"\n",
" EPRunc NSM SCE WLR WR2 WCI \\\n",
"1.005226e+11 0.200000 15.550000 16.840000 0.280000 0.260000 0.640000 \n",
"1.005226e+11 0.201854 15.546738 16.839817 0.283414 0.263359 0.644026 \n",
" NSM SCE WLR WR2 WCI WSE TCD \\\n",
"124687 15.550000 16.840000 0.280000 0.260000 0.640000 2.100000 0.0 \n",
"0 15.546738 16.839817 0.283414 0.263359 0.644026 2.098247 NaN \n",
"\n",
" WSE TCD Region Start_date End_date Duration \\\n",
"1.005226e+11 2.100000 0.0 Taranaki 1970-02-10 2022-01-14 51 \n",
"1.005226e+11 2.098247 NaN Taranaki 1970-02-10 2022-01-14 52 \n",
" Region UniqueID Start_date End_date Duration \\\n",
"124687 Taranaki 1.005226e+11 1970-02-10 2022-01-14 51 \n",
"0 Taranaki 1.005226e+11 1970-02-10 2022-01-14 52 \n",
"\n",
" geometry \n",
"1.005226e+11 POINT (1680425.889 5669776.879) \n",
"1.005226e+11 None "
" geometry \n",
"124687 POINT (1680425.889 5669776.879) \n",
"0 None "
]
},
"execution_count": 202,
"execution_count": 218,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def process_row(row):\n",
" # This function reproduces the statistics described in https://pubs.usgs.gov/of/2021/1091/ofr20211091.pdf\n",
" shorelines[\"intersect_point\"] = shorelines.intersection(row.geometry)\n",
" df = shorelines[~shorelines.intersect_point.is_empty].sort_values(\"Date\")\n",
" df.Date = pd.to_datetime(df.Date)\n",
Expand All @@ -974,7 +969,8 @@
" WCI = (high - low) / 2\n",
" duration = (df.Date.max() - df.Date.min()).days / 365.25\n",
" NSM = df.intersect_point.iloc[0].distance(df.intersect_point.iloc[-1])\n",
" return pd.DataFrame({\n",
" return pd.Series({\n",
" \"UniqueID\": row.Unique_ID,\n",
" \"Region\": df.Region.value_counts().idxmax(),\n",
" \"Start_date\": str(df.Date.min().date()),\n",
" \"End_date\": str(df.Date.max().date()),\n",
Expand All @@ -992,9 +988,8 @@
" \"WCI\": WCI,\n",
" \"WSE\": np.sqrt(WLR.mse_resid),\n",
" \"WR2\": WLR.rsquared,\n",
" }, index=[row.Unique_ID])\n",
"pd.concat([rates.loc[100522647132.0:100522647132.0], process_row(transects.iloc[0])],axis=0)\n",
"#rates.loc[100522647132.0].drop(columns=[\"Region\", \"Start_date\", \"End_date\"]) - process_row(transects.iloc[0]).drop(columns=[\"Region\", \"Start_date\", \"End_date\"])"
" })\n",
"pd.concat([rates[rates.UniqueID == 100522647132.0], pd.DataFrame([process_row(transects.iloc[0])])],axis=0)"
]
},
{
Expand Down

0 comments on commit 4554f24

Please sign in to comment.