Station Explorer Assistant

Chat history cleared. Start a new conversation!

Explain data to me. I am new to researching sea level and tidal information. Share information about the data available at UHSLC and within this app. Discuss ways to interact with the data, such as requesting to see samples, perform analyses, or download files. Ask me what I would like to explore next.

Welcome to the world of sea level and tidal research! The University of Hawaii Sea Level Center (UHSLC) provides a comprehensive set of data related to sea levels and tides, which can be accessed and analyzed through this application. Here's an overview of the types of data available and how you can interact with them:

Types of Data Available

  1. Water Levels Data (Fast Delivery Data)

    • Hourly and Daily Measurements: These are measured by tide gauges and stored in pickle files. The data is referenced to Station Zero Datum and is available in UTC/GMT time zone.
    • Data Structure: The data is organized by frequency (hourly or daily) and station ID, with each entry containing a start date and a list of sea level measurements.
  2. Tide Gauge Data (Tide Prediction Data)

    • Predicted Tides: Calculated based on harmonic constants, not measured. The data is stored in LST time zone.
    • Data Structure: Organized by station ID, with metadata and tide data including timestamps and tide levels.
  3. Datum Data

    • Reference Levels: Information about various datum levels (e.g., MLLW, MHHW) is available in HTML tables. This is crucial for converting between different reference frames.
  4. Climatological Data

    • Long-term Records: Provides historical extremes, trends, and comparisons to long-term records. Available in daily, monthly, and monthly hourly formats.
  5. Near-real Time Data (Rapid Data)

    • Recent Measurements: Includes observed and predicted water levels, residuals, and datum information. Available in CSV format.

Ways to Interact with the Data

  • Viewing Samples: You can request to see samples of any dataset to get a feel for the data structure and content.
  • Performing Analyses: Analyze trends, compare datasets, or visualize data through plots and graphs.
  • Downloading Files: If you need the raw data for offline analysis, you can request to download specific datasets.
  • Converting Datums: Convert data between different reference frames using the provided datum information.

How Can I Assist You?

Feel free to ask for specific data samples, analyses, or visualizations. You can also request to download data files or ask for guidance on how to interpret the data. Let me know what aspect of sea level or tidal information you would like to explore next!

Help me get started with the daily water level data. Show me a plot of the data and a link to download it.

To get started with the daily water level data, I'll first load the data from the pickle file and then create a plot to visualize it. After that, I'll provide you with a link to download the data.

Let's begin by loading the daily water level data and preparing it for visualization.

import pandas as pd
import numpy as np
import pickle
import matplotlib.pyplot as plt
from datetime import timedelta

# Load the daily water level data
file_path = './data/sea_level_data/daily_sea_level_data_fast_delivery.pkl'
with open(file_path, 'rb') as f:
    daily_data = pickle.load(f)

# Process the data for a specific station (e.g., station '057')
station_id = '057'
station_data = daily_data['daily'].get(station_id, {})

# Extract start date and sea level data
start_date_str = station_data.get('start_date')
sea_level_data = station_data.get('sea_level_data', [])

# Convert start date to datetime object
start_date = pd.to_datetime(start_date_str, format='%Y%m%d')

# Replace missing data (-32767) with NaN
sea_level_data = [np.nan if x == -32767 else x for x in sea_level_data]

# Create a date range for the time series
dates = pd.date_range(start=start_date, periods=len(sea_level_data), freq='D')

# Create a DataFrame
df = pd.DataFrame({'Date': dates, 'Sea Level (mm)': sea_level_data})

# Plot the data
plt.figure(figsize=(12, 6))
plt.plot(df['Date'], df['Sea Level (mm)'], label='Sea Level (Station Zero Datum)')
plt.title('Daily Sea Level Data for Station 057')
plt.xlabel('Date')
plt.ylabel('Sea Level (mm)')
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()

# Save the DataFrame to a CSV file for download
download_path = './static/msg-iz2n425im/daily_sea_level_data_station_057.csv'
df.to_csv(download_path, index=False)
download_path
Image

It seems there was an issue saving the file because the directory doesn't exist. Let me create the directory and save the file again.

import os

# Create the directory if it doesn't exist
output_dir = './static/msg-iz2n425im'
os.makedirs(output_dir, exist_ok=True)

# Save the DataFrame to a CSV file for download
download_path = os.path.join(output_dir, 'daily_sea_level_data_station_057.csv')
df.to_csv(download_path, index=False)
download_path

The daily sea level data for Station 057 has been successfully saved. You can download it using the link below:

Download Daily Sea Level Data (Station 057)

Feel free to explore the data further or let me know if there's anything else you'd like to do!

SEA can make mistakes. Check important results. Click for more information.