public HDF4ProductFieldType( final Name name, final InternationalString description, final SimpleScalarAxis axis, final SampleDimension sd) { this(name, description, sd.getUnits(), axis, sd); }
/** * Encodes the RangeType as per the GML spec of the provided {@link GridCoverage2D} * * <p>e.g.: * * <pre>{@code * <gmlcov:rangeType> * <swe:DataRecord> * <swe:field name="singleBand"> * <swe:Quantity definition="http://www.opengis.net/def/property/OGC/0/Radiance"> * <gml:description>Panchromatic Channel</gml:description> * <gml:name>single band</gml:name> * <swe:uom code="W/cm2"/> * <swe:constraint> * <swe:AllowedValues> * <swe:interval>0 255</swe:interval> * <swe:significantFigures>3</swe:significantFigures> * </swe:AllowedValues> * </swe:constraint> * </swe:Quantity> * </swe:field> * </swe:DataRecord> * </gmlcov:rangeType> * }</pre> * * @param gc2d the {@link GridCoverage2D} for which to encode the RangeType. */ public void handleRangeType(GridCoverage2D gc2d) { start("gml:rangeType"); start("swe:DataRecord"); // get bands final SampleDimension[] bands = gc2d.getSampleDimensions(); // handle bands for (SampleDimension sd : bands) { final AttributesImpl fieldAttr = new AttributesImpl(); fieldAttr.addAttribute( "", "name", "name", "", sd.getDescription().toString()); // TODO NCNAME? TODO Use Band[i] convention? start("swe:field", fieldAttr); start("swe:Quantity"); // Description start("swe:description"); chars(sd.getDescription().toString()); // TODO can we make up something better?? end("swe:description"); // UoM final AttributesImpl uomAttr = new AttributesImpl(); final Unit<?> uom = sd.getUnits(); uomAttr.addAttribute( "", "code", "code", "", uom == null ? "W.m-2.Sr-1" : UnitFormat.getInstance().format(uom)); start("swe:uom", uomAttr); end("swe:uom"); // constraint on values start("swe:constraint"); start("swe:AllowedValues"); handleSampleDimensionRange(sd); // TODO make this generic end("swe:AllowedValues"); end("swe:constraint"); // nil values handleSampleDimensionNilValues(gc2d, sd.getNoDataValues()); end("swe:Quantity"); end("swe:field"); } end("swe:DataRecord"); end("gml:rangeType"); }