protected void makeFeatureVariables(StructureData featureData, boolean isExtended) throws IOException { // LOOK why not unlimited here ? Dimension profileDim = writer.addDimension(null, profileDimName, nfeatures); // Dimension profileDim = isExtendedModel ? writer.addUnlimitedDimension(profileDimName) : // writer.addDimension(null, profileDimName, nprofiles); // add the profile Variables using the profile dimension List<VariableSimpleIF> profileVars = new ArrayList<>(); profileVars.add( VariableSimpleImpl.makeScalar(latName, "profile latitude", CDM.LAT_UNITS, DataType.DOUBLE)); profileVars.add( VariableSimpleImpl.makeScalar( lonName, "profile longitude", CDM.LON_UNITS, DataType.DOUBLE)); profileVars.add( VariableSimpleImpl.makeString(profileIdName, "profile identifier", null, id_strlen) .add(new Attribute(CF.CF_ROLE, CF.PROFILE_ID))); // profileId:cf_role = "profile_id"; profileVars.add( VariableSimpleImpl.makeScalar( numberOfObsName, "number of obs for this profile", null, DataType.INT) .add( new Attribute( CF.SAMPLE_DIMENSION, recordDimName))); // rowSize:sample_dimension = "obs" profileVars.add( VariableSimpleImpl.makeScalar( profileTimeName, "nominal time of profile", timeUnit.getUnitsString(), DataType.DOUBLE)); for (StructureMembers.Member m : featureData.getMembers()) { VariableSimpleIF dv = getDataVar(m.getName()); if (dv != null) profileVars.add(dv); } if (isExtended) { profileStruct = (Structure) writer.addVariable(null, profileStructName, DataType.STRUCTURE, profileDimName); addCoordinatesExtended(profileStruct, profileVars); } else { addCoordinatesClassic(profileDim, profileVars, featureVarMap); } }
private void writeHeader(ProfileFeature profile, PointFeature obs) throws IOException { Formatter coordNames = new Formatter().format("%s %s %s", profileTimeName, latName, lonName); List<VariableSimpleIF> coords = new ArrayList<>(); if (useAlt) { coords.add( VariableSimpleImpl.makeScalar( altitudeCoordinateName, "obs altitude", altUnits, DataType.DOUBLE) .add(new Attribute(CF.STANDARD_NAME, "altitude")) .add( new Attribute( CF.POSITIVE, CF1Convention.getZisPositive(altitudeCoordinateName, altUnits)))); coordNames.format(" %s", altitudeCoordinateName); } super.writeHeader( coords, profile.getFeatureData(), obs.getFeatureData(), coordNames.toString()); }