Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Access 4DMED-SEA MIOST Lagrangian Eddies

ESA
* Original Data Source: https://zenodo.org/records/11384073
* Reference: https://doi.org/10.1016/j.ocemod.2010.12.006
* OSC entry: https://opensciencedata.esa.int/stac-browser/#/products/4dmed-2d-alt-miost-le-24/collection.json
* License: CC-BY-4.0
import xarray as xr
import numpy as np
import pandas as pd


zarr_href = 'https://s3.waw4-1.cloudferro.com/EarthCODE/OSCAssets/ocean_datasets/fsle.zarr/'
ds = xr.open_dataset(zarr_href)
ds
Loading...
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature

# Choose date
date = "2020-06-15"

# Select FSLE for that date
fsle_day = ds["fsle"].sel(time=date)

# 2-D coordinates
lon = ds["lon"]
lat = ds["lat"]

# Create map
fig = plt.figure(figsize=(12, 7))

ax = plt.axes(projection=ccrs.PlateCarree())

# Plot FSLE
pcm = ax.pcolormesh(
    lon,
    lat,
    fsle_day,
    transform=ccrs.PlateCarree(),
    shading="auto",
    cmap="viridis"
)

# Basemap features
ax.add_feature(cfeature.LAND, facecolor="lightgray")
ax.add_feature(cfeature.COASTLINE, linewidth=0.8)
ax.add_feature(cfeature.BORDERS, linewidth=0.5)



# Colourbar
cbar = plt.colorbar(
    pcm,
    ax=ax,
    orientation="vertical",
    pad=0.03,
    shrink=0.8
)
cbar.set_label("FSLE")

ax.set_title(f"FSLE — {date}")

plt.tight_layout()
plt.show()
<Figure size 1200x700 with 2 Axes>

Find strong and persistent currents in June 2022

target_month = "2022-06"

fsle_month = ds.fsle.sel(time=target_month).compute()
strong_fsle = float(
    fsle_month.quantile(
        0.90,
        dim=("time", "y", "x"),
        skipna=True
    )
)

print(f"Monthly 90th-percentile threshold: {strong_fsle:.3f} day⁻¹")
Monthly 90th-percentile threshold: 0.100 day⁻¹
valid_days = fsle_month.notnull().sum("time")

persistence = (
    (fsle_month >= strong_fsle).sum("time") / valid_days
).where(valid_days > 0)

mean_fsle = fsle_month.mean("time", skipna=True)
mean_fsle
Loading...
# visualise

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature

projection = ccrs.PlateCarree()

fig = plt.figure(figsize=(13, 6))
ax = plt.axes(projection=projection)

mesh = ax.pcolormesh(
    ds.lon,
    ds.lat,
    persistence,
    transform=projection,
    shading="auto",
    cmap="magma",
    vmin=0,
    vmax=0.6
)

ax.add_feature(cfeature.LAND, facecolor="lightgray", zorder=3)
ax.add_feature(cfeature.COASTLINE, linewidth=0.6, zorder=4)
ax.add_feature(cfeature.BORDERS, linewidth=0.35, zorder=4)

colorbar = plt.colorbar(
    mesh,
    ax=ax,
    orientation="horizontal",
    pad=0.08,
    fraction=0.05
)

colorbar.set_label("Fraction of valid days above the monthly 90th percentile")

ax.set_title(
    "Persistence of strong backward-FSLE structures\n"
    "Mediterranean Sea, June 2022"
)
<Figure size 1300x600 with 2 Axes>
candidate_mask = persistence >= 0.30

candidates = pd.DataFrame({
    "longitude": ds.lon.where(candidate_mask).values.ravel(),
    "latitude": ds.lat.where(candidate_mask).values.ravel(),
    "persistence": persistence.where(candidate_mask).values.ravel(),
    "mean_fsle_day-1": mean_fsle.where(candidate_mask).values.ravel()
}).dropna()

candidates = candidates.sort_values(
    ["persistence", "mean_fsle_day-1"],
    ascending=False
)

candidates
Loading...