Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _load(cls, cube=False):
ds = netCDF4.Dataset(cls.GRID)
x_axis = pyinterp.core.Axis(ds.variables["lon"][::5], is_circle=True)
y_axis = pyinterp.core.Axis(ds.variables["lat"][::5])
mss = ds.variables["mss"][::5, ::5].T
mss[mss.mask] = float("nan")
if cube:
z_axis = pyinterp.core.Axis(np.arange(2))
mss = np.stack([mss.data] * len(z_axis)).transpose(1, 2, 0)
return pyinterp.grid.Grid3D(x_axis, y_axis, z_axis, mss)
return pyinterp.grid.Grid2D(x_axis, y_axis, mss.data)
def load_data(cls):
with netCDF4.Dataset(cls.GRID) as ds:
z = np.flip(ds.variables['tcw'][:].T, axis=1)
z[z.mask] = float("nan")
return core.Grid3DFloat64(
core.Axis(ds.variables['longitude'][:], is_circle=True),
core.Axis(np.flip(ds.variables['latitude'][:])),
core.Axis(ds.variables['time'][:]), z.data)
def _load_data(cls):
with netCDF4.Dataset(cls.GRID) as ds:
z = ds.variables['tcw'][:].T
z[z.mask] = float("nan")
return core.cartesian.Trivariate(
core.Axis(ds.variables['longitude'][:], is_circle=True),
core.Axis(ds.variables['latitude'][:]),
core.Axis(ds.variables['time'][:]), z.data)
def _load(cls, cube=False):
ds = netCDF4.Dataset(cls.GRID)
x_axis = pyinterp.core.Axis(ds.variables["lon"][::5], is_circle=True)
y_axis = pyinterp.core.Axis(ds.variables["lat"][::5])
mss = ds.variables["mss"][::5, ::5].T
mss[mss.mask] = float("nan")
if cube:
z_axis = pyinterp.core.Axis(np.arange(2))
mss = np.stack([mss.data] * len(z_axis)).transpose(1, 2, 0)
return pyinterp.grid.Grid3D(x_axis, y_axis, z_axis, mss)
return pyinterp.grid.Grid2D(x_axis, y_axis, mss.data)