Visualizing Hypoxia Cruise Sampling Locations in the Gulf of Mexico¶
In [1]:
Copied!
# %pip install -U openpyxl hypercoast
# %pip install -U openpyxl hypercoast
In [2]:
Copied!
import pandas as pd
import hypercoast
import pandas as pd
import hypercoast
In [3]:
Copied!
url = "https://github.com/opengeos/datasets/releases/download/hypercoast/Hypoxia_Data_Sheet.xlsx"
xls_path = "data/Hypoxia_Data_Sheet.xlsx"
hypercoast.download_file(url, xls_path, overwrite=True)
url = "https://github.com/opengeos/datasets/releases/download/hypercoast/Hypoxia_Data_Sheet.xlsx"
xls_path = "data/Hypoxia_Data_Sheet.xlsx"
hypercoast.download_file(url, xls_path, overwrite=True)
Out[3]:
'/home/runner/work/HyperCoast/HyperCoast/docs/examples/data/Hypoxia_Data_Sheet.xlsx'
In [4]:
Copied!
df = pd.read_excel(xls_path)
df.head()
df = pd.read_excel(xls_path)
df.head()
Out[4]:
Station | Station.1 | Time | Date | Lon | Lat | Depth (m) | Secchi (m) | Salinity | Water Temp | ... | Absorption | CDOM | LISST | Nano | Surface \npH | Sufface \nO2 | Bottom \nO2 | FL-ECO | FL-CDOM | Notes | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | River stations | NaN | NaN | NaT | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
1 | R1 | St1 | 09:39:00 | 2024-07-21 | -89.45114 | 28.89887 | NaN | 2 | 28.71 | 30.74161 | ... | 125ml | yes | yes | no | NaN | NaN | NaN | NaN | NaN | River Mouth |
2 | R2 | St2 | 09:47:00 | 2024-07-21 | -89.45306 | 28.90001 | NaN | 2 | 25.91325 | 30.91475 | ... | 150ml | yes | yes | yes | NaN | NaN | NaN | NaN | NaN | River plume, seaside |
3 | R3 | St3 | 09:59:00 | 2024-07-21 | -89.43833 | 28.89487 | NaN | 0.75 | 24.44862 | 30.59565 | ... | 100ml | yes | yes | yes | NaN | NaN | NaN | NaN | NaN | NaN |
4 | R4 | St4 | 10:13:00 | 2024-07-21 | -89.43162 | 28.90630 | NaN | 0.5 | 8.34838 | 30.13989 | ... | 100ml | yes | yes | yes | NaN | NaN | NaN | NaN | NaN | NaN |
5 rows × 22 columns
In [5]:
Copied!
df_filtered = df.dropna(subset=["Lon", "Lat"]).reset_index(drop=True)
df_filtered.head()
df_filtered = df.dropna(subset=["Lon", "Lat"]).reset_index(drop=True)
df_filtered.head()
Out[5]:
Station | Station.1 | Time | Date | Lon | Lat | Depth (m) | Secchi (m) | Salinity | Water Temp | ... | Absorption | CDOM | LISST | Nano | Surface \npH | Sufface \nO2 | Bottom \nO2 | FL-ECO | FL-CDOM | Notes | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | R1 | St1 | 09:39:00 | 2024-07-21 | -89.45114 | 28.89887 | NaN | 2 | 28.71 | 30.74161 | ... | 125ml | yes | yes | no | NaN | NaN | NaN | NaN | NaN | River Mouth |
1 | R2 | St2 | 09:47:00 | 2024-07-21 | -89.45306 | 28.90001 | NaN | 2 | 25.91325 | 30.91475 | ... | 150ml | yes | yes | yes | NaN | NaN | NaN | NaN | NaN | River plume, seaside |
2 | R3 | St3 | 09:59:00 | 2024-07-21 | -89.43833 | 28.89487 | NaN | 0.75 | 24.44862 | 30.59565 | ... | 100ml | yes | yes | yes | NaN | NaN | NaN | NaN | NaN | NaN |
3 | R4 | St4 | 10:13:00 | 2024-07-21 | -89.43162 | 28.90630 | NaN | 0.5 | 8.34838 | 30.13989 | ... | 100ml | yes | yes | yes | NaN | NaN | NaN | NaN | NaN | NaN |
4 | R5 | St5 | 10:58:00 | 2024-07-21 | -89.37324 | 28.98095 | NaN | 0.5 | 2.4625 | 30.3054 | ... | 100ml | yes | yes | yes | NaN | NaN | NaN | NaN | NaN | NaN |
5 rows × 22 columns
In [6]:
Copied!
url = (
"https://github.com/opengeos/datasets/releases/download/hypercoast/Hypoxia_Path.kml"
)
kml_path = "data/Hypoxia_Path.kml"
hypercoast.download_file(url, kml_path)
url = (
"https://github.com/opengeos/datasets/releases/download/hypercoast/Hypoxia_Path.kml"
)
kml_path = "data/Hypoxia_Path.kml"
hypercoast.download_file(url, kml_path)
Out[6]:
'/home/runner/work/HyperCoast/HyperCoast/docs/examples/data/Hypoxia_Path.kml'
In [7]:
Copied!
url = "https://github.com/opengeos/datasets/releases/download/hypercoast/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc"
filepath = "data/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc"
hypercoast.download_file(url, filepath)
url = "https://github.com/opengeos/datasets/releases/download/hypercoast/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc"
filepath = "data/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc"
hypercoast.download_file(url, filepath)
data/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc already exists. Skip downloading. Set overwrite=True to overwrite.
Out[7]:
'/home/runner/work/HyperCoast/HyperCoast/docs/examples/data/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc'
In [8]:
Copied!
dataset = hypercoast.read_pace(filepath)
# dataset
dataset = hypercoast.read_pace(filepath)
# dataset
In [9]:
Copied!
m = hypercoast.Map()
m.add_basemap("Hybrid")
wavelengths = [450, 550, 650]
m.add_pace(
dataset, wavelengths, indexes=[3, 2, 1], vmin=0, vmax=0.02, layer_name="PACE"
)
m.add("spectral")
style = {"weight": 2, "color": "red"}
m.add_kml(kml_path, style=style, layer_name="Hypoxia Path", info_mode=None)
m.add_points_from_xy(
df_filtered,
x="Lon",
y="Lat",
max_cluster_radius=50,
layer_name="Hypoxia Data Points",
)
m.set_center(-91.46118, 28.89758, zoom=8)
m
m = hypercoast.Map()
m.add_basemap("Hybrid")
wavelengths = [450, 550, 650]
m.add_pace(
dataset, wavelengths, indexes=[3, 2, 1], vmin=0, vmax=0.02, layer_name="PACE"
)
m.add("spectral")
style = {"weight": 2, "color": "red"}
m.add_kml(kml_path, style=style, layer_name="Hypoxia Path", info_mode=None)
m.add_points_from_xy(
df_filtered,
x="Lon",
y="Lat",
max_cluster_radius=50,
layer_name="Hypoxia Data Points",
)
m.set_center(-91.46118, 28.89758, zoom=8)
m
Out[9]: