legacy/src/main/java/ucar/nc2/dt/point/WriterCFPointDataset.java
private void createRecordVariables(List<? extends VariableSimpleIF> dataVars) {

    ncfileOut.addDimension(null, new Dimension(recordDimName, 0, true, true, false));

    // time variable
    Variable timeVar = ncfileOut.addVariable(null, timeName, DataType.DOUBLE, recordDimName);
    timeVar.addAttribute(new Attribute(CDM.UNITS, "secs since 1970-01-01 00:00:00"));
    timeVar.addAttribute(new Attribute(CDM.LONG_NAME, "date/time of observation"));
    recordVars.add(timeVar);

    // latitude variable
    Variable latVar = ncfileOut.addVariable(null, latName, DataType.DOUBLE, recordDimName);
    latVar.addAttribute(new Attribute(CDM.UNITS, "degrees_north"));
    latVar.addAttribute(new Attribute(CDM.LONG_NAME, "latitude of observation"));
    latVar.addAttribute(new Attribute("standard_name", "latitude"));
    recordVars.add(latVar);

    // longitude variable
    Variable lonVar = ncfileOut.addVariable(null, lonName, DataType.DOUBLE, recordDimName);
    lonVar.addAttribute(new Attribute(CDM.UNITS, "degrees_east"));
    lonVar.addAttribute(new Attribute(CDM.LONG_NAME, "longitude of observation"));
    lonVar.addAttribute(new Attribute("standard_name", "longitude"));
    recordVars.add(lonVar);

    if (useAlt) {
      // altitude variable
      Variable altVar = ncfileOut.addVariable(null, altName, DataType.DOUBLE, recordDimName);
      altVar.addAttribute(new Attribute(CDM.UNITS, altUnits));
      altVar.addAttribute(new Attribute(CDM.LONG_NAME, "altitude of observation"));
      altVar.addAttribute(new Attribute("standard_name", "longitude"));
      altVar.addAttribute(new Attribute(CF.POSITIVE, CF1Convention.getZisPositive(altName, altUnits)));
      recordVars.add(altVar);
    }

    String coordinates = timeName + " " + latName + " " + lonName;
    if (useAlt) coordinates = coordinates + " " + altName;
    Attribute coordAtt = new Attribute(CF.COORDINATES, coordinates);

    // find all dimensions needed by the data variables
    for (VariableSimpleIF var : dataVars) {
      List<Dimension> dims = var.getDimensions();
      dimSet.addAll(dims);
    }

    // add them
    for (Dimension d : dimSet) {
      if (isExtraDimension(d))
        ncfileOut.addDimension(null, new Dimension(d.getShortName(), d.getLength(), true, false, d.isVariableLength()));
    }

    // add the data variables all using the record dimension
    for (VariableSimpleIF oldVar : dataVars) {
      if (ncfileOut.findVariable(oldVar.getShortName()) != null) continue;
      List<Dimension> dims = oldVar.getDimensions();
      StringBuilder dimNames = new StringBuilder(recordDimName);
      for (Dimension d : dims) {
        if (isExtraDimension(d))
          dimNames.append(" ").append(d.getShortName());
      }
      Variable newVar = ncfileOut.addVariable(null, oldVar.getShortName(), oldVar.getDataType(), dimNames.toString());
      recordVars.add(newVar);

      List<Attribute> atts = oldVar.getAttributes();
      for (Attribute att : atts)
        newVar.addAttribute(att);
      newVar.addAttribute(coordAtt);
    }

  }
private void createRecordVariables(List<? extends VariableSimpleIF> dataVars) {

    ncfileOut.addDimension(null, new Dimension(recordDimName, 0, true, true, false));

    // time variable
    Variable timeVar = ncfileOut.addVariable(null, timeName, DataType.DOUBLE, recordDimName);
    timeVar.addAttribute(new Attribute(CDM.UNITS, "secs since 1970-01-01 00:00:00"));
    timeVar.addAttribute(new Attribute(CDM.LONG_NAME, "date/time of observation"));
    recordVars.add(timeVar);

    // latitude variable
    Variable latVar = ncfileOut.addVariable(null, latName, DataType.DOUBLE, recordDimName);
    latVar.addAttribute(new Attribute(CDM.UNITS, "degrees_north"));
    latVar.addAttribute(new Attribute(CDM.LONG_NAME, "latitude of observation"));
    latVar.addAttribute(new Attribute("standard_name", "latitude"));
    recordVars.add(latVar);

    // longitude variable
    Variable lonVar = ncfileOut.addVariable(null, lonName, DataType.DOUBLE, recordDimName);
    lonVar.addAttribute(new Attribute(CDM.UNITS, "degrees_east"));
    lonVar.addAttribute(new Attribute(CDM.LONG_NAME, "longitude of observation"));
    lonVar.addAttribute(new Attribute("standard_name", "longitude"));
    recordVars.add(lonVar);

    if (useAlt) {
      // altitude variable
      Variable altVar = ncfileOut.addVariable(null, altName, DataType.DOUBLE, recordDimName);
      altVar.addAttribute(new Attribute(CDM.UNITS, altUnits));
      altVar.addAttribute(new Attribute(CDM.LONG_NAME, "altitude of observation"));
      altVar.addAttribute(new Attribute("standard_name", "longitude"));
      altVar.addAttribute(new Attribute(CF.POSITIVE, CF1Convention.getZisPositive(altName, altUnits)));
      recordVars.add(altVar);
    }

    String coordinates = timeName + " " + latName + " " + lonName;
    if (useAlt) coordinates = coordinates + " " + altName;
    Attribute coordAtt = new Attribute(CF.COORDINATES, coordinates);

    // find all dimensions needed by the data variables
    for (VariableSimpleIF var : dataVars) {
      List<Dimension> dims = var.getDimensions();
      dimSet.addAll(dims);
    }

    // add them
    for (Dimension d : dimSet) {
      if (isExtraDimension(d))
        ncfileOut.addDimension(null, new Dimension(d.getShortName(), d.getLength(), true, false, d.isVariableLength()));
    }

    // add the data variables all using the record dimension
    for (VariableSimpleIF oldVar : dataVars) {
      if (ncfileOut.findVariable(oldVar.getShortName()) != null) continue;
      List<Dimension> dims = oldVar.getDimensions();
      StringBuilder dimNames = new StringBuilder(recordDimName);
      for (Dimension d : dims) {
        if (isExtraDimension(d))
          dimNames.append(" ").append(d.getShortName());
      }
      Variable newVar = ncfileOut.addVariable(null, oldVar.getShortName(), oldVar.getDataType(), dimNames.toString());
      recordVars.add(newVar);

      List<Attribute> atts = oldVar.getAttributes();
      for (Attribute att : atts)
        newVar.addAttribute(att);
      newVar.addAttribute(coordAtt);
    }

  }
