/** * Returns information about the dataset as a whole. The returned metadata object can contain information * such as the spatiotemporal extent of the dataset, contact information about the creator or distributor, * data quality, usage constraints and more. * * @return information about the dataset. * @throws DataStoreException if an error occurred while reading the data. */ @Override public synchronized Metadata getMetadata() throws DataStoreException { if (metadata == null) try { final MetadataReader reader = new MetadataReader(decoder); metadata = reader.read(); } catch (IOException | ArithmeticException e) { throw new DataStoreException(e); } return metadata; }
/** * Returns information about the dataset as a whole. The returned metadata object can contain information * such as the spatiotemporal extent of the dataset, contact information about the creator or distributor, * data quality, usage constraints and more. * * @return information about the dataset. * @throws DataStoreException if an error occurred while reading the data. */ @Override public synchronized Metadata getMetadata() throws DataStoreException { if (metadata == null) try { final MetadataReader reader = new MetadataReader(decoder); metadata = reader.read(); if (metadata instanceof ModifiableMetadata) { ((ModifiableMetadata) metadata).freeze(); } } catch (IOException e) { throw new DataStoreException(e); } return metadata; }
/** * Reads the metadata using the UCAR library and compares * its string representation with the expected one. * * @throws IOException if an I/O error occurred. * @throws DataStoreException if a logical error occurred. */ @Test public void testUCAR() throws IOException, DataStoreException { final Metadata metadata; try (Decoder input = createDecoder(TestData.NETCDF_2D_GEOGRAPHIC)) { metadata = new MetadataReader(input).read(); } compareToExpected(metadata); }
/** * Reads the metadata using the netCDF decoder embedded with SIS, * and compares its string representation with the expected one. * * @throws IOException if an I/O error occurred while opening the file. * @throws DataStoreException if a logical error occurred. */ @Test public void testEmbedded() throws IOException, DataStoreException { final Metadata metadata; try (Decoder input = ChannelDecoderTest.createChannelDecoder(TestData.NETCDF_2D_GEOGRAPHIC)) { metadata = new MetadataReader(input).read(); } compareToExpected(metadata); }