Ejemplo n.º 1
0
 def test_sel_gridded(self):
     """Test sel exception for gridded data."""
     dset = read_era5(os.path.join(FILES_DIR, "era5file.nc"))
     with pytest.raises(NotImplementedError):
         dset.spec.sel(lons=self.lons, lats=self.lats, method="idw")
Ejemplo n.º 2
0
"""
Spectrum as pcolormesh
======================

Pcolor type plot of wave spectrum

"""
import matplotlib.pyplot as plt
import cmocean
from wavespectra import read_era5

dset = read_era5("../_static/era5file.nc")
ds = dset.isel(lat=0, lon=0, time=0)
p = ds.spec.plot(kind="pcolormesh", cmap=cmocean.cm.thermal)
Ejemplo n.º 3
0
"""
Faceting with clean axes
========================

Removing axes could help visualising patterns in multiple plots

"""
import numpy as np
import matplotlib.pyplot as plt
import cmocean
from wavespectra import read_era5


dset = read_era5("../_static/era5file.nc").isel(time=0)
dset1 = dset.where(dset>0, 1e-5)
dset1 = np.log10(dset1)
p = dset1.spec.plot(
        clean_axis=True,
        col="lon",
        row="lat",
        figsize=(16,8),
        logradius=False,
        vmin=0.39,
        levels=15,
        extend="both",
        cmap=cmocean.cm.thermal,
        add_colorbar=False,
)
plt.tight_layout()