aodn / compliance-checker

Python tool to check your datasets vs compliance standards. Forked to include AODN specific modifications.
Apache License 2.0
1 stars 0 forks source link

IMOS - DEPTH_num_obs is no vertical coordinate #90

Closed ggalibert closed 8 years ago

ggalibert commented 8 years ago

The following variable DEPTH_num_obs:

        float DEPTH(TIME) ;
                DEPTH:_FillValue = 999999.f ;
                DEPTH:ancillary_variables = "DEPTH_num_obs DEPTH_sd DEPTH_min DEPTH_max" ;
                DEPTH:cell_methods = "time: mean" ;
                DEPTH:coordinates = "TIME LATITUDE LONGITUDE NOMINAL_DEPTH" ;
                DEPTH:long_name = "Mean of actual depth values in time bin, after rejection of flagged data" ;
                DEPTH:positive = "down" ;
                DEPTH:reference_datum = "sea surface" ;
                DEPTH:standard_name = "depth" ;
                DEPTH:units = "metres" ;
                DEPTH:valid_max = 12000. ;
                DEPTH:valid_min = -5. ;
        int DEPTH_num_obs(TIME) ;
                DEPTH_num_obs:_FillValue = 999999 ;
                DEPTH_num_obs:long_name = "Number of observations in time bin included in time bin average" ;
                DEPTH_num_obs:standard_name = "depth number_of_observations" ;
                DEPTH_num_obs:units = "1" ;

triggers the following error:

    DEPTH_num_obs                      :3:     4/11 :  
        positive                       :3:     0/ 1 :  
            vertical                   :3:     0/ 1 : Variable DEPTH_num_obs
                                                      appears to be a vertical
                                                      coordinate, should have
                                                      attribute positive =
                                                      'down'
        reference_datum                :3:     0/ 1 :  
            type                       :3:     0/ 1 : Variable attribute
                                                      DEPTH_num_obs:reference_da
                                                      tum not present
        standard_name                  :3:     1/ 2 :  
            vertical                   :3:     0/ 1 : Variable DEPTH_num_obs
                                                      appears to be a vertical
                                                      coordinate, should have
                                                      attribute standard_name =
                                                      'depth'
        valid_max                      :3:     0/ 1 :  
            present                    :3:     0/ 1 : Variable attribute
                                                      DEPTH_num_obs:valid_max
                                                      not present
        valid_min                      :3:     0/ 1 :  
            present                    :3:     0/ 1 : Variable attribute
                                                      DEPTH_num_obs:valid_min
                                                      not present
        variable_type                  :2:     0/ 1 : Variable DEPTH_num_obs
                                                      should have type Double or
                                                      Float

Since we're dealing with a number of observations, as an ancillary variable, there should be an exception for this kind of variable.

Same comment for DEPTH_sd representing standard_error.

ggalibert commented 8 years ago
        float DEPTH_sd(TIME) ;
                DEPTH_sd:_FillValue = 999999.f ;
                DEPTH_sd:cell_methods = "time: standard_deviation" ;
                DEPTH_sd:long_name = "Standard deviation of actual depth in time bin, after rejection of flagged data" ;
                DEPTH_sd:standard_name = "depth standard_error" ;
                DEPTH_sd:units = "metres" ;

CF checker gives:

    DEPTH_sd                           :3:     8/13 :  
        positive                       :3:     0/ 1 :  
            vertical                   :3:     0/ 1 : Variable DEPTH_sd appears
                                                      to be a vertical
                                                      coordinate, should have
                                                      attribute positive =
                                                      'down'
        reference_datum                :3:     0/ 1 :  
            type                       :3:     0/ 1 : Variable attribute
                                                      DEPTH_sd:reference_datum
                                                      not present
        standard_name                  :3:     1/ 2 :  
            vertical                   :3:     0/ 1 : Variable DEPTH_sd appears
                                                      to be a vertical
                                                      coordinate, should have
                                                      attribute standard_name =
                                                      'depth'
        valid_max                      :3:     0/ 1 :  
            present                    :3:     0/ 1 : Variable attribute
                                                      DEPTH_sd:valid_max not
                                                      present
        valid_min                      :3:     0/ 1 :  
            present                    :3:     0/ 1 : Variable attribute
                                                      DEPTH_sd:valid_min not
                                                      present
bpasquer commented 8 years ago

Have exact same issue with two SOOP-BA variable 'mean_depth' and 'mean_height'. As far as i can tell by looking at the function that outputs this error in the imos checker we get an idea of what 's going on from the definition of a vertical variable

def check_vertical_variable(self, dataset):
    """
    Check vertical variable attributes:
        standard_name  value is 'depth' or 'height'
        axis = 'Z' (for at least one vertical variable in the file --
                    there are cases where CF does not allow multiple
                    variables with the same axis value)
        positive value is 'down' or "up"
        valid_min exist
        valid_max exists
        reference_datum is a string type
        unit
    """

Seems like the definition of a vertical coordinate based on the name of the variable needs to be more strict. All vertical variableshould not be assumed to be coordinate.

mhidas commented 8 years ago

@ggalibert I guess we can exclude ancillary variables from these checks.

@bpasquer What do those 'mean_depth/mean_height' variables represent? Are they not vertical coordinates? If they are, they do need attributes standard_name, positive and reference_datum to specify what they mean. No?

If not, can you suggest some way to distinguish them from vertical coordinates?

bpasquer commented 8 years ago

Both variable_mean_height and mean_depth are ancillary variable of "Sv" (volume backscatter). they're defined as described in this manual: http://imos.org.au/fileadmin/user_upload/shared/SOOP/plugin-SOOP-BA_NetCDF_manual_v1.1.pdf therefore this issue can be handled the same way as for guillaume's issue.

ggalibert commented 8 years ago

PR https://github.com/aodn/compliance-checker/pull/97 fixes my problem. @bpasquer could you please check that it fixes yours?

bpasquer commented 8 years ago

Unfortunately it doesn't do the trick for me @ggalibert . I have put an example file on in my home dir on 10nsp under ComplianceCheckerExampleFile for further testing.

ggalibert commented 8 years ago

I've just tried and it works. Be sure you check out the branch IMOS-Checker-Issue-90.

mhidas commented 8 years ago

Fixed in #97