public int writeProfile (StationProfileFeature spf, ProfileFeature profile) throws IOException { profile.resetIteration(); int count = 0; while (profile.hasNext()) { PointFeature pf = profile.next(); if (!headerDone) { if (id_strlen == 0) id_strlen = profile.getName().length() * 2; writeHeader(spf, profile, pf); headerDone = true; } writeObsData(pf); count++; } Integer stnIndex = stationIndexMap.get(spf.getName()); if (stnIndex == null) { System.out.printf("BAD station %s%n", spf.getName()); } else { writeProfileData(stnIndex, profile, count); } return count; }
public int writeProfile (ProfileFeature profile) throws IOException { profile.resetIteration(); int count = 0; while (profile.hasNext()) { PointFeature pf = profile.next(); if (!headerDone) { if (id_strlen == 0) id_strlen = profile.getName().length() * 2; writeHeader(profile, pf); headerDone = true; } writeObsData(pf); count++; } writeProfileData(profile, count); return count; }
public int writeProfile (SectionFeature section, ProfileFeature profile) throws IOException { profile.resetIteration(); int count = 0; while (profile.hasNext()) { PointFeature pf = profile.next(); if (!headerDone) { if (id_strlen == 0) id_strlen = profile.getName().length() * 2; writeHeader(section, profile, pf); headerDone = true; } writeObsData(pf); count++; } Integer sectionIndex = trajIndexMap.get(section.getName()); if (sectionIndex == null) { sectionIndex = writeSectionData(section); trajIndexMap.put(section.getName(), sectionIndex); } writeProfileData(sectionIndex, profile, count); return count; }
private static int writeProfileFeatureCollection(FeatureDatasetPoint fdpoint, ProfileFeatureCollection pds, String fileOut, NetcdfFileWriter.Version version) throws IOException { if (debug) System.out.printf("write to file %s%n ", fileOut); WriterCFProfileCollection writer = new WriterCFProfileCollection(fileOut, fdpoint.getGlobalAttributes(), version); int count = 0; List<String> profiles = new ArrayList<String>(); pds.resetIteration(); while (pds.hasNext()) { profiles.add(pds.next().getName()); } pds.resetIteration(); while (pds.hasNext()) { ucar.nc2.ft.ProfileFeature profile = pds.next(); profile.resetIteration(); while (profile.hasNext()) { ucar.nc2.ft.PointFeature pf = profile.next(); if (count == 0) { writer.writeHeader(profiles, fdpoint.getDataVariables(), pf.getTimeUnit(), null); // LOOK altitude units ?? } writer.writeRecord(profile.getName(), pf, pf.getData()); count++; if (debug && count % 100 == 0) System.out.printf("%d ", count); if (debug && count % 1000 == 0) System.out.printf("%n "); } } writer.finish(); return count; }