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);
}
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;
}
Aggregations