From 2084d6c2c53768bdcffdf5f7ac4dda9ee70fa0d8 Mon Sep 17 00:00:00 2001 From: Hailey Johnson Date: Wed, 10 Jul 2024 15:30:56 -0700 Subject: [PATCH 1/6] fix DSG subet writer tests --- .../main/java/thredds/core/DatasetManager.java | 2 +- .../AbstractStationProfileSubsetWriter.java | 12 +++++------- .../station/StationProfileSubsetWriterNetcdf.java | 8 +++++--- .../server/ncss/view/dsg/DsgSubsetWriterTest.java | 8 ++++---- .../ncss/view/dsg/point/netcdf3/outputAll.ncml | 2 +- .../ncss/view/dsg/point/netcdf3/outputSubset.ncml | 2 +- .../ncss/view/dsg/point/netcdf4/outputAll.ncml | 2 +- .../ncss/view/dsg/point/netcdf4/outputSubset.ncml | 2 +- .../ncss/view/dsg/station/netcdf3/outputAll.ncml | 5 ++--- .../view/dsg/station/netcdf3/outputSubset1.ncml | 5 ++--- .../view/dsg/station/netcdf3/outputSubset2.ncml | 5 ++--- .../ncss/view/dsg/station/netcdf4/outputAll.ncml | 5 ++--- .../view/dsg/station/netcdf4/outputSubset1.ncml | 5 ++--- .../view/dsg/station/netcdf4/outputSubset2.ncml | 5 ++--- .../ncss/view/dsg/station_profile/input.ncml | 2 +- .../dsg/station_profile/netcdf3/outputAll.ncml | 14 +++++++++++--- .../station_profile/netcdf3/outputSubset1.ncml | 13 ++++++++++--- .../station_profile/netcdf3/outputSubset2.ncml | 12 +++++++++--- .../dsg/station_profile/netcdf4/outputAll.ncml | 15 ++++++++++++--- .../station_profile/netcdf4/outputSubset1.ncml | 12 ++++++++++-- .../station_profile/netcdf4/outputSubset2.ncml | 13 ++++++++++--- 21 files changed, 94 insertions(+), 55 deletions(-) diff --git a/tds/src/main/java/thredds/core/DatasetManager.java b/tds/src/main/java/thredds/core/DatasetManager.java index aaaeca3911..ba9a648ee8 100644 --- a/tds/src/main/java/thredds/core/DatasetManager.java +++ b/tds/src/main/java/thredds/core/DatasetManager.java @@ -400,7 +400,7 @@ public CoverageCollection openCoverageDataset(HttpServletRequest req, HttpServle String ncml = datasetTracker.findNcml(reqPath); if (ncml != null) { Optional opt = - CoverageDatasetFactory.openNcmlString(ncml, DatasetUrl.findDatasetUrl(reqPath).getTrueurl()); + CoverageDatasetFactory.openNcmlString(ncml);//, DatasetUrl.findDatasetUrl(reqPath).getTrueurl()); if (!opt.isPresent()) throw new FileNotFoundException("NcML is not a Grid Dataset " + reqPath + " err=" + opt.getErrorMessage()); diff --git a/tds/src/main/java/thredds/server/ncss/view/dsg/station/AbstractStationProfileSubsetWriter.java b/tds/src/main/java/thredds/server/ncss/view/dsg/station/AbstractStationProfileSubsetWriter.java index e617ed907f..7ef6785ec8 100644 --- a/tds/src/main/java/thredds/server/ncss/view/dsg/station/AbstractStationProfileSubsetWriter.java +++ b/tds/src/main/java/thredds/server/ncss/view/dsg/station/AbstractStationProfileSubsetWriter.java @@ -65,22 +65,20 @@ public void write() throws Exception { for (StationFeature profileFeat : subsettedStationFeatCol.getStationFeatures()) { assert profileFeat instanceof StationProfileFeature : "Expected StationProfileFeature, not " - + profileFeat.getClass().toString(); + + profileFeat.getClass().toString(); // Perform temporal subset. We do this even when a time instant is specified, in which case wantedRange // represents a sanity check (i.e. "give me the feature closest to the specified time, but it must at least be // within an hour"). - StationProfileFeature subsettedStationProfileFeat = ((StationProfileFeature) profileFeat); if (wantedRange != null) { - subsettedStationProfileFeat = subsettedStationProfileFeat.subset(wantedRange); + profileFeat = ((StationProfileFeature)profileFeat).subset(wantedRange); } if (ncssParams.getTime() != null) { CalendarDate wantedTime = ncssParams.getTime(); - subsettedStationProfileFeat = new ClosestTimeStationProfileFeatureSubset( - (StationProfileFeatureImpl) subsettedStationProfileFeat, wantedTime); + profileFeat = new ClosestTimeStationProfileFeatureSubset( + (StationProfileFeatureImpl) profileFeat, wantedTime); } - - count += writeStationProfileTimeSeriesFeature(subsettedStationProfileFeat); + count += writeStationProfileTimeSeriesFeature((StationProfileFeature) profileFeat); } if (count == 0) { diff --git a/tds/src/main/java/thredds/server/ncss/view/dsg/station/StationProfileSubsetWriterNetcdf.java b/tds/src/main/java/thredds/server/ncss/view/dsg/station/StationProfileSubsetWriterNetcdf.java index d4754e5ee7..58a0471089 100644 --- a/tds/src/main/java/thredds/server/ncss/view/dsg/station/StationProfileSubsetWriterNetcdf.java +++ b/tds/src/main/java/thredds/server/ncss/view/dsg/station/StationProfileSubsetWriterNetcdf.java @@ -86,7 +86,9 @@ public HttpHeaders getHttpHeaders(String datasetPath, boolean isStream) { @Override protected void writeHeader(StationProfileFeature stn) throws Exception { - return; + ArrayList asList = new ArrayList<>(); + asList.add(stn); + cfWriter.writeHeader(asList); } @Override @@ -95,8 +97,8 @@ protected void writeProfileFeature(StationProfileFeature stn, ProfileFeature pro } @Override - protected void writeStationPointFeature(StationProfileFeature stn, StationPointFeature stationPointFeat) { - return; + protected void writeStationPointFeature(StationProfileFeature stn, StationPointFeature stationPointFeat) throws Exception { + cfWriter.writeObsData(stationPointFeat); } @Override diff --git a/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java b/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java index 4cd4aa0a0d..982bd5855b 100644 --- a/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java +++ b/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java @@ -40,7 +40,6 @@ * Created by cwardgar on 2014/05/27. */ @RunWith(Parameterized.class) -@Ignore("TODO: fix to work with new cfpointwriters") public class DsgSubsetWriterTest { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @Rule @@ -115,7 +114,7 @@ public static List getTestParameters() { // I like this workaround better than because subclasses can potentially override setupClass(). setupClass(); - return Arrays.asList(new Object[][] { + return Arrays.asList(new Object[][]{ // Point {FeatureType.POINT, SupportedFormat.CSV_FILE, subsetParamsAll, "outputAll.csv"}, {FeatureType.POINT, SupportedFormat.CSV_FILE, subsetParamsPoint, "outputSubset.csv"}, @@ -165,7 +164,8 @@ public static List getTestParameters() { {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsAll, "outputAll.ncml"}, {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsProfile1, "outputSubset1.ncml"}, - {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsProfile2, "outputSubset2.ncml"}}); + {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsProfile2, "outputSubset2.ncml"}, + }); } private final FeatureType wantedType; @@ -192,7 +192,7 @@ public void testWrite() throws Exception { File datasetFile = new File(getClass().getResource(datasetResource).toURI()); File expectedResultFile = new File(getClass().getResource(expectedResultResource).toURI()); - File actualResultFile = tempFolder.newFile(); + File actualResultFile = File.createTempFile("test", null);//tempFolder.newFile(); try (FeatureDatasetPoint fdPoint = openPointDataset(wantedType, datasetFile); OutputStream outFileStream = new BufferedOutputStream(new FileOutputStream(actualResultFile))) { diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf3/outputAll.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf3/outputAll.ncml index 702c5b15e2..c089b43269 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf3/outputAll.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf3/outputAll.ncml @@ -44,7 +44,7 @@ 10.0 40.0 70.0 100.0 130.0 160.0 190.0 220.0 250.0 280.0 310.0 340.0 370.0 400.0 430.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf3/outputSubset.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf3/outputSubset.ncml index 44450ab792..9ced4f4214 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf3/outputSubset.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf3/outputSubset.ncml @@ -36,7 +36,7 @@ 10.0 13.0 16.0 19.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf4/outputAll.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf4/outputAll.ncml index c09c07f24c..602bc4b5ea 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf4/outputAll.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf4/outputAll.ncml @@ -50,7 +50,7 @@ 10.0 40.0 70.0 100.0 130.0 160.0 190.0 220.0 250.0 280.0 310.0 340.0 370.0 400.0 430.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf4/outputSubset.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf4/outputSubset.ncml index 1b4a785aa1..cdf53edfac 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf4/outputSubset.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/point/netcdf4/outputSubset.ncml @@ -41,7 +41,7 @@ 10.0 13.0 16.0 19.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputAll.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputAll.ncml index e7912d7e7b..a64637029b 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputAll.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputAll.ncml @@ -20,8 +20,7 @@ - - + 100.0 106.0 112.0 @@ -66,7 +65,7 @@ 10.0 40.0 70.0 100.0 130.0 160.0 190.0 220.0 250.0 280.0 310.0 340.0 370.0 400.0 430.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputSubset1.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputSubset1.ncml index d49224226f..5c804c4cc2 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputSubset1.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputSubset1.ncml @@ -20,8 +20,7 @@ - - + 100.0 112.0 @@ -58,7 +57,7 @@ 40.0 70.0 100.0 340.0 370.0 400.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputSubset2.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputSubset2.ncml index a59ba9c855..0e53303b1a 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputSubset2.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf3/outputSubset2.ncml @@ -20,8 +20,7 @@ - - + 100.0 106.0 112.0 @@ -66,7 +65,7 @@ 70.0 220.0 370.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputAll.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputAll.ncml index ed4a792f01..99b02dd364 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputAll.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputAll.ncml @@ -20,8 +20,7 @@ - - + 100.0 106.0 112.0 @@ -70,7 +69,7 @@ 10.0 40.0 70.0 100.0 130.0 160.0 190.0 220.0 250.0 280.0 310.0 340.0 370.0 400.0 430.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputSubset1.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputSubset1.ncml index 18d68de58d..06389ec700 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputSubset1.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputSubset1.ncml @@ -20,8 +20,7 @@ - - + 100.0 112.0 @@ -61,7 +60,7 @@ 40.0 70.0 100.0 340.0 370.0 400.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputSubset2.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputSubset2.ncml index 94a715f23e..e6572042a3 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputSubset2.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station/netcdf4/outputSubset2.ncml @@ -20,8 +20,7 @@ - - + 100.0 106.0 112.0 @@ -70,7 +69,7 @@ 70.0 220.0 370.0 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/input.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/input.ncml index 9e8da6b8e6..4ee07636bb 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/input.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/input.ncml @@ -60,5 +60,5 @@ - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputAll.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputAll.ncml index 7a3b029d56..573246bce0 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputAll.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputAll.ncml @@ -44,6 +44,14 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + + + + 0.0 0.0 0.0 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 40.0 40.0 40.0 + 0.0 0.0 0.0 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 40.0 40.0 40.0 + 0.0 0.0 0.0 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 40.0 40.0 40.0 + + @@ -69,7 +77,7 @@ - + 1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100 103 106 109 112 115 118 121 124 127 130 133 @@ -77,11 +85,11 @@ - + 10 40 70 100 130 160 190 220 250 280 310 340 370 400 430 460 490 520 550 580 610 640 670 700 730 760 790 820 850 880 910 940 970 1000 1030 1060 1090 1120 1150 1180 1210 1240 1270 1300 1330 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputSubset1.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputSubset1.ncml index 5114f4df1e..a0fdaf33f1 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputSubset1.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputSubset1.ncml @@ -48,7 +48,14 @@ - 10.0 20.0 30.0 10.0 20.0 30.0 + 10.0 20.0 30.0 10.0 20.0 30.0 + + + + + + 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 + 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 @@ -69,11 +76,11 @@ - + 100 130 160 190 220 250 280 310 340 1000 1030 1060 1090 1120 1150 1180 1210 1240 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputSubset2.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputSubset2.ncml index 6ed263cd9a..6c7cc614b6 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputSubset2.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf3/outputSubset2.ncml @@ -51,6 +51,12 @@ 20.0 20.0 20.0 + + + + 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 + + @@ -69,7 +75,7 @@ - + 19 22 25 64 67 70 109 112 115 @@ -77,11 +83,11 @@ - + 190 220 250 640 670 700 1090 1120 1150 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputAll.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputAll.ncml index 4605e9c145..a8cf33e5f0 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputAll.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputAll.ncml @@ -57,6 +57,15 @@ 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 + + + + + 0.0 0.0 0.0 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 40.0 40.0 40.0 + 0.0 0.0 0.0 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 40.0 40.0 40.0 + 0.0 0.0 0.0 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 40.0 40.0 40.0 + + @@ -70,7 +79,7 @@ - + 1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100 103 106 109 112 115 118 121 124 127 130 133 @@ -79,12 +88,12 @@ - + 10 40 70 100 130 160 190 220 250 280 310 340 370 400 430 460 490 520 550 580 610 640 670 700 730 760 790 820 850 880 910 940 970 1000 1030 1060 1090 1120 1150 1180 1210 1240 1270 1300 1330 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputSubset1.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputSubset1.ncml index e8adf33dce..22bdc035f9 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputSubset1.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputSubset1.ncml @@ -44,6 +44,14 @@ 3 3 3 3 3 3 + + + + + 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 + 10.0 10.0 10.0 20.0 20.0 20.0 30.0 30.0 30.0 + + @@ -70,12 +78,12 @@ - + 100 130 160 190 220 250 280 310 340 1000 1030 1060 1090 1120 1150 1180 1210 1240 - + diff --git a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputSubset2.ncml b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputSubset2.ncml index 7ac53c80c5..0b1c447b74 100644 --- a/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputSubset2.ncml +++ b/tds/src/test/resources/thredds/server/ncss/view/dsg/station_profile/netcdf4/outputSubset2.ncml @@ -57,6 +57,13 @@ 0 1 2 + + + + + 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 + + @@ -70,7 +77,7 @@ - + 19 22 25 64 67 70 109 112 115 @@ -79,12 +86,12 @@ - + 190 220 250 640 670 700 1090 1120 1150 - + From 77ad6135eee9ea063a488d382ec15e3ff81063eb Mon Sep 17 00:00:00 2001 From: Hailey Johnson Date: Fri, 12 Jul 2024 11:30:06 -0700 Subject: [PATCH 2/6] spotless --- tds/src/main/java/thredds/core/DatasetManager.java | 4 ++-- .../dsg/station/AbstractStationProfileSubsetWriter.java | 7 +++---- .../view/dsg/station/StationProfileSubsetWriterNetcdf.java | 3 ++- .../thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java | 7 +++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tds/src/main/java/thredds/core/DatasetManager.java b/tds/src/main/java/thredds/core/DatasetManager.java index ba9a648ee8..65ba6738a0 100644 --- a/tds/src/main/java/thredds/core/DatasetManager.java +++ b/tds/src/main/java/thredds/core/DatasetManager.java @@ -399,8 +399,8 @@ public CoverageCollection openCoverageDataset(HttpServletRequest req, HttpServle // since the urlPath doesn't need to point to a file if there is ncml String ncml = datasetTracker.findNcml(reqPath); if (ncml != null) { - Optional opt = - CoverageDatasetFactory.openNcmlString(ncml);//, DatasetUrl.findDatasetUrl(reqPath).getTrueurl()); + Optional opt = CoverageDatasetFactory.openNcmlString(ncml);// , + // DatasetUrl.findDatasetUrl(reqPath).getTrueurl()); if (!opt.isPresent()) throw new FileNotFoundException("NcML is not a Grid Dataset " + reqPath + " err=" + opt.getErrorMessage()); diff --git a/tds/src/main/java/thredds/server/ncss/view/dsg/station/AbstractStationProfileSubsetWriter.java b/tds/src/main/java/thredds/server/ncss/view/dsg/station/AbstractStationProfileSubsetWriter.java index 7ef6785ec8..14ec31bb15 100644 --- a/tds/src/main/java/thredds/server/ncss/view/dsg/station/AbstractStationProfileSubsetWriter.java +++ b/tds/src/main/java/thredds/server/ncss/view/dsg/station/AbstractStationProfileSubsetWriter.java @@ -65,18 +65,17 @@ public void write() throws Exception { for (StationFeature profileFeat : subsettedStationFeatCol.getStationFeatures()) { assert profileFeat instanceof StationProfileFeature : "Expected StationProfileFeature, not " - + profileFeat.getClass().toString(); + + profileFeat.getClass().toString(); // Perform temporal subset. We do this even when a time instant is specified, in which case wantedRange // represents a sanity check (i.e. "give me the feature closest to the specified time, but it must at least be // within an hour"). if (wantedRange != null) { - profileFeat = ((StationProfileFeature)profileFeat).subset(wantedRange); + profileFeat = ((StationProfileFeature) profileFeat).subset(wantedRange); } if (ncssParams.getTime() != null) { CalendarDate wantedTime = ncssParams.getTime(); - profileFeat = new ClosestTimeStationProfileFeatureSubset( - (StationProfileFeatureImpl) profileFeat, wantedTime); + profileFeat = new ClosestTimeStationProfileFeatureSubset((StationProfileFeatureImpl) profileFeat, wantedTime); } count += writeStationProfileTimeSeriesFeature((StationProfileFeature) profileFeat); } diff --git a/tds/src/main/java/thredds/server/ncss/view/dsg/station/StationProfileSubsetWriterNetcdf.java b/tds/src/main/java/thredds/server/ncss/view/dsg/station/StationProfileSubsetWriterNetcdf.java index 58a0471089..671293862c 100644 --- a/tds/src/main/java/thredds/server/ncss/view/dsg/station/StationProfileSubsetWriterNetcdf.java +++ b/tds/src/main/java/thredds/server/ncss/view/dsg/station/StationProfileSubsetWriterNetcdf.java @@ -97,7 +97,8 @@ protected void writeProfileFeature(StationProfileFeature stn, ProfileFeature pro } @Override - protected void writeStationPointFeature(StationProfileFeature stn, StationPointFeature stationPointFeat) throws Exception { + protected void writeStationPointFeature(StationProfileFeature stn, StationPointFeature stationPointFeat) + throws Exception { cfWriter.writeObsData(stationPointFeat); } diff --git a/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java b/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java index 982bd5855b..cfbad4d057 100644 --- a/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java +++ b/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java @@ -114,7 +114,7 @@ public static List getTestParameters() { // I like this workaround better than because subclasses can potentially override setupClass(). setupClass(); - return Arrays.asList(new Object[][]{ + return Arrays.asList(new Object[][] { // Point {FeatureType.POINT, SupportedFormat.CSV_FILE, subsetParamsAll, "outputAll.csv"}, {FeatureType.POINT, SupportedFormat.CSV_FILE, subsetParamsPoint, "outputSubset.csv"}, @@ -164,8 +164,7 @@ public static List getTestParameters() { {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsAll, "outputAll.ncml"}, {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsProfile1, "outputSubset1.ncml"}, - {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsProfile2, "outputSubset2.ncml"}, - }); + {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsProfile2, "outputSubset2.ncml"},}); } private final FeatureType wantedType; @@ -192,7 +191,7 @@ public void testWrite() throws Exception { File datasetFile = new File(getClass().getResource(datasetResource).toURI()); File expectedResultFile = new File(getClass().getResource(expectedResultResource).toURI()); - File actualResultFile = File.createTempFile("test", null);//tempFolder.newFile(); + File actualResultFile = File.createTempFile("test", null);// tempFolder.newFile(); try (FeatureDatasetPoint fdPoint = openPointDataset(wantedType, datasetFile); OutputStream outFileStream = new BufferedOutputStream(new FileOutputStream(actualResultFile))) { From c5f6bfe6f51d134c6f8282e3d295fd9248360c03 Mon Sep 17 00:00:00 2001 From: Hailey Johnson Date: Fri, 12 Jul 2024 11:38:17 -0700 Subject: [PATCH 3/6] clean up --- tds/src/main/java/thredds/core/DatasetManager.java | 4 ++-- .../thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tds/src/main/java/thredds/core/DatasetManager.java b/tds/src/main/java/thredds/core/DatasetManager.java index 65ba6738a0..aaaeca3911 100644 --- a/tds/src/main/java/thredds/core/DatasetManager.java +++ b/tds/src/main/java/thredds/core/DatasetManager.java @@ -399,8 +399,8 @@ public CoverageCollection openCoverageDataset(HttpServletRequest req, HttpServle // since the urlPath doesn't need to point to a file if there is ncml String ncml = datasetTracker.findNcml(reqPath); if (ncml != null) { - Optional opt = CoverageDatasetFactory.openNcmlString(ncml);// , - // DatasetUrl.findDatasetUrl(reqPath).getTrueurl()); + Optional opt = + CoverageDatasetFactory.openNcmlString(ncml, DatasetUrl.findDatasetUrl(reqPath).getTrueurl()); if (!opt.isPresent()) throw new FileNotFoundException("NcML is not a Grid Dataset " + reqPath + " err=" + opt.getErrorMessage()); diff --git a/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java b/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java index cfbad4d057..a69f2d8b41 100644 --- a/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java +++ b/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java @@ -164,7 +164,7 @@ public static List getTestParameters() { {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsAll, "outputAll.ncml"}, {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsProfile1, "outputSubset1.ncml"}, - {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsProfile2, "outputSubset2.ncml"},}); + {FeatureType.STATION_PROFILE, SupportedFormat.NETCDF4, subsetParamsProfile2, "outputSubset2.ncml"}}); } private final FeatureType wantedType; @@ -191,7 +191,7 @@ public void testWrite() throws Exception { File datasetFile = new File(getClass().getResource(datasetResource).toURI()); File expectedResultFile = new File(getClass().getResource(expectedResultResource).toURI()); - File actualResultFile = File.createTempFile("test", null);// tempFolder.newFile(); + File actualResultFile = tempFolder.newFile(); try (FeatureDatasetPoint fdPoint = openPointDataset(wantedType, datasetFile); OutputStream outFileStream = new BufferedOutputStream(new FileOutputStream(actualResultFile))) { From bf0570c31f1b1e5711f540675057d80c11662e2a Mon Sep 17 00:00:00 2001 From: Hailey Johnson Date: Fri, 12 Jul 2024 13:42:10 -0600 Subject: [PATCH 4/6] enable two more ignored tests --- .../java/thredds/server/services/ConsistentDatesTest.java | 2 +- .../ncss/controller/gridaspoint/TestGridAsPointMisc.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tds/src/integrationTests/java/thredds/server/services/ConsistentDatesTest.java b/tds/src/integrationTests/java/thredds/server/services/ConsistentDatesTest.java index 24e4ec7624..7c0046dab8 100644 --- a/tds/src/integrationTests/java/thredds/server/services/ConsistentDatesTest.java +++ b/tds/src/integrationTests/java/thredds/server/services/ConsistentDatesTest.java @@ -157,7 +157,7 @@ public void checkNCSSDates() throws JDOMException, IOException { } // PF5_SST_Climatology: :units = "hour since 0000-01-01 00:00:00"; - @Ignore("TODO: fix to work with new cfpointwriters") +// @Ignore("TODO: fix to work with new cfpointwriters") @Test public void checkNCSSDatesInNetcdf() throws JDOMException, IOException { String endpoint = TestOnLocalServer.withHttpPath( diff --git a/tds/src/test/java/thredds/server/ncss/controller/gridaspoint/TestGridAsPointMisc.java b/tds/src/test/java/thredds/server/ncss/controller/gridaspoint/TestGridAsPointMisc.java index 85a78b888a..6b95d33b52 100644 --- a/tds/src/test/java/thredds/server/ncss/controller/gridaspoint/TestGridAsPointMisc.java +++ b/tds/src/test/java/thredds/server/ncss/controller/gridaspoint/TestGridAsPointMisc.java @@ -70,8 +70,7 @@ public void getGridAsPointSubsetAllSupportedFormats() throws Exception { Assert.assertTrue(ct.startsWith(sf.getMimeType())); } } - - @Ignore("TODO: fix to work with new cfpointwriters") + @Test public void getGridAsProfileSubsetAllSupportedFormats() throws Exception { for (SupportedFormat sf : SupportedOperation.GRID_AS_POINT_REQUEST.getSupportedFormats()) { From 6283369f7647d362ce7d9304944291e512a3829a Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Fri, 12 Jul 2024 14:46:43 -0600 Subject: [PATCH 5/6] Remove comment --- .../java/thredds/server/services/ConsistentDatesTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/tds/src/integrationTests/java/thredds/server/services/ConsistentDatesTest.java b/tds/src/integrationTests/java/thredds/server/services/ConsistentDatesTest.java index 7c0046dab8..f6b8da8c00 100644 --- a/tds/src/integrationTests/java/thredds/server/services/ConsistentDatesTest.java +++ b/tds/src/integrationTests/java/thredds/server/services/ConsistentDatesTest.java @@ -157,7 +157,6 @@ public void checkNCSSDates() throws JDOMException, IOException { } // PF5_SST_Climatology: :units = "hour since 0000-01-01 00:00:00"; -// @Ignore("TODO: fix to work with new cfpointwriters") @Test public void checkNCSSDatesInNetcdf() throws JDOMException, IOException { String endpoint = TestOnLocalServer.withHttpPath( From b20919f23cb0b02584dcccad3bd916aa1f11dd6a Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Fri, 12 Jul 2024 14:49:58 -0600 Subject: [PATCH 6/6] Spotless fix --- .../server/ncss/controller/gridaspoint/TestGridAsPointMisc.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tds/src/test/java/thredds/server/ncss/controller/gridaspoint/TestGridAsPointMisc.java b/tds/src/test/java/thredds/server/ncss/controller/gridaspoint/TestGridAsPointMisc.java index 6b95d33b52..f3395b7f39 100644 --- a/tds/src/test/java/thredds/server/ncss/controller/gridaspoint/TestGridAsPointMisc.java +++ b/tds/src/test/java/thredds/server/ncss/controller/gridaspoint/TestGridAsPointMisc.java @@ -70,7 +70,7 @@ public void getGridAsPointSubsetAllSupportedFormats() throws Exception { Assert.assertTrue(ct.startsWith(sf.getMimeType())); } } - + @Test public void getGridAsProfileSubsetAllSupportedFormats() throws Exception { for (SupportedFormat sf : SupportedOperation.GRID_AS_POINT_REQUEST.getSupportedFormats()) {