legacy/src/main/java/ucar/nc2/dt/point/WriterCFStationObsDataset.java
public void writeRecord(StationObsDatatype sobs, StructureData sdata) throws IOException {
    if (debug) System.out.println("sobs= " + sobs + "; station = " + sobs.getStation());

    for (Variable v : recordVars) {
      if (timeName.equals(v.getShortName())) {
        Date d = sobs.getObservationTimeAsDate();
        int secs = (int) (d.getTime() / 1000);
        timeArray.set(0, secs);
      } else if (parentName.equals(v.getShortName())) {
        int stationIndex = stnList.indexOf(sobs.getStation());
        parentArray.set(0, stationIndex);
      } else {
        v.setCachedData(sdata.getArray(v.getShortName()), false);
      }
    }

    ncfile.writeRecordData(recordVars);
  }
public void writeRecord(StationObsDatatype sobs, StructureData sdata) throws IOException {
    if (debug) System.out.println("sobs= " + sobs + "; station = " + sobs.getStation());

    for (Variable v : recordVars) {
      if (timeName.equals(v.getShortName())) {
        Date d = sobs.getObservationTimeAsDate();
        int secs = (int) (d.getTime() / 1000);
        timeArray.set(0, secs);
      } else if (parentName.equals(v.getShortName())) {
        int stationIndex = stnList.indexOf(sobs.getStation());
        parentArray.set(0, stationIndex);
      } else {
        v.setCachedData(sdata.getArray(v.getShortName()), false);
      }
    }

    ncfile.writeRecordData(recordVars);
  }
public void writeRecord ( StationObsDatatype sobs , StructureData sdata ) throws IOException { if ( debug ) System . out . println ( "sobs= " + sobs + "; station = " + sobs . getStation ( ) ) ; for ( Variable v : recordVars ) { if ( timeName . equals ( v . getShortName ( ) ) ) { Date d = sobs . getObservationTimeAsDate ( ) ; int secs = ( int ) ( d . getTime ( ) / 1000 ) ; timeArray . set ( 0 , secs ) ; } else if ( parentName . equals ( v . getShortName ( ) ) ) { int stationIndex = stnList . indexOf ( sobs . getStation ( ) ) ; parentArray . set ( 0 , stationIndex ) ; } else { v . setCachedData ( sdata . getArray ( v . getShortName ( ) ) , false ) ; } } ncfile . writeRecordData ( recordVars ) ; }
/* private void writeDataFinish() throws IOException {
ArrayInt.D1 nextChildArray = new ArrayInt.D1(recno);

int nstns = stnList.size();
ArrayInt.D1 firstArray = new ArrayInt.D1(nstns);
ArrayInt.D1 lastArray = new ArrayInt.D1(nstns);
ArrayInt.D1 numArray = new ArrayInt.D1(nstns);

for (int i = 0; i < stnList.size(); i++) {
Station stn = stnList.get(i);
StationTracker tracker = stationMap.get(stn.getName());


lastArray.set(i, tracker.lastChild);
numArray.set(i, tracker.numChildren);

int first = (tracker.link.size() > 0) ? tracker.link.get(0) : -1;
firstArray.set(i, first);

if (tracker.link.size() > 0) {
construct forward link
List<Integer> nextList = tracker.link;
for (int j = 0; j < nextList.size() - 1; j++) {
Integer curr = nextList.get(j);
Integer next = nextList.get(j + 1);
nextChildArray.set(curr, next);
}
Integer curr = nextList.get(nextList.size() - 1);
nextChildArray.set(curr, -1);
}
}

try {
ncfile.write(firstChildName, firstArray);
ncfile.write(lastChildName, lastArray);
ncfile.write(numChildName, numArray);
ncfile.write(nextChildName, nextChildArray);

} catch (InvalidRangeException e) {
e.printStackTrace();
throw new IllegalStateException(e);
}

if there is no data
if (minDate == null) minDate = new Date();
if (maxDate == null) maxDate = new Date();

ncfile.updateAttribute(null, new Attribute("time_coverage_start", dateFormatter.toDateTimeStringISO(minDate)));
ncfile.updateAttribute(null, new Attribute("time_coverage_end", dateFormatter.toDateTimeStringISO(maxDate)));
}
/ * private void writeDataFinish () throws IOException { ArrayInt . D1 nextChildArray = new ArrayInt . D1 ( recno ) ;