def test_dudz(): acc = ds.xroms.dudz assert np.allclose(acc, xroms.dudz(ds.u, grid)) acc.name == acc.attrs["name"] acc.attrs["grid"] == ds.xroms.grid items = ["T", "X", "Y", "Z", "longitude", "latitude", "vertical", "time"] assert set(items).issubset(acc.cf.get_valid_keys())
def dudz(self): """Calculate dudz [1/s] on u/w grids. Notes ----- See `xroms.dudz` for full docstring. `sboundary` is set to 'extend'. Example usage ------------- >>> ds.xroms.dudz """ if "dudz" not in self.ds: var = xroms.dudz(self.ds.u, self.grid, sboundary="extend") self.ds["dudz"] = var return self.ds["dudz"]
def test_vertical_shear(): xdudz = xroms.dudz(ds.u, grid) xdvdz = xroms.dvdz(ds.v, grid) assert np.allclose(xroms.vertical_shear(xdudz, xdvdz, grid), 0)
def test_dudz(): assert np.allclose(xroms.dudz(ds.u, grid), 0)