1515import ucar .nc2 .Variable ;
1616import ucar .nc2 .dataset .NetcdfDataset ;
1717import ucar .nc2 .dataset .NetcdfDatasets ;
18+ import ucar .nc2 .internal .ncml .NcmlReader ;
1819import ucar .nc2 .time .Calendar ;
1920import ucar .nc2 .time .CalendarDate ;
2021import ucar .nc2 .time .CalendarDateFormatter ;
@@ -30,7 +31,7 @@ public void testNumericTime() throws IOException, InvalidRangeException, Interru
3031
3132 try (NetcdfDataset ncStr = NetcdfDataset .openDataset (aggStringTime );
3233 NetcdfDataset ncNum = NetcdfDataset .openDataset (aggNumericTime )) {
33- compareTimes (ncStr , ncNum );
34+ compareTimes (ncStr , ncNum , "time" );
3435 }
3536 }
3637
@@ -41,14 +42,34 @@ public void testNumericTimeWithBuilders() throws IOException, InvalidRangeExcept
4142
4243 try (NetcdfDataset ncStr = NetcdfDatasets .openDataset (aggStringTime );
4344 NetcdfDataset ncNum = NetcdfDatasets .openDataset (aggNumericTime )) {
44- compareTimes (ncStr , ncNum );
45+ compareTimes (ncStr , ncNum , "time" );
4546 }
4647 }
4748
48- void compareTimes (NetcdfDataset ncStr , NetcdfDataset ncNum ) throws IOException {
49- Variable isoTimeVar = ncStr .findVariable ("time" );
49+ @ Test
50+ public void testNumericTimeNcmlReader () throws IOException , InvalidRangeException , InterruptedException {
51+ String aggStringTime = "file:./" + TestNcmlRead .topDir + "aggNewOne.xml" ;
52+ String aggNumericTime = "file:./" + TestNcmlRead .topDir + "aggNewOneNumericTime.xml" ;
53+ try (NetcdfDataset ncStr = NcMLReader .readNcML (aggStringTime , null );
54+ NetcdfDataset ncNum = NcMLReader .readNcML (aggNumericTime , null )) {
55+ compareTimes (ncStr , ncNum , "time2" );
56+ }
57+ }
58+
59+ @ Test
60+ public void testNumericTimeNcmlReaderWithBuilders () throws IOException , InvalidRangeException , InterruptedException {
61+ String aggStringTime = "file:./" + TestNcmlRead .topDir + "aggNewOne.xml" ;
62+ String aggNumericTime = "file:./" + TestNcmlRead .topDir + "aggNewOneNumericTime.xml" ;
63+ try (NetcdfDataset ncStr = NcmlReader .readNcml (aggStringTime , null , null ).build ();
64+ NetcdfDataset ncNum = NcmlReader .readNcml (aggNumericTime , null , null ).build ()) {
65+ compareTimes (ncStr , ncNum , "time2" );
66+ }
67+ }
68+
69+ void compareTimes (NetcdfDataset ncStr , NetcdfDataset ncNum , String timeVarName ) throws IOException {
70+ Variable isoTimeVar = ncStr .findVariable (timeVarName );
5071 assertThat (isoTimeVar != null ).isTrue ();
51- Variable numericTimeVar = ncNum .findVariable ("time" );
72+ Variable numericTimeVar = ncNum .findVariable (timeVarName );
5273 assertThat (numericTimeVar != null ).isTrue ();
5374 Array isoTime = isoTimeVar .read ();
5475 Array numericTime = numericTimeVar .read ();
0 commit comments