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 Sea-Surface Salinity

ESA
* Original Data Source: https://zenodo.org/records/13753090
* Reference:  https://doi.org/10.3390/rs14102502
* OSC entry: https://opensciencedata.esa.int/products/4dmed-2d-sss/collection
* License: CC-BY-4.0
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
zarr_href = 'https://s3.waw4-1.cloudferro.com/EarthCODE/OSCAssets/ocean_datasets/sssd.zarr'
ds = xr.open_zarr(zarr_href)
ds
Loading...

Plot sea surface salinity for a single date

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


# Choose date
date = np.datetime64("2020-06-15")


# Select FSLE for that date
sos_day = ds["sos"].sel(time=date,depth=0,method="nearest", drop=True)
sos_day
Loading...
# Create map
fig = plt.figure(figsize=(12, 7))

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

pcm = ax.pcolormesh(
    sos_day.lon,
    sos_day.lat,
    sos_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("sea surface salinity")

ax.set_title(f"sea surface salinity — {date}")

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