Search in sources :

Example 1 with GridGeometry

use of org.apache.sis.internal.netcdf.GridGeometry in project sis by apache.

the class GridGeometryInfoTest method filter.

/**
 * Filters out the one-dimensional coordinate systems created by {@code GridGeometry}
 * but not by the UCAR library.
 *
 * @return the filtered grid geometries to test.
 */
@Override
protected GridGeometry[] filter(final GridGeometry[] geometries) {
    final GridGeometry[] copy = new GridGeometry[geometries.length];
    int count = 0;
    for (final GridGeometry geometry : geometries) {
        if (geometry.getSourceDimensions() != 1 || geometry.getTargetDimensions() != 1) {
            copy[count++] = geometry;
        }
    }
    return ArraysExt.resize(copy, count);
}
Also used : GridGeometry(org.apache.sis.internal.netcdf.GridGeometry)

Example 2 with GridGeometry

use of org.apache.sis.internal.netcdf.GridGeometry in project sis by apache.

the class MetadataReader method read.

/**
 * Creates an ISO {@code Metadata} object from the information found in the netCDF file.
 *
 * @return the ISO metadata object.
 * @throws IOException if an I/O operation was necessary but failed.
 * @throws DataStoreException if a logical error occurred.
 */
public Metadata read() throws IOException, DataStoreException {
    addResourceScope(ScopeCode.DATASET, null);
    Set<InternationalString> publisher = addCitation();
    addIdentificationInfo(publisher);
    for (final String service : SERVICES) {
        final String name = stringValue(service);
        if (name != null) {
            addResourceScope(ScopeCode.SERVICE, name);
        }
    }
    addAcquisitionInfo();
    addContentInfo();
    /*
         * Add the dimension information, if any. This metadata node
         * is built from the netCDF CoordinateSystem objects.
         */
    for (final GridGeometry cs : decoder.getGridGeometries()) {
        if (cs.getSourceDimensions() >= Variable.MIN_DIMENSION && cs.getTargetDimensions() >= Variable.MIN_DIMENSION) {
            addSpatialRepresentationInfo(cs);
        }
    }
    addFileIdentifier();
    /*
         * Add history in Metadata.dataQualityInfo.lineage.statement as specified by UnidataDD2MI.xsl.
         * However Metadata.resourceLineage.statement could be a more appropriate place.
         * See https://issues.apache.org/jira/browse/SIS-361
         */
    final DefaultMetadata metadata = build(false);
    for (final String path : searchPath) {
        decoder.setSearchPath(path);
        DefaultLineage lineage = null;
        String value = stringValue(HISTORY);
        if (value != null) {
            lineage = new DefaultLineage();
            lineage.setStatement(new SimpleInternationalString(value));
        }
        value = stringValue(SOURCE);
        if (value != null) {
            if (lineage == null)
                lineage = new DefaultLineage();
            addIfAbsent(lineage.getSources(), new DefaultSource(value));
        }
        if (lineage != null) {
            final DefaultDataQuality quality = new DefaultDataQuality(ScopeCode.DATASET);
            quality.setLineage(lineage);
            addIfAbsent(metadata.getDataQualityInfo(), quality);
        }
    }
    decoder.setSearchPath(searchPath);
    metadata.setMetadataStandards(Citations.ISO_19115);
    addCompleteMetadata(createURI(stringValue(METADATA_LINK)));
    return metadata;
}
Also used : GridGeometry(org.apache.sis.internal.netcdf.GridGeometry) InternationalString(org.opengis.util.InternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) DefaultMetadata(org.apache.sis.metadata.iso.DefaultMetadata) DefaultSource(org.apache.sis.metadata.iso.lineage.DefaultSource) InternationalString(org.opengis.util.InternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) DefaultLineage(org.apache.sis.metadata.iso.lineage.DefaultLineage) DefaultDataQuality(org.apache.sis.metadata.iso.quality.DefaultDataQuality)

Aggregations

GridGeometry (org.apache.sis.internal.netcdf.GridGeometry)2 DefaultMetadata (org.apache.sis.metadata.iso.DefaultMetadata)1 DefaultLineage (org.apache.sis.metadata.iso.lineage.DefaultLineage)1 DefaultSource (org.apache.sis.metadata.iso.lineage.DefaultSource)1 DefaultDataQuality (org.apache.sis.metadata.iso.quality.DefaultDataQuality)1 SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)1 InternationalString (org.opengis.util.InternationalString)1