OPeNDAPUtils { public static Map<String, String> getDimensionVariableNameRangeMapping( List<?> gridVariableList, String xRangeString, String yRangeString, String timeRangeString) { Map<String, String> results = new HashMap<String, String>(); for (int i = 0; i < gridVariableList.size(); i++) { Object variable = gridVariableList.get(i); if (variable instanceof CoordinateAxis1D) { String varName = ((VariableDS) variable).getShortName(); switch (((CoordinateAxis1D) variable).getAxisType()) { case GeoX: case Lon: { results.put(varName, xRangeString); break; } case GeoY: case Lat: { results.put(varName, yRangeString); break; } case Time: { results.put(varName, timeRangeString); break; } default: { } } } } return results; }  static String generateOpenDapURL(String datasetURI, List<String> requestedVariableList,
            List<?> gridVariableList, Range timeRange, Range yRange, Range xRange); static String generateOpenDapURL(String datasetURI, List<String> requestedVariableList,
            List<?> gridVariableList, Range timeRange, Range yRange, Range xRange,
            OPeNDAPContentType contentType); static Map<String, String> getDimensionRawNameRangeMapping(List<?> gridVariableList,
            String xRangeString, String yRangeString, String timeRangeString); static Map<String, String> getDimensionVariableNameRangeMapping(
            List<?> gridVariableList, String xRangeString, String yRangeString,
            String timeRangeString); static boolean isOPeNDAP(URI uri); static final int RANGE_STRIDE; static final String PARAMETER_DECLARATOR; static final String RANGE_DELIMETER; static final String URI_DELIMETER; static final String OPENDAP_PROTO; static final String REQUEST_PROTO; static final List<String> REQUIRED_ATTRIBUTES; static final String DESCRIPTION_HEADER; }
@Test public void daymetVariableDimensionNameTest() { String timeRangeString = "[9763:1:10128]"; String xRangeString = "[1241:1:1852]"; String yRangeString = "[1903:1:2369]"; Map<String, String> dimensionVariableMapping = OPeNDAPUtils.getDimensionVariableNameRangeMapping(daymetGridDataSet.getNetcdfFile().getVariables(), xRangeString, yRangeString, timeRangeString); assertNotNull(dimensionVariableMapping); assertThat(dimensionVariableMapping.size(), is(equalTo(3))); assertTrue(dimensionVariableMapping.containsKey("time")); assertTrue(dimensionVariableMapping.get("time").equals(timeRangeString)); assertTrue(dimensionVariableMapping.containsKey("y")); assertTrue(dimensionVariableMapping.get("y").equals(yRangeString)); assertTrue(dimensionVariableMapping.containsKey("x")); assertTrue(dimensionVariableMapping.get("x").equals(xRangeString)); }
@Test public void prismVariableDimensionNameTest() { String timeRangeString = "[0:1:1417]"; String xRangeString = "[382:1:552]"; String yRangeString = "[213:1:312]"; Map<String, String> dimensionVariableMapping = OPeNDAPUtils.getDimensionVariableNameRangeMapping(prismGridDataSet.getNetcdfFile().getVariables(), xRangeString, yRangeString, timeRangeString); assertNotNull(dimensionVariableMapping); assertThat(dimensionVariableMapping.size(), is(equalTo(3))); assertTrue(dimensionVariableMapping.containsKey("time")); assertTrue(dimensionVariableMapping.get("time").equals(timeRangeString)); assertTrue(dimensionVariableMapping.containsKey("lat")); assertTrue(dimensionVariableMapping.get("lat").equals(yRangeString)); assertTrue(dimensionVariableMapping.containsKey("lon")); assertTrue(dimensionVariableMapping.get("lon").equals(xRangeString)); }
@Test public void ssebopetaVariableDimensionNameTest() { String timeRangeString = "[0:1:179]"; String xRangeString = "[1881:1:2663]"; String yRangeString = "[943:1:1391]"; Map<String, String> dimensionVariableMapping = OPeNDAPUtils.getDimensionVariableNameRangeMapping(ssebopetaGridDataSet.getNetcdfFile().getVariables(), xRangeString, yRangeString, timeRangeString); assertNotNull(dimensionVariableMapping); assertThat(dimensionVariableMapping.size(), is(equalTo(3))); assertTrue(dimensionVariableMapping.containsKey("time")); assertTrue(dimensionVariableMapping.get("time").equals(timeRangeString)); assertTrue(dimensionVariableMapping.containsKey("lat")); assertTrue(dimensionVariableMapping.get("lat").equals(yRangeString)); assertTrue(dimensionVariableMapping.containsKey("lon")); assertTrue(dimensionVariableMapping.get("lon").equals(xRangeString)); }