def setUp(self): roms = 'ocean_s_coordinate_g1_roms.nc' self.nc = netCDF4.Dataset(os.path.join(data_path, roms)) formula_terms_variable = get_formula_terms_variables(self.nc)[0] formula_terms = get_formula_terms(formula_terms_variable) formula_terms_arrays = nc2biggus(self.nc, formula_terms) s = formula_terms_arrays['s'] c = formula_terms_arrays['C'] eta = formula_terms_arrays['eta'] depth = formula_terms_arrays['depth'] depth_c = formula_terms_arrays['depth_c'] self.z = ocean_s_coordinate_g1(s, c, eta, depth, depth_c) self.sliced = self.z[0, :, 30, 80]
def test_formula_terms_variables(self): formula_terms_variables = get_formula_terms_variables(self.nc) for var in formula_terms_variables: assert hasattr(var, 'formula_terms')
def test_no_formula_terms_variables(self): no_formula_term = 'no_formula_terms.nc' with netCDF4.Dataset(os.path.join(data_path, no_formula_term)) as nc: with pytest.raises(ValueError): get_formula_terms_variables(nc)
def setUp(self): roms = 'ocean_s_coordinate_g1_roms.nc' self.nc = netCDF4.Dataset(os.path.join(data_path, roms)) self.formula_terms_variable = get_formula_terms_variables(self.nc)[0] self.formula_terms = get_formula_terms(self.formula_terms_variable) self.formula_terms_arrays = nc2biggus(self.nc, self.formula_terms)