private void createRecordVariables ( List < ? extends VariableSimpleIF > dataVars ) { ncfileOut . addDimension ( null , new Dimension ( recordDimName , 0 , true , true , false ) ) ; // time variable Variable timeVar = ncfileOut . addVariable ( null , timeName , DataType . DOUBLE , recordDimName ) ; timeVar . addAttribute ( new Attribute ( CDM . UNITS , "secs since 1970-01-01 00:00:00" ) ) ; timeVar . addAttribute ( new Attribute ( CDM . LONG_NAME , "date/time of observation" ) ) ; recordVars . add ( timeVar ) ; // latitude variable Variable latVar = ncfileOut . addVariable ( null , latName , DataType . DOUBLE , recordDimName ) ; latVar . addAttribute ( new Attribute ( CDM . UNITS , "degrees_north" ) ) ; latVar . addAttribute ( new Attribute ( CDM . LONG_NAME , "latitude of observation" ) ) ; latVar . addAttribute ( new Attribute ( "standard_name" , "latitude" ) ) ; recordVars . add ( latVar ) ; // longitude variable Variable lonVar = ncfileOut . addVariable ( null , lonName , DataType . DOUBLE , recordDimName ) ; lonVar . addAttribute ( new Attribute ( CDM . UNITS , "degrees_east" ) ) ; lonVar . addAttribute ( new Attribute ( CDM . LONG_NAME , "longitude of observation" ) ) ; lonVar . addAttribute ( new Attribute ( "standard_name" , "longitude" ) ) ; recordVars . add ( lonVar ) ; if ( useAlt ) { // altitude variable Variable altVar = ncfileOut . addVariable ( null , altName , DataType . DOUBLE , recordDimName ) ; altVar . addAttribute ( new Attribute ( CDM . UNITS , altUnits ) ) ; altVar . addAttribute ( new Attribute ( CDM . LONG_NAME , "altitude of observation" ) ) ; altVar . addAttribute ( new Attribute ( "standard_name" , "longitude" ) ) ; altVar . addAttribute ( new Attribute ( CF . POSITIVE , CF1Convention . getZisPositive ( altName , altUnits ) ) ) ; recordVars . add ( altVar ) ; } String coordinates = timeName + " " + latName + " " + lonName ; if ( useAlt ) coordinates = coordinates + " " + altName ; Attribute coordAtt = new Attribute ( CF . COORDINATES , coordinates ) ; // find all dimensions needed by the data variables for ( VariableSimpleIF var : dataVars ) { List < Dimension > dims = var . getDimensions ( ) ; dimSet . addAll ( dims ) ; } // add them for ( Dimension d : dimSet ) { if ( isExtraDimension ( d ) ) ncfileOut . addDimension ( null , new Dimension ( d . getShortName ( ) , d . getLength ( ) , true , false , d . isVariableLength ( ) ) ) ; } // add the data variables all using the record dimension for ( VariableSimpleIF oldVar : dataVars ) { if ( ncfileOut . findVariable ( oldVar . getShortName ( ) ) != null ) continue ; List < Dimension > dims = oldVar . getDimensions ( ) ; StringBuilder dimNames = new StringBuilder ( recordDimName ) ; for ( Dimension d : dims ) { if ( isExtraDimension ( d ) ) dimNames . append ( " " ) . append ( d . getShortName ( ) ) ; } Variable newVar = ncfileOut . addVariable ( null , oldVar . getShortName ( ) , oldVar . getDataType ( ) , dimNames . toString ( ) ) ; recordVars . add ( newVar ) ; List < Attribute > atts = oldVar . getAttributes ( ) ; for ( Attribute att : atts ) newVar . addAttribute ( att ) ; newVar . addAttribute ( coordAtt ) ; } }
private ArrayInt.D1 parentArray = new ArrayInt.D1(1);
private ArrayInt . D1 parentArray = new ArrayInt . D1 ( 1 ) ;