def test_write_col_and_reload_2(self): # Copy a collocated file and try to reload it. This exposes a bug where # latitude and longitude aren't recognised on reload from cis.data_io.products import cis prod = cis() data_object = prod.create_data_object([valid_cis_col_file], valid_cis_col_variable) write(data_object, tmp_file) data_object2 = prod.create_data_object([tmp_file], valid_cis_col_variable)
def test_ungridded_write_attributes(self): data = make_dummy_2d_ungridded_data() attrs = {'attr_name': 'attr_val', 'standard_name': 'std_val', 'long_name': 'lg_val', 'units': 'units'} data.add_attributes(attrs) write(data, tmp_file) self.d = Dataset(tmp_file) for key, val in attrs.items(): assert getattr(self.d.variables['rain'], key) == val
def test_ungridded_write_attributes(self): data = make_dummy_2d_ungridded_data() attrs = { 'attr_name': 'attr_val', 'standard_name': 'std_val', 'long_name': 'lg_val', 'units': 'units' } data.add_attributes(attrs) write(data, tmp_file) self.d = Dataset(tmp_file) for key, val in attrs.items(): assert getattr(self.d.variables['rainfall_flux'], key) == val
def test_write_col_and_reload_1(self): # Copy a collocated file and try to reload it. This exposes a bug where # var.shape is set in the NetCDF metadata from cis.data_io.products import Aerosol_CCI prod = Aerosol_CCI() data_object = prod.create_data_object([valid_cis_col_file], valid_cis_col_variable) write(data_object, tmp_file) self.d = Dataset(tmp_file) v = self.d.variables['AOT_440'] # This will fail because var.shape is in the file print(v[:2])
def test_ungridded_write_units(self): data = make_dummy_2d_ungridded_data() data.units = 'kg' write(data, tmp_file) self.d = Dataset(tmp_file) assert self.d.variables['rainfall_flux'].units == 'kg'
def test_write_netcdf(self): data_object = make_dummy_2d_ungridded_data() write(data_object, tmp_file)
def test_ungridded_write_units(self): data = make_dummy_2d_ungridded_data() data.units = 'kg' write(data, tmp_file) self.d = Dataset(tmp_file) assert self.d.variables['rain'].units == 'kg'