pyeo.validaion

A small set of functions for producing validation points from maps

pyeo.validation.allocate_category_sample_sizes(total_sample_size, user_accuracy, class_total_sizes, variance_tolerance, allocate_type='olofsson')

Allocates a number of pixels to sample per class that will fulfil the parameters given

Parameters
  • total_sample_size (The total number of validation points requested (from cal_total_sample_size)) –

  • user_accuracy (Dictionary of estimated user accuracies for classes in map (between 0 and 1)) –

  • class_total_sizes (Dictionary of total pixels for each class in user_accuracy) –

  • variance_tolerance (Acceptable vairance between the sample accuary and the data accuracy with a certain sample size) –

  • allocate_type (The allocation strategy to be used. Can be 'equal', 'prop' or 'olofsson'.) –

Returns

Return type

A dictionary of classes and no. pixels per class.

pyeo.validation.build_class_dict(class_array, no_data=None)

Returns a dict of coordinates of the following shape: [class, coord]. WARNING: This will take up a LOT of memory!

pyeo.validation.cal_total_sample_size(desired_standard_error, user_accuracy, total_class_sizes, type='simple')

Calculates the number of sample points for a map to get a specified standard error. :param desired_standard_error: :type desired_standard_error: The desired standard error (between 0 and 1) :param user_accuracy: :type user_accuracy: A dictionary of user accuracies from apriori knowledge :param total_class_sizes: :type total_class_sizes: The total number of pixels for each class :param type: :type type: whether to use the simple approximation or the full expession from Olofsson eq 13

Returns

Return type

The total number of sample points to achieve the specified error

pyeo.validation.calc_minimum_n(expected_accuracy, variance_tolerance)

Calculates the rminimum number of points required to achieve the specified accuracy :param expected_accuracy: :type expected_accuracy: Between 0 and 1 :param variance_tolerance:

pyeo.validation.count_pixel_classes(map_path, no_data=None)

Counts pixels in a map. Returns a dictionary of pixels. :param map_path: :type map_path: Path to the map to count :param no_data: :type no_data: A value to ignore

Returns

A dictionary of class

Return type

count

pyeo.validation.part_fixed_value_sampling(pinned_sample_numbers, class_total_sizes, total_sample_size)
Parameters
  • pinned_sample_numbers

  • class_total_sizes

  • total_sample_size

pyeo.validation.produce_stratified_validation_points(map_path, out_path, class_sample_counts, no_data=None, seed=None, produce_csv=False)

Produces a set of stratified validation points from map_path

pyeo.validation.save_point_list_to_shapefile(class_sample_point_dict, out_path, geotransform, projection_wkt, produce_csv=False)

Saves a list of points to a shapefile at out_path. Need the gt and projection of the raster. GT is needed to move each point to the centre of the pixel. Can also produce a .csv file for CoolEarth

pyeo.validation.save_validation_maifest(out_path, class_counts, sample_size, class_sample_counts, target_standard_error, user_accuracies)

Creates a json file containing the parameters used to produce this validation set

pyeo.validation.stratified_random_sample(map_path, class_sample_count, no_data=None, seed=None)

Produces a stratified list of pixel coordinates. WARNING: high mem!