Skip to content

Commit

Permalink
Merge pull request #1317 from tdrwenski/use-agg-cache-for-coverages
Browse files Browse the repository at this point in the history
Fix performance issue that aggregation cache not used for coverages
  • Loading branch information
haileyajohnson authored Mar 13, 2024
2 parents e57f760 + d6eca07 commit 343758e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,21 @@ public static Optional<FeatureDatasetCoverage> openGrib(String endpoint) {

}

/**
* @deprecated Use openNcmlString(String, String)
*/
@Deprecated
public static Optional<FeatureDatasetCoverage> openNcmlString(String ncml) throws IOException {
NetcdfDataset ncd = NetcdfDatasets.openNcmlDataset(new StringReader(ncml), null, null);
return openNcmlString(ncml, null);
}

/**
* @param ncml the NcML as a String
* @param location the URL location string of the NcML document,
* or may be just a unique name for caching purposes (if null, aggregation cache will not be used).
*/
public static Optional<FeatureDatasetCoverage> openNcmlString(String ncml, String location) throws IOException {
NetcdfDataset ncd = NetcdfDatasets.openNcmlDataset(new StringReader(ncml), location, null);

DtCoverageDataset gds = new DtCoverageDataset(ncd);
if (!gds.getGrids().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testAggNewOpenAsCoverage() throws IOException, InvalidRangeException
ncml = ncmlStream.collect(Collectors.joining());
}
assertThat(ncml).isNotNull();
Optional<FeatureDatasetCoverage> fdc = CoverageDatasetFactory.openNcmlString(ncml);
Optional<FeatureDatasetCoverage> fdc = CoverageDatasetFactory.openNcmlString(ncml, null);
assertThat(fdc.isPresent()).isTrue();
List<CoverageCollection> cc = fdc.get().getCoverageCollections();
checkCoverages(cc);
Expand Down

0 comments on commit 343758e

Please sign in to comment.