Repository: ioos/compliance-checker
Issue: Test "dimension_order" with inconsistent results

This [file](http://thredds.aodn.org.au/thredds/catalog/IMOS/eMII/checker_test/ANMN/timeSeriesProfile/catalog.html?dataset=eMII/checker_test/ANMN/timeSeriesProfile/IMOS_ANMN-QLD_AETVZ_20110307T111900Z_GBRHIS_FV00_GBRHIS-1103-Workhorse-ADCP-model-Sentinel-or-Monitor-44_END-20110813T105900Z_C-20160203T040408Z.nc) and this [one](http://thredds.aodn.org.au/thredds/catalog/IMOS/eMII/checker_test/ANMN/timeSeriesProfile/catalog.html?dataset=eMII/checker_test/ANMN/timeSeriesProfile/IMOS_ANMN-QLD_AETVZ_20110307T111900Z_GBRHIS_FV01_GBRHIS-1103-Workhorse-ADCP-model-Sentinel-or-Monitor-44_END-20110813T105900Z_C-20160203T040408Z.nc) both include VCUR or VCUR_MAG such as:

```
float VCUR(TIME, HEIGHT_ABOVE_SENSOR) ;
                VCUR:coordinates = "TIME LATITUDE LONGITUDE HEIGHT_ABOVE_SENSOR" ;
                VCUR:standard_name = "northward_sea_water_velocity" ;
                VCUR:long_name = "northward_sea_water_velocity" ;
                VCUR:units = "m s-1" ;
                VCUR:valid_min = -10.f ;
                VCUR:valid_max = 10.f ;
                VCUR:_FillValue = 999999.f ;
                VCUR:comment = "magneticDeclinationPP: data initially referring to magnetic North has been modified so that it now refers to true North, applying a computed magnetic declination of 9.7degrees. NOAA\\'s Geomag v7.0 software + IGRF12 model have been used to compute this value at a latitude=-23.5136degrees North, longitude=151.9553degrees East, depth=44m (instrument nominal depth) and date=2011/05/25 (date in the middle of time_coverage_start and time_coverage_end)." ;
                VCUR:ancillary_variables = "VCUR_quality_control" ;
                VCUR:magnetic_declination = 9.7 ;
                VCUR:compass_correction_applied = 9.7 ;
```

with

```
double TIME(TIME) ;
        TIME:standard_name = "time" ;
        TIME:long_name = "time" ;
        TIME:units = "days since 1950-01-01 00:00:00 UTC" ;
        TIME:calendar = "gregorian" ;
        TIME:axis = "T" ;
        TIME:valid_min = 0. ;
        TIME:valid_max = 90000. ;
```

and

```
float HEIGHT_ABOVE_SENSOR(HEIGHT_ABOVE_SENSOR) ;
        HEIGHT_ABOVE_SENSOR:comment = "Data has been vertically bin-mapped using tilt information so that the cells have consistant heights above sensor in time." ;
        HEIGHT_ABOVE_SENSOR:long_name = "height_above_sensor" ;
        HEIGHT_ABOVE_SENSOR:units = "m" ;
        HEIGHT_ABOVE_SENSOR:axis = "Z" ;
        HEIGHT_ABOVE_SENSOR:positive = "up" ;
        HEIGHT_ABOVE_SENSOR:reference_datum = "sensor" ;
        HEIGHT_ABOVE_SENSOR:valid_min = -12000.f ;
        HEIGHT_ABOVE_SENSOR:valid_max = 12000.f 
```

However the first one passes the cf check while the second fails on the dimension_order test:

```
dimension_order                        :1:    82/126 : Variable VCUR has a non-
                                                      space-time dimension after
                                                      space-time-dimensions
```

And I don't think this message should output since HEIGHT_ABOVE_SENSOR is a space dimension.


Changed files:
compliance_checker/cf/cf.py

diff --git a/compliance_checker/cf/cf.py b/compliance_checker/cf/cf.py
index 04ed204..62917e3 100644
--- a/compliance_checker/cf/cf.py
+++ b/compliance_checker/cf/cf.py
@@ -406,8 +406,11 @@ class CFBaseCheck(BaseCheck):
             # any nones should be before classified ones
             nones    = [i for i, x in enumerate(dclass) if x is None]
             nonnones = [i for i, x in enumerate(dclass) if x is not None]
-
-            if len(nones) and len(nonnones) and max(nones) > min(nonnones):
+            '''
+            Documenting for clarification:
+            This next line of code says "If there is a non-space-time dimension and there is a space time dimension and the location of the non-space-time is before the location of the space-time dimension, fail test"
+            '''
+            if len(nones) and len(nonnones) and max(nones) < min(nonnones):
                 fails.append("Variable %s has a non-space-time dimension after space-time-dimensions"%k)
 
             # classified ones should be in correct order