def updateMessages(self, parameters):
        """Modifies the messages created by internal validation for each tool
        parameter.  This method is called after internal validation."""

        zone_parameter = parameters[0]
        input_parameter = parameters[1]
        variable_parameter = parameters[2]
        output_parameter = parameters[3]
        type_parameter = parameters[4]
        ignore_parameter = parameters[5]
        zonefield_parameter = parameters[6]
        dataset = None

        if zone_parameter.value is not None:
            valid_raster_types = ["RasterLayer", "RasterDataset"]
            valid_feature_types = ["ShapeFile","FeatureLayer", "FeatureDataset"]
            desc = arcpy.Describe(zone_parameter.value)
            if desc.dataType in valid_raster_types:
                # Check that raster is of an integer data type
                if not hasattr(desc, 'isInteger') or not desc.isInteger:
                    zone_parameter.setErrorMessage(
                        mds.messages.ZONE_RASTER_NOT_INTEGER.format(
                            zone_parameter.valueAsText))
                else:
                    # Fill zone field parameter for raster
                    if hasattr(desc, 'fields'):
                        zonefield_parameter.filter.type = "ValueList"
                        validtypes = ['Integer','SmallInteger','String']
                        zonefield_parameter.filter.list = [zonefield.name for \
                            zonefield in desc.fields if zonefield.type in validtypes]
                    else:
                        zonefield_parameter.filter.type = "ValueList"
                        zonefield_parameter.filter.list = ['Value']
            elif desc.dataType in valid_feature_types:
                # Fill zone field parameter for feature class
                zonefield_parameter.filter.type = "ValueList"
                validtypes = ['OID','Integer','SmallInteger','String']
                zonefield_parameter.filter.list = [zonefield.name for \
                    zonefield in desc.fields if zonefield.type in validtypes]
            else:
                zonefield_parameter.filter.type = "ValueList"
                zonefield_parameter.filter.list = []
        else:
            # Clear zone field list if no zone dataset specified
            zonefield_parameter.filter.type = "ValueList"
            zonefield_parameter.filter.list = []


        # Open netCDF dataset
        if input_parameter.value is not None:
            try:
                dataset = mds.netcdf.Dataset(input_parameter.valueAsText, '')
            except __HOLE__, exception:
                if "No such file or directory" in str(exception) or \
                    "Invalid argument" in str(exception):
                    input_parameter.setErrorMessage(
                        mds.messages.INPUT_FILE_DOES_NOT_EXIST.format(
                            input_parameter.valueAsText))
                elif "Malformed or inaccessible DAP DDS" in str(exception):
                    input_parameter.setErrorMessage(
                        mds.messages.INPUT_DATASET_URL_MALFORMED.format(
                            input_parameter.valueAsText))
                else:
                    input_parameter.setErrorMessage(
                        mds.messages.INPUT_DATASET_GENERIC_ERROR.format(
                            input_parameter.valueAsText, str(exception)))
            except Exception, exception:
                input_parameter.setErrorMessage(
                    mds.messages.INPUT_DATASET_GENERIC_ERROR.format(
                        input_parameter.valueAsText, str(exception)))
            if dataset is not None:
                # Try to fill variable list with spatial variables
                var_list = list(dataset.spatial_data_variable_names())
                if var_list != []:
                    # If successful, we likely have a gridded dataset.  We
                    # will check regular gridding on execution.
                    variable_parameter.filter.type = "ValueList"
                    variable_parameter.filter.list = var_list
                else:
                    # If unsuccessful, try to fill variable list assuming
                    # dataset is of a discrete geometry type.
                    var_list = list(dataset.data_variable_names())
                    var_filter = []
                    for var_item in var_list:
                        var_stat, var_x, var_y = self.get_dependent_variables(dataset, var_item)
                        if (var_stat is not None) and (var_x is not None) and (
                            var_y is not None):
                            var_filter = self.get_variables_by_dimension(dataset, var_stat)
                            break
                    variable_parameter.filter.type = "ValueList"
                    variable_parameter.filter.list = var_filter
        else:
            # Clear variable list if no input dataset specified
            variable_parameter.filter.type = "ValueList"
            variable_parameter.filter.list = []
            variable_parameter.value = ""

        # Modify statistic choices so that, if any variable is not of integer
        # type, categorical statistics are not offered.
        if variable_parameter.value is not None:
            if (dataset is not None) and (variable_parameter.value in \
                dataset.variable_names()):
                var = dataset.variable(variable_parameter.value)
                ispacked = hasattr(var,'scale_factor') or hasattr(var, 'add_offset')
                flag = ('int' in str(var.dtype)) and not ispacked
                type_parameter.filter.list = sorted([key for stat in \
                    self.statistics if flag or not stat[2] for key in \
                    stat[1].keys()])
        else:
            # When variable parameter is cleared, make all statistics available
            type_parameter.filter.list = sorted([key for stat in \
                self.statistics for key in stat[1].keys()])

        # Ensure output file has a .nc extension
        if output_parameter.value is not None:
            output_filename = output_parameter.valueAsText
            if os.path.splitext(output_filename)[1] != ".nc":
                output_parameter.setErrorMessage(
                    mds.messages.OUTPUT_FILE_EXTENSION_MUST_BE_NC)

        return
dataset/ETHPy150Open Esri/solutions-geoprocessing-toolbox/suitability/toolboxes/scripts/MultidimensionSupplementalTools/MultidimensionSupplementalTools/Scripts/mds/tools/multidimensional_zonal_statistics.py/MultidimensionalZonalStatistics.updateMessages