/** * A copy constructor using a ucar.unidata.util.Parameter. Need to do this so ucar.unidata.geoloc * package doesnt depend on ucar.nc2 library * * @param param copy info from here. */ public Attribute(ucar.unidata.util.Parameter param) { this.name = param.getName(); if (param.isString()) { setStringValue(param.getStringValue()); } else { double[] values = param.getNumericValues(); int n = values.length; Array vala = Array.factory(DataType.DOUBLE.getPrimitiveClassType(), new int[] {n}, values); setValues(vala); } }
/** * Create a String-valued Attribute. * * @param name name of Attribute * @param val value of Attribute */ public Attribute(String name, String val) { this.name = name; setStringValue(val); }