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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.vscode/
uv.lock
visualization-env
.venv
.venv
02_activities/assignments/.Rhistory
97 changes: 97 additions & 0 deletions 02_activities/assignments/Assignment3.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 786
},
"id": "721XnJI0gFzm",
"outputId": "66b90deb-649d-41c2-e740-0591ef1e4aad"
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.dates as mdates\n",
"\n",
"# -----------------------------\n",
"# Load and prepare data\n",
"# -----------------------------\n",
"df = pd.read_csv(\"W0000031-1.csv\")\n",
"\n",
"# Parse datetime\n",
"df[\"READING_DTTM\"] = pd.to_datetime(df[\"READING_DTTM\"])\n",
"df = df.set_index(\"READING_DTTM\").sort_index()\n",
"\n",
"# Replace with your actual column name if different\n",
"value_col = \"Water_Level_Elevation_meter_above_sea_level\"\n",
"\n",
"# -----------------------------\n",
"# Resample to different timescales\n",
"# -----------------------------\n",
"df_6h = df[value_col].resample(\"6H\").mean()\n",
"df_12h = df[value_col].resample(\"12H\").mean()\n",
"df_daily = df[value_col].resample(\"D\").mean()\n",
"\n",
"# -----------------------------\n",
"# Plot\n",
"# -----------------------------\n",
"fig, axes = plt.subplots(\n",
" nrows=3, ncols=1, figsize=(14, 10), sharex=True\n",
")\n",
"\n",
"colors = {\n",
" \"6h\": \"#000000\",\n",
" \"12h\": \"#000000\",\n",
" \"daily\": \"#000000\"\n",
"}\n",
"\n",
"axes[0].plot(df_6h.index, df_6h, color=colors[\"6h\"], linewidth=1.5)\n",
"axes[0].set_title(\"Well 31 Water Level – 6-Hour Average\", fontsize=12, weight=\"bold\")\n",
"axes[0].set_ylabel(\"Water Level (m above sea level)\")\n",
"\n",
"axes[1].plot(df_12h.index, df_12h, color=colors[\"12h\"], linewidth=1.5)\n",
"axes[1].set_title(\"Well 31 Water Level – 12-Hour Average\", fontsize=12, weight=\"bold\")\n",
"axes[1].set_ylabel(\"Water Level (m above sea level)\")\n",
"\n",
"axes[2].plot(df_daily.index, df_daily, color=colors[\"daily\"], linewidth=1.8)\n",
"axes[2].set_title(\"Well 31 Water Level – Daily Average\", fontsize=12, weight=\"bold\")\n",
"axes[2].set_ylabel(\"Water Level (m above sea level)\")\n",
"axes[2].set_xlabel(\"Date\")\n",
"\n",
"# -----------------------------\n",
"# Axis formatting\n",
"# -----------------------------\n",
"for ax in axes:\n",
" ax.grid(True, linestyle=\"--\", alpha=0.4)\n",
" ax.tick_params(axis=\"both\", labelsize=10)\n",
"\n",
"axes[2].xaxis.set_major_locator(mdates.AutoDateLocator())\n",
"axes[2].xaxis.set_major_formatter(mdates.ConciseDateFormatter(\n",
" axes[2].xaxis.get_major_locator()\n",
"))\n",
"\n",
"plt.tight_layout()\n",
"plt.savefig(\"well_31_water_level.png\", dpi=300)\n",
"plt.show()\n"
]
}
],
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
33 changes: 33 additions & 0 deletions 02_activities/assignments/Assignment_3_plot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
library(readr)
library(ggplot2)

# Load the CSV file
df <- read_csv("W0000031-1.csv", show_col_types = FALSE)

# Convert the datetime column if needed
df$READING_DTTM <- as.POSIXct(df$READING_DTTM)

# Name of the water level column
water_level_col <- "Water_Level_Elevation_meter_above_sea_level"

# (Optional) Define date ranges to highlight — replace with real dates if desired
highlight_dates <- data.frame(
start = as.POSIXct(c("2015-01-01 00:00:00")),
end = as.POSIXct(c("2015-02-01 00:00:00"))
)

# Plot
ggplot(df, aes(x = READING_DTTM, y = .data[[water_level_col]])) +
geom_rect(data = highlight_dates,
aes(xmin = start, xmax = end, ymin = -Inf, ymax = Inf),
inherit.aes = FALSE,
fill = "grey70", alpha = 0.4) +
geom_line(color = "black", linewidth = 0.3) +
labs(
title = "Hourly Well Water Level at Location 31",
x = "Date (Hourly Measurements)",
y = "Water Level Elevation (m above sea level)"
) +
theme_minimal(base_size = 12)
# Save figure
ggsave("Well31_Hourly_Water_Level.png", plot = p, width = 10, height = 5, dpi = 300)
Binary file added 02_activities/assignments/Excel .png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 02_activities/assignments/Rplot_water level.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading