visad/src/main/java/ucar/nc2/iosp/gempak/GempakSoundingIOSP.java
private void buildFile(boolean isMerged) {

    // Build station list
    List<GempakStation> stations = gemreader.getStations();
    Dimension station = new Dimension("station", stations.size(), true);
    ncfile.addDimension(null, station);
    ncfile.addDimension(null, DIM_LEN8);
    ncfile.addDimension(null, DIM_LEN4);
    ncfile.addDimension(null, DIM_LEN2);
    List<Variable> stationVars = makeStationVars(stations, station);
    // loop through and add to ncfile
    for (Variable stnVar : stationVars) {
      ncfile.addVariable(null, stnVar);
    }


    // Build variable list (var(station,time))
    // time
    List<Date> timeList = gemreader.getDates();
    int numTimes = timeList.size();
    Dimension times = new Dimension(TIME_VAR, numTimes, true);
    ncfile.addDimension(null, times);
    Array varArray;
    Variable timeVar = new Variable(ncfile, null, null, TIME_VAR, DataType.DOUBLE, TIME_VAR);
    timeVar.addAttribute(new Attribute(CDM.UNITS, "seconds since 1970-01-01 00:00:00"));
    timeVar.addAttribute(new Attribute("long_name", TIME_VAR));
    varArray = new ArrayDouble.D1(numTimes);
    int i = 0;
    for (Date date : timeList) {
      ((ArrayDouble.D1) varArray).set(i, date.getTime() / 1000.d);
      i++;
    }
    timeVar.setCachedData(varArray, false);
    ncfile.addVariable(null, timeVar);


    // build the data structure
    List<Dimension> stationTime = new ArrayList<>();
    stationTime.add(station);
    stationTime.add(times);
    String structName = (isMerged) ? GempakSoundingFileReader.MERGED : GempakSoundingFileReader.UNMERGED;
    structName = structName + "Sounding";
    Structure sVar = new Structure(ncfile, null, null, structName);
    sVar.setDimensions(stationTime);
    sVar.addAttribute(new Attribute(CF.COORDINATES, "time SLAT SLON SELV"));
    List<String> sequenceNames;
    if (isMerged) {
      sequenceNames = new ArrayList<>();
      sequenceNames.add(GempakSoundingFileReader.SNDT);
    } else {
      sequenceNames = ((GempakSoundingFileReader) gemreader).getUnmergedParts();
    }
    for (String seqName : sequenceNames) {
      Sequence paramData = makeSequence(sVar, seqName, false);
      if (paramData == null) {
        continue;
      }
      sVar.addMemberVariable(paramData);
    }
    sVar.addMemberVariable(makeMissingVariable());
    ncfile.addAttribute(null, new Attribute("CF:featureType", CF.FeatureType.timeSeriesProfile.toString()));
    ncfile.addVariable(null, sVar);
  }
private void buildFile(boolean isMerged) {

    // Build station list
    List<GempakStation> stations = gemreader.getStations();
    Dimension station = new Dimension("station", stations.size(), true);
    ncfile.addDimension(null, station);
    ncfile.addDimension(null, DIM_LEN8);
    ncfile.addDimension(null, DIM_LEN4);
    ncfile.addDimension(null, DIM_LEN2);
    List<Variable> stationVars = makeStationVars(stations, station);
    // loop through and add to ncfile
    for (Variable stnVar : stationVars) {
      ncfile.addVariable(null, stnVar);
    }


    // Build variable list (var(station,time))
    // time
    List<Date> timeList = gemreader.getDates();
    int numTimes = timeList.size();
    Dimension times = new Dimension(TIME_VAR, numTimes, true);
    ncfile.addDimension(null, times);
    Array varArray;
    Variable timeVar = new Variable(ncfile, null, null, TIME_VAR, DataType.DOUBLE, TIME_VAR);
    timeVar.addAttribute(new Attribute(CDM.UNITS, "seconds since 1970-01-01 00:00:00"));
    timeVar.addAttribute(new Attribute("long_name", TIME_VAR));
    varArray = new ArrayDouble.D1(numTimes);
    int i = 0;
    for (Date date : timeList) {
      ((ArrayDouble.D1) varArray).set(i, date.getTime() / 1000.d);
      i++;
    }
    timeVar.setCachedData(varArray, false);
    ncfile.addVariable(null, timeVar);


    // build the data structure
    List<Dimension> stationTime = new ArrayList<>();
    stationTime.add(station);
    stationTime.add(times);
    String structName = (isMerged) ? GempakSoundingFileReader.MERGED : GempakSoundingFileReader.UNMERGED;
    structName = structName + "Sounding";
    Structure sVar = new Structure(ncfile, null, null, structName);
    sVar.setDimensions(stationTime);
    sVar.addAttribute(new Attribute(CF.COORDINATES, "time SLAT SLON SELV"));
    List<String> sequenceNames;
    if (isMerged) {
      sequenceNames = new ArrayList<>();
      sequenceNames.add(GempakSoundingFileReader.SNDT);
    } else {
      sequenceNames = ((GempakSoundingFileReader) gemreader).getUnmergedParts();
    }
    for (String seqName : sequenceNames) {
      Sequence paramData = makeSequence(sVar, seqName, false);
      if (paramData == null) {
        continue;
      }
      sVar.addMemberVariable(paramData);
    }
    sVar.addMemberVariable(makeMissingVariable());
    ncfile.addAttribute(null, new Attribute("CF:featureType", CF.FeatureType.timeSeriesProfile.toString()));
    ncfile.addVariable(null, sVar);
  }
