def test_provenance_as_netcdf_attribute_missing(self): ctd_ds = xr.open_dataset(os.path.join(DATA_DIR, self.ctdpf_fn), decode_times=False) ctd_ds = ctd_ds[['obs', 'time', 'deployment', 'temperature', 'pressure', 'pressure_temp', 'conductivity', 'ext_volt0']] ctd_stream_dataset = StreamDataset(self.ctdpf_sk, {}, [], 'UNIT') ctd_stream_dataset.events = copy.deepcopy(self.ctd_events) ctd_stream_dataset.events.deps = {} ctd_stream_dataset._insert_dataset(ctd_ds) ctd_stream_dataset.insert_instrument_attributes()
def test_provenance_as_netcdf_attribute(self): ctd_ds = xr.open_dataset(os.path.join(DATA_DIR, self.ctdpf_fn), decode_times=False) ctd_ds = ctd_ds[[ 'obs', 'time', 'deployment', 'temperature', 'pressure', 'pressure_temp', 'conductivity', 'ext_volt0' ]] ctd_stream_dataset = StreamDataset(self.ctdpf_sk, {}, [], 'UNIT') ctd_stream_dataset.events = self.ctd_events ctd_stream_dataset._insert_dataset(ctd_ds) ctd_stream_dataset.insert_instrument_attributes() for ds in ctd_stream_dataset.datasets.itervalues(): self.assertIn('Manufacturer', ds.attrs) self.assertIn('ModelNumber', ds.attrs) self.assertIn('SerialNumber', ds.attrs) self.assertIn('Description', ds.attrs) self.assertIn('FirmwareVersion', ds.attrs) self.assertIn('SoftwareVersion', ds.attrs) self.assertIn('AssetUniqueID', ds.attrs) self.assertIn('Notes', ds.attrs) self.assertIn('Owner', ds.attrs) self.assertIn('RemoteResources', ds.attrs) self.assertIn('ShelfLifeExpirationDate', ds.attrs) self.assertIn('Mobile', ds.attrs) self.assertIn('AssetManagementRecordLastModified', ds.attrs) self.assertEqual(ds.attrs['Manufacturer'], 'Sea-Bird Electronics') self.assertEqual(ds.attrs['ModelNumber'], 'SBE 16plus V2') self.assertEqual(ds.attrs['SerialNumber'], '16-50112') self.assertEqual(ds.attrs['Description'], 'CTD Profiler: CTDPF Series A') self.assertEqual(ds.attrs['AssetUniqueID'], 'ATOSU-66662-00013') self.assertEqual(ds.attrs['Mobile'], 'False') self.assertEqual(ds.attrs['AssetManagementRecordLastModified'], '2017-04-03T23:48:25.650000') self.assertEqual(ds.attrs['FirmwareVersion'], 'Not specified.') self.assertEqual(ds.attrs['SoftwareVersion'], 'Not specified.') self.assertEqual(ds.attrs['Notes'], 'Not specified.') self.assertEqual(ds.attrs['Owner'], 'Not specified.') self.assertEqual(ds.attrs['RemoteResources'], '[]') self.assertEqual(ds.attrs['ShelfLifeExpirationDate'], 'Not specified.')
def test_provenance_as_netcdf_attribute(self): ctd_ds = xr.open_dataset(os.path.join(DATA_DIR, self.ctdpf_fn), decode_times=False) ctd_ds = ctd_ds[['obs', 'time', 'deployment', 'temperature', 'pressure', 'pressure_temp', 'conductivity', 'ext_volt0']] ctd_stream_dataset = StreamDataset(self.ctdpf_sk, {}, [], 'UNIT') ctd_stream_dataset.events = self.ctd_events ctd_stream_dataset._insert_dataset(ctd_ds) ctd_stream_dataset.insert_instrument_attributes() for ds in ctd_stream_dataset.datasets.itervalues(): self.assertIn('Manufacturer', ds.attrs) self.assertIn('ModelNumber', ds.attrs) self.assertIn('SerialNumber', ds.attrs) self.assertIn('Description', ds.attrs) self.assertIn('FirmwareVersion', ds.attrs) self.assertIn('SoftwareVersion', ds.attrs) self.assertIn('AssetUniqueID', ds.attrs) self.assertIn('Notes', ds.attrs) self.assertIn('Owner', ds.attrs) self.assertIn('RemoteResources', ds.attrs) self.assertIn('ShelfLifeExpirationDate', ds.attrs) self.assertIn('Mobile', ds.attrs) self.assertIn('AssetManagementRecordLastModified', ds.attrs) self.assertEqual(ds.attrs['Manufacturer'], 'Sea-Bird Electronics') self.assertEqual(ds.attrs['ModelNumber'], 'SBE 16plus V2') self.assertEqual(ds.attrs['SerialNumber'], '16-50112') self.assertEqual(ds.attrs['Description'], 'CTD Profiler: CTDPF Series A') self.assertEqual(ds.attrs['AssetUniqueID'], 'ATOSU-66662-00013') self.assertEqual(ds.attrs['Mobile'], 'False') self.assertEqual(ds.attrs['AssetManagementRecordLastModified'], '2017-04-03T23:48:25.650000') self.assertEqual(ds.attrs['FirmwareVersion'], 'Not specified.') self.assertEqual(ds.attrs['SoftwareVersion'], 'Not specified.') self.assertEqual(ds.attrs['Notes'], 'Not specified.') self.assertEqual(ds.attrs['Owner'], 'Not specified.') self.assertEqual(ds.attrs['RemoteResources'], '[]') self.assertEqual(ds.attrs['ShelfLifeExpirationDate'], 'Not specified.')