@@ -384,21 +384,27 @@ private void initMapping(CoordinateSystem cs) {
384
384
// check other dimensions
385
385
for (CoordinateAxis axis : cs .getCoordinateAxes ()) {
386
386
// get from coordinate vars
387
- final CoordinateVariable <?> cv = coordinatesVariables .get (axis .getFullName ());
388
- final String name = cv .getName ();
389
- switch (cv .getAxisType ()){
390
- case GeoX : case GeoY : case Lat : case Lon :
391
- continue ;
392
- case Height : case Pressure : case RadialElevation : case RadialDistance : case GeoZ :
393
- if (UnidataCRSUtilities .VERTICAL_AXIS_NAMES .contains (name )) {
394
- dimensionsMapping .put (UnidataUtilities .ELEVATION_DIM , name );
395
- } else {
396
- dimensionsMapping .put (name .toUpperCase (), name );
387
+ final CoordinateVariable <?> cv = coordinatesVariables .get (axis .getFullName ());
388
+ if (cv != null ) {
389
+ final String name = cv .getName ();
390
+ switch (cv .getAxisType ()){
391
+ case GeoX : case GeoY : case Lat : case Lon :
392
+ continue ;
393
+ case Height : case Pressure : case RadialElevation : case RadialDistance : case GeoZ :
394
+ if (UnidataCRSUtilities .VERTICAL_AXIS_NAMES .contains (name )) {
395
+ dimensionsMapping .put (UnidataUtilities .ELEVATION_DIM , name );
396
+ } else {
397
+ dimensionsMapping .put (name .toUpperCase (), name );
398
+ }
399
+ break ;
400
+ case Time :
401
+ dimensionsMapping .put (UnidataUtilities .TIME_DIM , name );
402
+ break ;
403
+ }
404
+ }else {
405
+ if (LOGGER .isLoggable (Level .SEVERE )) {
406
+ LOGGER .severe ("Null coordinate variable: '" + axis .getFullName () + "' while processing input: " + this .getInput ());
397
407
}
398
- break ;
399
- case Time :
400
- dimensionsMapping .put (UnidataUtilities .TIME_DIM , name );
401
- break ;
402
408
}
403
409
}
404
410
}
@@ -421,11 +427,20 @@ private void extractCoordinatesVariable( ) throws IOException {
421
427
} else {
422
428
// Workaround for Unsupported Axes
423
429
Set <String > unsupported = UnidataUtilities .getUnsupportedDimensions ();
424
- if (axis instanceof CoordinateAxis1D && unsupported .contains (axis .getFullName ())){
430
+ if (axis instanceof CoordinateAxis1D && unsupported .contains (axis .getFullName ())) {
425
431
axis .setAxisType (AxisType .GeoZ );
426
- coordinatesVariables .put (axis .getFullName (), CoordinateVariable .create ((CoordinateAxis1D )axis ));
427
- }else {
428
- LOGGER .warning ("Unsupported axis: " +axis + " in input: " +this .getInput () + " has been found" );
432
+ coordinatesVariables .put (axis .getFullName (),
433
+ CoordinateVariable .create ((CoordinateAxis1D ) axis ));
434
+ // Workaround for files that have a time dimension, but in a format that could not be parsed
435
+ } else if ("time" .equals (axis .getFullName ())) {
436
+ LOGGER .warning ("Detected unparseable unit string in time axis: '"
437
+ + axis .getUnitsString () + "'." );
438
+ axis .setAxisType (AxisType .Time );
439
+ coordinatesVariables .put (axis .getFullName (),
440
+ CoordinateVariable .create ((CoordinateAxis1D ) axis ));
441
+ } else {
442
+ LOGGER .warning ("Unsupported axis: " + axis + " in input: " + this .getInput ()
443
+ + " has been found" );
429
444
}
430
445
}
431
446
}
0 commit comments