}
catch ( ParseException e )
{
throw new IOException( "Invalid DMSP file: start date/time string <" + startDateTimeUTC + "> not parseable: " + e.getMessage() );
}
this.startDateAtt = new Attribute( this.startDateAttName,
DateFormatHandler.ISO_DATE_TIME.getDateTimeStringFromDate( this.startDate));
// Read the end date UTC information.
time = (String) headerInfo.get( HeaderInfoTitle.END_TIME_UTC.toString());
String endDateTimeUTC = (String) headerInfo.get( HeaderInfoTitle.END_DATE_UTC.toString())
+ "T" + time.substring( 0, time.indexOf( '.')+4)
+ "GMT";
try
{
this.endDate = DateFormatHandler.ISO_DATE_TIME.getDateFromDateTimeString( endDateTimeUTC);
}
catch ( ParseException e )
{
throw new IOException( "Invalid DMSP file: end date/time string <" + endDateTimeUTC + "> not parseable: " + e.getMessage() );
}
this.endDateAtt = new Attribute( this.endDateAttName,
DateFormatHandler.ISO_DATE_TIME.getDateTimeStringFromDate( this.endDate));
// Read the local start/end date/time
this.startDateLocalAtt = new Attribute( this.startDateLocalAttName,
(String) HeaderInfoTitle.START_DATE_LOCAL.toString());
this.startTimeLocalAtt = new Attribute( this.startTimeLocalAttName,
(String) HeaderInfoTitle.START_TIME_LOCAL.toString());
// Read the start latitude/longitude information.
String startLatLon = (String) headerInfo.get( HeaderInfoTitle.START_LAT_LON.toString());
String[] latLon = startLatLon.split( " ");
Double lat, lon;
if ( latLon.length != 2) throw new IOException( "Invalid DMSP file: start lat/lon <" + startLatLon + "> invalid.");
try
{
lat = Double.valueOf( latLon[0]);
lon = Double.valueOf( latLon[1]);
}
catch ( NumberFormatException e )
{
throw new IOException( "Invalid DMSP file: start lat/lon string <" + startLatLon + "> not parseable: " + e.getMessage() );
}
this.startLatitudeAtt = new Attribute( this.startLatitudeAttName, lat);
this.startLongitudeAtt = new Attribute( this.startLongitudeAttName, lon);
// Read the end latitude/longitude information.
String endLatLon = (String) headerInfo.get( HeaderInfoTitle.END_LAT_LON.toString());
latLon = endLatLon.split( " ");
if ( latLon.length != 2) throw new IOException( "Invalid DMSP file: end lat/lon <" + endLatLon + "> invalid.");
try
{
lat = Double.valueOf( latLon[0]);
lon = Double.valueOf( latLon[1]);
}
catch ( NumberFormatException e )
{
throw new IOException( "Invalid DMSP file: end lat/lon string <" + endLatLon + "> not parseable: " + e.getMessage() );
}
this.endLatitudeAtt = new Attribute( this.endLatitudeAttName, lat);
this.endLongitudeAtt = new Attribute( this.endLongitudeAttName, lon);
// Read the start sub-solar coordinates.
this.startSubsolarCoordsAtt = new Attribute( this.startSubsolarCoordsAttName,
(String) headerInfo.get( HeaderInfoTitle.START_SUBSOLAR_COORD.toString()));
// Read the end sub-solar coordinates.
this.endSubsolarCoordsAtt = new Attribute( this.endSubsolarCoordsAttName,
(String) headerInfo.get( HeaderInfoTitle.END_SUBSOLAR_COORD.toString()));
// Read the start lunar coordinates.
this.startLunarCoordsAtt = new Attribute( this.startLunarCoordsAttName,
(String) headerInfo.get( HeaderInfoTitle.START_LUNAR_COORD.toString()));
// Read the end lunar coordinates.
this.endLunarCoordsAtt = new Attribute( this.endLunarCoordsAttName,
(String) headerInfo.get( HeaderInfoTitle.END_LUNAR_COORD.toString()));
// Read the ascending node.
Double ascendingNode = Double.valueOf( (String) headerInfo.get( HeaderInfoTitle.ASCENDING_NODE.toString()) );
this.ascendingNodeAtt = new Attribute( this.ascendingNodeAttName, ascendingNode);
Double nodeHeading = Double.valueOf( (String) headerInfo.get( HeaderInfoTitle.NODE_HEADING.toString()) );
this.nodeHeadingAtt = new Attribute( this.nodeHeadingAttName, nodeHeading);
}