Skip to content

Commit 4ff1c8e

Browse files
author
haileyajohnson
authored
Dsg subset writers (#1361)
* fixups * minor fixes for dsgsubsetWriter * fix station altitudes
1 parent a9a1f11 commit 4ff1c8e

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

cdm/core/src/main/java/ucar/nc2/ft/point/writer/CFPointWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,16 @@ record = (Structure) writer.addVariable(null, recordName, DataType.STRUCTURE, re
515515

516516
Formatter coordNames = new Formatter().format("%s %s %s", stnFeature.getTimeName(), latName, lonName);
517517
if (!Double.isNaN(pointFeat.getLocation().getAltitude())) {
518-
altitudeCoordinateName = stnFeature.getAltName();
519518
coordNames.format(" %s", altitudeCoordinateName);
520519
}
521520

522521
if (writer.getVersion().isExtendedModel()) {
523522
addDataVariablesExtended(pointFeat.getFeatureData(), coordNames.toString());
524523
}
525524
addDataVariablesClassic(recordDim, pointFeat.getFeatureData(), dataMap, coordNames.toString());
526-
527525
}
526+
// TODO: note if we iterate all stations, the data at the first station is changed to the data at the last station
527+
break;
528528
}
529529

530530
addCoordinatesClassic(recordDim, obsCoords, dataMap);

cdm/core/src/main/java/ucar/nc2/ft/point/writer/WriterCFStationCollection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public void writeHeader(List<StationFeature> stns, @Nullable StationPointFeature
109109

110110
llbb = CFPointWriterUtils.getBoundingBox(stnList); // gets written in super.finish();
111111

112+
altitudeCoordinateName = altName;
112113
coords.add(VariableSimpleBuilder
113114
.makeScalar(stationIndexName, "station index for this observation record", null, DataType.INT)
114115
.addAttribute(CF.INSTANCE_DIMENSION, stationDimName).build());

cdm/core/src/main/java/ucar/nc2/ft/point/writer/WriterCFStationProfileCollection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ public void writeHeader(List<StationFeature> stations) throws IOException {
114114

115115

116116
obsCoords.add(VariableSimpleBuilder
117-
.makeScalar(stationProfile.getTimeName(), "time of measurement", timeUnit.toString(), DataType.DOUBLE)
117+
.makeScalar(stationProfile.getTimeName(), "nominal time of profile", timeUnit.toString(), DataType.DOUBLE)
118118
.build());
119119
if (altUnits != null) {
120-
altitudeCoordinateName = stationProfile.getAltName();
120+
altitudeCoordinateName = altName;
121121
obsCoords
122122
.add(VariableSimpleBuilder.makeScalar(altitudeCoordinateName, "obs altitude", altUnits, DataType.DOUBLE)
123-
.addAttribute(CF.STANDARD_NAME, "altitude")
123+
.addAttribute(CF.STANDARD_NAME, altitudeCoordinateName)
124124
.addAttribute(CF.POSITIVE, CF1Convention.getZisPositive(altitudeCoordinateName, altUnits)).build());
125125
}
126126
}

cdm/core/src/main/java/ucar/nc2/ft/point/writer2/WriterCFStationCollection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ protected void writeHeader(List<StationFeature> stations) throws IOException {
112112
}
113113
}
114114

115+
altitudeCoordinateName = stationAltName;
115116
llbb = ucar.nc2.ft.point.writer.CFPointWriterUtils.getBoundingBox(stnList); // gets written in super.finish();
116117
coords.add(VariableSimpleBuilder
117118
.makeScalar(stationIndexName, "station index for this observation record", null, DataType.INT)

cdm/core/src/main/java/ucar/nc2/ft/point/writer2/WriterCFStationProfileCollection.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ protected void writeHeader(List<StationFeature> stations) throws IOException {
118118
coverageCollections.add(profile);
119119

120120
obsCoords.add(VariableSimpleBuilder
121-
.makeScalar(profile.getTimeName(), "time of measurement", timeUnit.toString(), DataType.DOUBLE).build());
121+
.makeScalar(profile.getTimeName(), "nominal time of profile", timeUnit.toString(), DataType.DOUBLE)
122+
.build());
122123

123124
altitudeCoordinateName = profile.getAltName();
124125
obsCoords

0 commit comments

Comments
 (0)