} */
static void readFromNetcdf(String filename) throws IOException {
long start = System.currentTimeMillis();
NetcdfFile ncfile = NetcdfFile.open(filename);
ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);
Structure record = (Structure) ncfile.findVariable("record");
List<Variable> members = record.getVariables();
for (Variable v : members) {
if (v.getDataType() != DataType.CHAR)
new MetarField(v.getShortName());
}
StructureDataIterator siter = record.getStructureIterator();
int count = 0;
while (siter.hasNext()) {
StructureData sdata = siter.next();
List<StructureMembers.Member> sm = sdata.getMembers();
for (StructureMembers.Member m : sm) {
MetarField f = MetarField.fields.get(m.getName());
if (null != f) f.sum( sdata, m);
}
count++;
}
System.out.println("Read from NetCDF; # metars= " + count);
double took = .001 * (System.currentTimeMillis() - start);
System.out.println(" that took = " + took + " sec; "+ Format.d(count/took,0)+" metars/sec");
for (MetarField f : MetarField.fields.values())
System.out.println(" "+f.name+ " = "+f.sum);
ncfile.close();
}