pyeo
Contents:
- ACD National
- Classification
- Key functions
- Function reference
change_from_composite()
classify_directory()
classify_image()
classify_rf()
create_model_for_region()
create_model_from_signatures()
create_rf_model_for_region()
create_trained_model()
extract_features_to_csv()
get_shp_extent()
get_training_data()
load_signatures()
plot_signatures()
raster_reclass_binary()
reshape_ml_out_to_raster()
reshape_prob_out_to_raster()
reshape_raster_for_ml()
shapefile_to_raster()
train_rf_model()
- Coordinate Manipulation
- Key functions
- Function reference
align_bounds_to_whole_number()
check_overlap()
floor_to_resolution()
get_aoi_bounds()
get_aoi_intersection()
get_aoi_size()
get_combined_polygon()
get_local_top_left()
get_poly_bounding_rect()
get_poly_intersection()
get_poly_size()
get_raster_bounds()
get_raster_intersection()
get_raster_size()
multiple_intersection()
multiple_union()
pixel_bounds_from_polygon()
pixel_to_point_coordinates()
point_to_pixel_coordinates()
reproject_geotransform()
reproject_vector()
write_geometry()
- Filesystem Utilities
- Key functions
- Function reference
check_for_invalid_l1_data()
check_for_invalid_l2_data()
clean_aoi()
clean_l2_data()
clean_l2_dir()
conda_check()
config_path_to_config_dict()
create_file_structure()
create_folder_structure_for_tiles()
get_change_detection_date_strings()
get_change_detection_dates()
get_filenames()
get_image_acquisition_time()
get_l1_safe_file()
get_l2_safe_file()
get_mask_path()
get_preceding_image_path()
get_pyeo_timestamp()
get_raster_paths()
get_related_images()
get_safe_product_type()
get_sen_2_baseline()
get_sen_2_granule_id()
get_sen_2_image_orbit()
get_sen_2_image_tile()
get_sen_2_image_timestamp()
get_sen_2_tiles()
init_log()
init_log_acd()
serial_date_to_string()
sort_by_timestamp()
unzip_contents()
zip_contents()
- Queries and Downloads
- Key Functions
- SAFE Files
- Query Data Structure
- Data Download Source
- Legacy Download Sources
- Functions
build_dataspace_request_string()
check_for_s2_data_by_date()
download_dataspace_product()
download_from_aws_with_rollback()
download_from_scihub()
download_landsat_data()
download_s2_data()
download_s2_data_from_dataspace()
download_s2_data_from_df()
download_s2_pairs()
filter_non_matching_s2_data()
filter_to_l1_data()
filter_to_l2_data()
filter_unique_dataspace_products()
filter_unique_l1c_and_l2a_data()
get_access_token()
get_granule_identifiers()
get_query_datatake()
get_query_filename()
get_query_granule()
get_query_level()
get_query_processing_time()
landsat_query()
load_api_key()
planet_query()
query_dataspace_by_polygon()
query_for_corresponding_image()
read_aoi()
sent2_query()
shapefile_to_wkt()
- Raster Manipulation
- Key functions
- Rasters
- Timestamps
- Supported datatypes
- Geotransforms
- Projections
- Masks
- Function reference
add_masks()
align_image_in_place()
apply_array_image_mask()
apply_band_function()
apply_image_function()
apply_mask_to_dir()
apply_mask_to_image()
apply_processing_baseline_0400_offset_correction_to_tiff_file_directory()
apply_processing_baseline_offset_correction_to_tiff_file_directory()
apply_scl_cloud_mask()
apply_sen2cor()
array2raster()
atmospheric_correction()
average_images()
buffer_mask_in_place()
build_sen2cor_output_path()
calc_ndvi()
change_from_class_maps()
clever_composite_directory()
clever_composite_directory_with_masks()
clever_composite_images()
clever_composite_images_with_mask()
clip_raster()
clip_raster_to_intersection()
combine_date_maps()
combine_masks()
composite_directory()
composite_images_with_mask()
compress_tiff()
create_mask_from_band()
create_mask_from_class_map()
create_mask_from_confidence_layer()
create_mask_from_fmask()
create_mask_from_model()
create_mask_from_scl_layer()
create_mask_from_sen2cor_and_fmask()
create_matching_dataset()
create_new_image_from_polygon()
create_new_stacks()
create_quicklook()
filter_by_class_map()
find_small_safe_dirs()
flatten_probability_image()
get_array()
get_dir_size()
get_extent_as_shp()
get_file_sizes()
get_image_resolution()
get_masked_array()
get_sen2cor_version()
get_sen_2_band_path()
get_stats_from_raster_file()
mosaic_images()
open_dataset_from_safe()
preprocess_landsat_images()
preprocess_sen2_images()
raster2array()
raster_sum()
raster_to_array()
reproject_directory()
reproject_image()
resample_image_in_place()
save_array_as_image()
scale_to_uint8()
sieve_directory()
sieve_image()
stack_and_trim_images()
stack_image_with_composite()
stack_images()
stack_old_and_new_images()
stack_sentinel_2_bands()
strip_bands()
trim_image()
update_composite_with_images()
verify_change_detections()
write_n_band_tiff()
- Validation
- Vectorisation
- Applications
Introduction
Python For Earth Observation is a collection of functions for downloading, manipulating, combining and classifying geospatial raster and vector data.
Installation
With Git and Miniconda or Anaconda installed, cd
to an install location then run the following lines
git clone https://github.com/clcr/pyeo.git
cd pyeo
conda env create --file environment.yml --name pyeo_env
conda activate pyeo_env
python -m pip install . -vv
In a Python prompt, try import pyeo
- you should see no errors.
Quick start
Before you start, you will need:
Git
Anaconda/Miniconda
A raster of your window area
A shapefile of polygons over your training areas with a field containing class labels
A raster to classify. This can be the same as your original raster.
All rasters and shapefiles should be in the same projection; ideally in the local projection of your satellite data.
Use
You can use pyeo’s command-line functions to create and apply a pixel classification model from a set of polygons and a raster. The below example:
saves the training data defined in
your_raster.tif
andyour_shapefile.tif
intosignatures.csv
creates a model from
signatures.csv
namedmodel.pkl
Classifies the whole of
your_raster.tif
usingmodel.pkl
, and saves the result intooutput_image.tif
conda activate pyeo_env
extract_signatures your_raster.tif your_shapefile.shp signatures.csv
create_model_from_signatures signatures.csv model.pkl
classify_image your_raster model.pkl output_image.tif
A small test suite is located in pyeo/tests/pyeo_tests.py; this is designed for use with py.test. Some example applications and demos are in pyeo/apps; for an illustration of the use of the library, pyeo/apps/change_detection/simple_s2_change_detection.py is recommended.