def execute(self, parameters, messages):

        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]

        # Grab the parameter values
        dataset_name = input_parameter.valueAsText      # input netCDF filename
        output_filename = output_parameter.valueAsText  # output filename
        var_name = variable_parameter.valueAsText       # netCDF variable name

        # Try to open the netCDF dataset
        try:
            dataset = mds.netcdf.Dataset(dataset_name,'')
        except RuntimeError, exception:
            messages.addErrorMessage(str(exception))
            raise arcpy.ExecuteError

        # Based on same criteria used to populate variable_parameter in
        #   updateMessages(), check if input dataset is gridded or contains
        #   discrete geometries and branch code appropriately.
        if list(dataset.spatial_data_variable_names()) != []:
            self.zonal_statistics_for_grid(parameters, messages, dataset)
        else:
            self.zonal_statistics_for_discrete(parameters, messages, dataset)

        return
The source code of the tool.
dataset/ETHPy150Open Esri/solutions-geoprocessing-toolbox/suitability/toolboxes/scripts/MultidimensionSupplementalTools/MultidimensionSupplementalTools/Scripts/mds/tools/multidimensional_zonal_statistics.py/MultidimensionalZonalStatistics.execute