try {
epoch = (Date) NetCDFUtilities.getAxisFormat(type, origin).parseObject(origin);
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(epoch);
DefaultInstant instant = new DefaultInstant(new DefaultPosition(cal.getTime()));
t_originDate = instant.getPosition().getDateTime().toString();
} catch (ParseException e) {
throw new IllegalArgumentException(e);
// TODO: Change the handle this exception
}
}
}
String axisName = timeAxis.getShortName();
String t_csName = "time_CS";
final Map<String, String> csMap = Collections.singletonMap("name", t_csName);
final TimeCS timeCS = NetCDFCRSUtilities.FACTORY_CONTAINER.getCSFactory().createTimeCS(csMap, getAxis(axisName, getDirection(direction), units));
// Creating the Temporal Datum
if (t_datumName == null) {
t_datumName = "Unknown";
}
final Map<String, String> datumMap = Collections.singletonMap("name", t_datumName);
final Position timeOrigin = new DefaultPosition(new SimpleInternationalString(t_originDate));
final TemporalDatum temporalDatum = NetCDFCRSUtilities.FACTORY_CONTAINER.getDatumFactory().createTemporalDatum(datumMap, timeOrigin.getDate());
// Finally creating the Temporal CoordinateReferenceSystem
String crsName = "time_CRS";
final Map<String, String> crsMap = Collections.singletonMap("name", crsName);
temporalCRS = NetCDFCRSUtilities.FACTORY_CONTAINER.getCRSFactory().createTemporalCRS(crsMap, temporalDatum, timeCS);