Visualization of Metocean Data

Using the vizualization endpoint

The API provides a dedicated endpoint (/plot_timeseries) for generating time series visualizations directly from MetOcean data. This eliminates the need for client-side plotting code, providing a consistent and professional visualization with a single API call.

Endpoint Details

  • URL: https://api.amphitrite.fr/plot_timeseries
  • Method: POST
  • Authentication: Requires API key in the x-api-key header
  • Content-Type: application/json

How to Use

  1. Make a request to the /MetOcean endpoint as usual to retrieve your data
  2. Pass the complete MetOcean response to the /plot_timeseries endpoint
import requests
import json

# Step 1: Get MetOcean data (assuming you've already completed this)
metocean_response = {...}  # Your MetOcean API response data

# Step 2: Generate visualization
api_url = "https://api.amphitrite.fr"  # Or your API URL
api_key = "your-api-key-here"

headers = {
    "Content-Type": "application/json",
    "x-api-key": api_key
}

# Send the MetOcean response to the plot_timeseries endpoint
response = requests.post(
    f"{api_url}/plot_timeseries",
    json=metocean_response,
    headers=headers
)

# Check if successful
if response.status_code == 200:
    # Save the PNG image
    with open("metocean_visualization.png", "wb") as f:
        f.write(response.content)
    print("Visualization saved as metocean_visualization.png")
else:
    print(f"Error: {response.status_code} - {response.text}")

Features

  • Automatically identifies and plots all available environmental parameters
  • Consistent color coding by variable type (wind, wave, current, etc.)
  • Support for directional data with cardinal direction labels
  • Statistical indicators showing min, max, and mean values
  • High-resolution output optimized for reporting and analysis

The visualization below demonstrates how to effectively display metocean data retrieved from the API. This example shows a transatlantic crossing with data collected over approximately two weeks, providing valuable insights into changing weather and ocean conditions along the route.

Sample Visualization

The advanced visualization capabilities of the API allow for comprehensive analysis of multiple metocean parameters simultaneously. As shown in the image below, the visualization can include:

  1. Current Intensity and Direction: The top two panels show current intensity (m/s) and direction (TO). Note how the currents vary significantly throughout the journey, with peak values reaching approximately 1.0 m/s. The direction panel reveals important navigational information about where the currents are flowing.

  2. Wave Parameters: The middle panels display wave significant height (m) and wave mean period (s). The significant wave height shows a major peak exceeding 8 meters during a storm event around January 22-23, which would represent severe sea conditions. The wave period data provides additional context about the wave energy, with longer periods indicating more developed sea states.

  3. Wind Parameters: The orange panels show wind intensity (m/s) and direction (FROM). The wind intensity reaches peaks of over 20 m/s (approximately 40 knots) during storm events, with a maximum of nearly 22 m/s. The directional data helps identify weather pattern shifts and frontal passages.

  4. Sea Surface Temperature: The purple panel tracks sea surface temperature (°C), showing the thermal boundaries crossed during the journey. Note the significant temperature variations (ranging from approximately 8°C to 19°C), which can indicate crossing different ocean currents and water masses.

  5. Bathymetry: The bottom panel displays ocean depth (m), revealing the seafloor profile along the route. The visualization shows the vessel crossing from the continental shelf (approximately 200m depth) into deep ocean waters (over 4000m depth) and back to shallower waters.

Visualization of Metocean Parameters