Skip to content

Commit c7e954f

Browse files
author
Hailey Johnson
committed
fix subsetting for station profiles
1 parent edc3d84 commit c7e954f

1 file changed

Lines changed: 15 additions & 26 deletions

File tree

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

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,16 @@ public int writeProfile(StationProfileFeature spf, ProfileFeature profile) throw
9494
writeObsData(pf);
9595
count++;
9696
}
97+
Integer stnIndex = stationIndexMap.get(spf.getName());
98+
if (stnIndex == null) {
99+
log.warn("BAD station {}", spf.getName());
100+
} else {
101+
writeProfileData(stnIndex, profile, count);
102+
}
97103
return count;
98104
}
99105

100106
public void writeHeader(List<StationFeature> stations) throws IOException {
101-
102107
List<VariableSimpleIF> obsCoords = new ArrayList<>();
103108
List<PointFeatureCollection> flattenStations = new ArrayList<>();
104109
List<StructureData> featureData = new ArrayList<>();
@@ -133,35 +138,19 @@ public void writeHeader(List<StationFeature> stations) throws IOException {
133138
for (StationFeature sf : stnList) {
134139
writeStationData(sf);
135140
stationIndexMap.put(sf.getName(), count);
136-
for (ProfileFeature p : (StationProfileFeature) sf) {
137-
int countPoints = 0;
138-
if (p.size() >= 0) {
139-
countPoints += p.size();
140-
} else {
141-
countPoints += Iterables.size(p);
142-
}
143-
writeProfileData(count, p, countPoints);
144-
}
141+
// for (ProfileFeature p : (StationProfileFeature) sf) {
142+
// int countPoints = 0;
143+
// if (p.size() >= 0) {
144+
// countPoints += p.size();
145+
// } else {
146+
// countPoints += Iterables.size(p);
147+
// }
148+
// writeProfileData(count, p, countPoints);
149+
// }
145150
count++;
146151
}
147152
}
148153

149-
@Override
150-
public void setFeatureAuxInfo(int nfeatures, int id_strlen) {
151-
int countProfiles = 0;
152-
int name_strlen = 0;
153-
for (StationFeature s : stnList) {
154-
name_strlen = Math.max(name_strlen, s.getName().length());
155-
if (((StationProfileFeature) s).size() >= 0)
156-
countProfiles += ((StationProfileFeature) s).size();
157-
else {
158-
countProfiles += Iterables.size(((StationProfileFeature) s));
159-
}
160-
}
161-
this.nfeatures = countProfiles;
162-
this.id_strlen = name_strlen;
163-
}
164-
165154
protected void makeFeatureVariables(List<StructureData> stnDataStructs, boolean isExtended) {
166155
// add the dimensions : extended model can use an unlimited dimension
167156
// Dimension stationDim = isExtended ? writer.addDimension(null, stationDimName, 0, true, true, false) :

0 commit comments

Comments
 (0)