grib/src/main/java/ucar/nc2/grib/collection/GribIosp.java
private void makeTimeCoordinate2D(NetcdfFile ncfile, Group g, CoordinateTime2D time2D,
      GribCollectionImmutable.Type gctype) {
    CoordinateRuntime runtime = time2D.getRuntimeCoordinate();

    int ntimes = time2D.getNtimes();
    String tcName = time2D.getName();
    String dims = runtime.getName() + " " + tcName;
    int dimLength = ntimes;

    ncfile.addDimension(g, new Dimension(tcName, dimLength));
    Variable v = ncfile
        .addVariable(g, new Variable(ncfile, g, null, tcName, DataType.DOUBLE, dims));
    String units = runtime.getUnit(); // + " since " + runtime.getFirstDate();
    v.addAttribute(new Attribute(CDM.UNITS, units));
    v.addAttribute(new Attribute(CF.STANDARD_NAME, CF.TIME));
    v.addAttribute(new Attribute(CDM.LONG_NAME, Grib.GRIB_VALID_TIME));
    v.addAttribute(new Attribute(CF.CALENDAR, Calendar.proleptic_gregorian.toString()));

    // the data is not generated until asked for to save space
    if (!time2D.isTimeInterval()) {
      v.setSPobject(new Time2Dinfo(Time2DinfoType.off, time2D, null));
    } else {
      v.setSPobject(new Time2Dinfo(Time2DinfoType.intv, time2D, null));
      // bounds for intervals
      String bounds_name = tcName + "_bounds";
      Variable bounds = ncfile
          .addVariable(g, new Variable(ncfile, g, null, bounds_name, DataType.DOUBLE, dims + " 2"));
      v.addAttribute(new Attribute(CF.BOUNDS, bounds_name));
      bounds.addAttribute(new Attribute(CDM.UNITS, units));
      bounds.addAttribute(new Attribute(CDM.LONG_NAME, "bounds for " + tcName));
      bounds.setSPobject(new Time2Dinfo(Time2DinfoType.bounds, time2D, null));
    }

  }
private void makeTimeCoordinate2D(NetcdfFile ncfile, Group g, CoordinateTime2D time2D,
      GribCollectionImmutable.Type gctype) {
    CoordinateRuntime runtime = time2D.getRuntimeCoordinate();

    int ntimes = time2D.getNtimes();
    String tcName = time2D.getName();
    String dims = runtime.getName() + " " + tcName;
    int dimLength = ntimes;

    ncfile.addDimension(g, new Dimension(tcName, dimLength));
    Variable v = ncfile
        .addVariable(g, new Variable(ncfile, g, null, tcName, DataType.DOUBLE, dims));
    String units = runtime.getUnit(); // + " since " + runtime.getFirstDate();
    v.addAttribute(new Attribute(CDM.UNITS, units));
    v.addAttribute(new Attribute(CF.STANDARD_NAME, CF.TIME));
    v.addAttribute(new Attribute(CDM.LONG_NAME, Grib.GRIB_VALID_TIME));
    v.addAttribute(new Attribute(CF.CALENDAR, Calendar.proleptic_gregorian.toString()));

    // the data is not generated until asked for to save space
    if (!time2D.isTimeInterval()) {
      v.setSPobject(new Time2Dinfo(Time2DinfoType.off, time2D, null));
    } else {
      v.setSPobject(new Time2Dinfo(Time2DinfoType.intv, time2D, null));
      // bounds for intervals
      String bounds_name = tcName + "_bounds";
      Variable bounds = ncfile
          .addVariable(g, new Variable(ncfile, g, null, bounds_name, DataType.DOUBLE, dims + " 2"));
      v.addAttribute(new Attribute(CF.BOUNDS, bounds_name));
      bounds.addAttribute(new Attribute(CDM.UNITS, units));
      bounds.addAttribute(new Attribute(CDM.LONG_NAME, "bounds for " + tcName));
      bounds.setSPobject(new Time2Dinfo(Time2DinfoType.bounds, time2D, null));
    }

  }
private void makeTimeCoordinate2D ( NetcdfFile ncfile , Group g , CoordinateTime2D time2D , GribCollectionImmutable . Type gctype ) { CoordinateRuntime runtime = time2D . getRuntimeCoordinate ( ) ; int ntimes = time2D . getNtimes ( ) ; String tcName = time2D . getName ( ) ; String dims = runtime . getName ( ) + " " + tcName ; int dimLength = ntimes ; ncfile . addDimension ( g , new Dimension ( tcName , dimLength ) ) ; Variable v = ncfile . addVariable ( g , new Variable ( ncfile , g , null , tcName , DataType . DOUBLE , dims ) ) ; String units = runtime . getUnit ( ) ; // + " since " + runtime.getFirstDate(); v . addAttribute ( new Attribute ( CDM . UNITS , units ) ) ; v . addAttribute ( new Attribute ( CF . STANDARD_NAME , CF . TIME ) ) ; v . addAttribute ( new Attribute ( CDM . LONG_NAME , Grib . GRIB_VALID_TIME ) ) ; v . addAttribute ( new Attribute ( CF . CALENDAR , Calendar . proleptic_gregorian . toString ( ) ) ) ; // the data is not generated until asked for to save space if ( ! time2D . isTimeInterval ( ) ) { v . setSPobject ( new Time2Dinfo ( Time2DinfoType . off , time2D , null ) ) ; } else { v . setSPobject ( new Time2Dinfo ( Time2DinfoType . intv , time2D , null ) ) ; // bounds for intervals String bounds_name = tcName + "_bounds" ; Variable bounds = ncfile . addVariable ( g , new Variable ( ncfile , g , null , bounds_name , DataType . DOUBLE , dims + " 2" ) ) ; v . addAttribute ( new Attribute ( CF . BOUNDS , bounds_name ) ) ; bounds . addAttribute ( new Attribute ( CDM . UNITS , units ) ) ; bounds . addAttribute ( new Attribute ( CDM . LONG_NAME , "bounds for " + tcName ) ) ; bounds . setSPobject ( new Time2Dinfo ( Time2DinfoType . bounds , time2D , null ) ) ; } }
/* non unique time case
3) time(nruns, ntimes) with reftime(nruns)
/ * non unique time case 3 ) time ( nruns ntimes ) with reftime ( nruns )