visad/src/main/java/ucar/nc2/iosp/gempak/GempakSurfaceIOSP.java
private void buildStandardFile() {
    // Build station list
    List<GempakStation> stations = gemreader.getStations();
    //Trace.msg("GEMPAKSIOSP: now have " + stations.size() + " stations");
    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);


    List<Dimension> stationTime = new ArrayList<>();
    stationTime.add(station);
    stationTime.add(times);
    // TODO: handle other parts
    Structure sfData = makeStructure(GempakSurfaceFileReader.SFDT,
            stationTime, true);
    if (sfData == null) {
      return;
    }
    sfData.addAttribute(new Attribute(CF.COORDINATES, "time SLAT SLON SELV"));
    ncfile.addVariable(null, sfData);
    ncfile.addAttribute(
            null,
            new Attribute(
                    "CF:featureType",
                    CF.FeatureType.timeSeries.toString()));
  }
private void buildStandardFile() {
    // Build station list
    List<GempakStation> stations = gemreader.getStations();
    //Trace.msg("GEMPAKSIOSP: now have " + stations.size() + " stations");
    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);


    List<Dimension> stationTime = new ArrayList<>();
    stationTime.add(station);
    stationTime.add(times);
    // TODO: handle other parts
    Structure sfData = makeStructure(GempakSurfaceFileReader.SFDT,
            stationTime, true);
    if (sfData == null) {
      return;
    }
    sfData.addAttribute(new Attribute(CF.COORDINATES, "time SLAT SLON SELV"));
    ncfile.addVariable(null, sfData);
    ncfile.addAttribute(
            null,
            new Attribute(
                    "CF:featureType",
                    CF.FeatureType.timeSeries.toString()));
  }
private void buildStandardFile ( ) { // Build station list
 List < GempakStation > stations = gemreader . getStations ( ) ; //Trace.msg("GEMPAKSIOSP: now have " + stations.size() + " stations");
 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 ) ; List < Dimension > stationTime = new ArrayList <> ( ) ; stationTime . add ( station ) ; stationTime . add ( times ) ; // TODO: handle other parts
 Structure sfData = makeStructure ( GempakSurfaceFileReader . SFDT , stationTime , true ) ; if ( sfData == null ) { return ; } sfData . addAttribute ( new Attribute ( CF . COORDINATES , "time SLAT SLON SELV" ) ) ; ncfile . addVariable ( null , sfData ) ; ncfile . addAttribute ( null , new Attribute ( "CF:featureType" , CF . FeatureType . timeSeries . toString ( ) ) ) ; }
Build a standard station structure
Build a standard station structure