Skip to content

Commit 414544d

Browse files
committed
Enable joinNew agg with numericTimeSettings
Related to #1327
1 parent 4cddb5c commit 414544d

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

cdm/core/src/main/java/ucar/nc2/internal/ncml/AggregationNew.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import ucar.nc2.Group;
1515
import ucar.nc2.NetcdfFile;
1616
import ucar.nc2.Variable;
17+
import ucar.nc2.constants.CF;
1718
import ucar.nc2.constants._Coordinate;
1819
import ucar.nc2.dataset.CoordinateAxis;
1920
import ucar.nc2.dataset.NetcdfDataset;
@@ -60,8 +61,13 @@ protected void buildNetcdfDataset(CancelTask cancelTask) throws IOException {
6061
.setParentGroupBuilder(root).setDimensionsByName(dimName);
6162
root.addVariable(joinAggCoordVar);
6263
joinAggCoordVar.setProxyReader(this);
63-
if (isDate)
64+
if (isDate) {
6465
joinAggCoordVar.addAttribute(new Attribute(_Coordinate.AxisType, "Time"));
66+
String coordUnits = ((AggDatasetOuter) typicalDataset).coordUdunit;
67+
if (coordUnits != null && !coordUnits.isEmpty()) {
68+
joinAggCoordVar.addAttribute(new Attribute(CF.UNITS, coordUnits));
69+
}
70+
}
6571

6672
// if speced externally, this variable will get replaced
6773
// LOOK was CacheVar cv = new CoordValueVar(joinAggCoordVar.getFullName(), joinAggCoordVar.dataType,

cdm/core/src/main/java/ucar/nc2/ncml/AggregationNew.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package ucar.nc2.ncml;
77

8+
import ucar.nc2.constants.CF;
89
import ucar.nc2.dataset.NetcdfDataset;
910
import ucar.nc2.dataset.VariableDS;
1011
import ucar.nc2.dataset.DatasetConstructor;
@@ -55,8 +56,14 @@ protected void buildNetcdfDataset(CancelTask cancelTask) throws IOException {
5556
joinAggCoord = new VariableDS(ncDataset, null, null, dimName, coordType, dimName, null, null);
5657
ncDataset.addVariable(null, joinAggCoord);
5758
joinAggCoord.setProxyReader(this);
58-
if (isDate)
59+
if (isDate) {
5960
joinAggCoord.addAttribute(new ucar.nc2.Attribute(_Coordinate.AxisType, "Time"));
61+
String coordUnits = ((DatasetOuterDimension) typicalDataset).coordUdunit;
62+
if (coordUnits != null && !coordUnits.isEmpty()) {
63+
joinAggCoord.addAttribute(new Attribute(CF.UNITS, coordUnits));
64+
}
65+
}
66+
6067

6168
// if speced externally, this variable will get replaced
6269
CacheVar cv =

0 commit comments

Comments
 (0)