private void buildFile ( boolean isMerged ) { // Build station list
 List < GempakStation > stations = gemreader . getStations ( ) ; Dimension station = new Dimension ( "station" , stations . size ( ) , true ) ; ncfile . addDimension ( null , station ) ; ncfile . addDimension ( null , DIM_LEN8 ) ; ncfile . addDimension ( null , DIM_LEN4 ) ; ncfile . addDimension ( null , DIM_LEN2 ) ; List < Variable > stationVars = makeStationVars ( stations , station ) ; // loop through and add to ncfile
 for ( Variable stnVar : stationVars ) { ncfile . addVariable ( null , stnVar ) ; } // Build variable list (var(station,time))
 // time
 List < Date > timeList = gemreader . getDates ( ) ; int numTimes = timeList . size ( ) ; Dimension times = new Dimension ( TIME_VAR , numTimes , true ) ; ncfile . addDimension ( null , times ) ; Array varArray ; Variable timeVar = new Variable ( ncfile , null , null , TIME_VAR , DataType . DOUBLE , TIME_VAR ) ; timeVar . addAttribute ( new Attribute ( CDM . UNITS , "seconds since 1970-01-01 00:00:00" ) ) ; timeVar . addAttribute ( new Attribute ( "long_name" , TIME_VAR ) ) ; varArray = new ArrayDouble . D1 ( numTimes ) ; int i = 0 ; for ( Date date : timeList ) { ( ( ArrayDouble . D1 ) varArray ) . set ( i , date . getTime ( ) / 1000.d ) ; i ++ ; } timeVar . setCachedData ( varArray , false ) ; ncfile . addVariable ( null , timeVar ) ; // build the data structure
 List < Dimension > stationTime = new ArrayList <> ( ) ; stationTime . add ( station ) ; stationTime . add ( times ) ; String structName = ( isMerged ) ? GempakSoundingFileReader . MERGED : GempakSoundingFileReader . UNMERGED ; structName = structName + "Sounding" ; Structure sVar = new Structure ( ncfile , null , null , structName ) ; sVar . setDimensions ( stationTime ) ; sVar . addAttribute ( new Attribute ( CF . COORDINATES , "time SLAT SLON SELV" ) ) ; List < String > sequenceNames ; if ( isMerged ) { sequenceNames = new ArrayList <> ( ) ; sequenceNames . add ( GempakSoundingFileReader . SNDT ) ; } else { sequenceNames = ( ( GempakSoundingFileReader ) gemreader ) . getUnmergedParts ( ) ; } for ( String seqName : sequenceNames ) { Sequence paramData = makeSequence ( sVar , seqName , false ) ; if ( paramData == null ) { continue ; } sVar . addMemberVariable ( paramData ) ; } sVar . addMemberVariable ( makeMissingVariable ( ) ) ; ncfile . addAttribute ( null , new Attribute ( "CF:featureType" , CF . FeatureType . timeSeriesProfile . toString ( ) ) ) ; ncfile . addVariable ( null , sVar ) ; }
Build a standard station structure

@param isMerged true if this is a merged file
Build a standard station structure