def test_ncswan(self): ds_wavespectra = read_ncswan(self.filename) ds_xarray = xr.open_dataset(self.filename) assert ds_xarray.hs.values == pytest.approx(ds_wavespectra.spec.hs().values, rel=0.01)
def test_octopus(self): with Timer("Testing Octopus writer"): ds = read_ncswan(self.filename) ds.spec.to_octopus(os.path.join(self.tmp_dir, "spectra.oct"))
def test_write_octopus_one_time(self): ds = read_ncswan(self.filename) ds = ds.isel(time=[0]) ds.spec.to_octopus(os.path.join(self.tmp_dir, "spec_one_time.oct"))
def test_write_octopus_missing_lonlat(self): ds = read_ncswan(self.filename) ds = ds.rename({"lon": "x", "lat": "y"}) with pytest.raises(NotImplementedError): ds.spec.to_octopus(os.path.join(self.tmp_dir, "spec_no_lonlat.oct"))
def test_write_octopus_missing_winds_depth(self): ds = read_ncswan(self.filename) ds = ds.drop_vars([attrs.WSPDNAME, attrs.WDIRNAME, attrs.DEPNAME]) ds.spec.to_octopus( os.path.join(self.tmp_dir, "spec_no_winds_depth.oct"))
def test_write_octopus(self): ds = read_ncswan(self.filename) ds.spec.to_octopus(os.path.join(self.tmp_dir, "spectra.oct"))