private void addCoordSystem(NetcdfDataset ds) throws IOException {
// int time = ds.findGlobalAttributeIgnoreCase("Time").getNumericValue().intValue();
double ele = 0;
Attribute attr = ds.findGlobalAttributeIgnoreCase("Elevation");
if( attr != null )
ele = attr.getNumericValue().doubleValue();
// ncml agg add this sweep variable as agg dimension
Variable sp = ds.findVariable("sweep");
if(sp == null) {
// add Elevation
ds.addDimension( null, new Dimension("Elevation", 1 , true));
String lName = "elevation angle in degres: 0 = parallel to pedestal base, 90 = perpendicular";
CoordinateAxis v = new CoordinateAxis1D(ds, null, "Elevation", DataType.DOUBLE, "Elevation", "degrees", lName);
ds.setValues(v, 1, ele, 0);
v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.RadialElevation.toString()));
ds.addVariable(null, v);
}
else {
Array spdata = sp.read();
float [] spd = (float [])spdata.get1DJavaArray(float.class);
int spsize = spd.length;
// add Elevation
ds.addDimension( null, new Dimension("Elevation", spsize , true));
String lName = "elevation angle in degres: 0 = parallel to pedestal base, 90 = perpendicular";
CoordinateAxis v = new CoordinateAxis1D(ds, null, "Elevation", DataType.DOUBLE, "Elevation", "degrees", lName);
//ds.setValues(v, (ArrayList)spdata);
v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.RadialElevation.toString()));
ds.addVariable(null, v);
}
ds.addAttribute( null, new Attribute("IsRadial", new Integer(1)));
attr = ds.findGlobalAttributeIgnoreCase("vcp-value");
String vcp;
if(attr == null)
vcp = "11";
else
vcp = attr.getStringValue();
ds.addAttribute( null, new Attribute("VolumeCoveragePatternName", vcp));
ds.finish();
}