public Nimbus() {
this.conventionName = "NCAR-RAF/nimbus";
}
public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException {
ds.addAttribute(null, new Attribute("cdm_data_type", ucar.nc2.constants.FeatureType.TRAJECTORY.name()));
if (!setAxisType(ds, "LATC", AxisType.Lat))
if (!setAxisType(ds, "LAT", AxisType.Lat))
setAxisType(ds, "GGLAT", AxisType.Lat);
if (!setAxisType(ds, "LONC", AxisType.Lon))
if (!setAxisType(ds, "LON", AxisType.Lon))
setAxisType(ds, "GGLON", AxisType.Lon);
if (!setAxisType(ds, "PALT", AxisType.Height))
setAxisType(ds, "GGALT", AxisType.Height);
boolean hasTime = setAxisType(ds, "Time", AxisType.Time);
if (!hasTime)
hasTime = setAxisType(ds, "time", AxisType.Time);
// do we need to version this ?
// String version = ds.findAttValueIgnoreCase(null, "version", null);
if (!hasTime) {
Variable time = ds.findVariable("time_offset");
if (time != null) {
Variable base = ds.findVariable("base_time");
int base_time = base.readScalarInt();
try {
DateUnit dunit = new DateUnit("seconds since 1970-01-01 00:00");
String time_units = "seconds since " + dunit.makeStandardDateString(base_time);
time.addAttribute(new Attribute("units", time_units));
time.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Time.name()));
} catch (Exception e) {
e.printStackTrace();
}
}
}
// look for coordinates
String coordinates = ds.findAttValueIgnoreCase(null, "coordinates", null);
if (coordinates != null) {
String[] vars = coordinates.split(" ");
for (String vname : vars) {
Variable v = ds.findVariable(vname);
if (v != null) {
AxisType atype = getAxisType(ds, (VariableEnhanced) v);
if (atype != null)
v.addAttribute(new Attribute(_Coordinate.AxisType, atype.name()));
}
}
}
}