pyxccd.imagetool.prepare_ard module¶
- pyxccd.imagetool.prepare_ard.mask_value(vector, val)[source]¶
Build a boolean mask around a certain value in the vector.
- Parameters:
vector – 1-d ndarray of values
val – values to mask on
- Returns:
1-d boolean ndarray
- pyxccd.imagetool.prepare_ard.qabitval_array_HLS(packedint_array: ndarray)[source]¶
Institute a hierarchy of qa values that may be flagged in the bitpacked value.
fill > cloud > shadow > snow > water > clear
- Parameters:
packedint – int value to bit check
- Returns:
offset value to use
- pyxccd.imagetool.prepare_ard.qabitval_array(packedint_array: ndarray)[source]¶
Institute a hierarchy of qa values that may be flagged in the bitpacked value. fill > cloud > shadow > snow > water > clear :Parameters: packedint – int value to bit check
- Returns:
offset value to use
- pyxccd.imagetool.prepare_ard.qabitval_array_c2(packedint_array: ndarray)[source]¶
Institute a hierarchy of qa values that may be flagged in the bitpacked value for c2
fill > cloud > shadow > snow > water > clear
- Parameters:
packedint – int value to bit check
- Returns:
offset value to use
- pyxccd.imagetool.prepare_ard.single_image_stacking_hls(source_dir: str, out_dir: str, logger: Logger, dataset_info: DatasetInfo, is_partition: bool, clear_threshold: float, low_date_bound: str, upp_date_bound: str, folder: str)[source]¶
unzip single image, convert bit-pack qa to byte value, and save as numpy :param source_dir: the parent folder to save image ‘folder’ :param out_dir: the folder to save result :param logger: the handler of logger file :param data_info: data info data class :param is_partition: True, partition each image into blocks; False, save original size of image :param clear_threshold: threshold of clear pixel percentage, if lower than threshold, won’t be processed :param low_date_bound: the lower date of user interested date range :param upp_date_bound: the upper date of user interested date range :param folder: the folder name of image :return:
- pyxccd.imagetool.prepare_ard.single_image_stacking(tmp_path: str, source_dir: str, out_dir: str, clear_threshold: float, path_array: ndarray, logger: Logger, dataset_info: DatasetInfo, is_partition: bool, low_date_bound: str, upp_date_bound: str, b_c2: bool, folder: str)[source]¶
unzip single image, convert bit-pack qa to byte value, and save as numpy :param tmp_path: tmp folder to save unzip image :param source_dir: image folder save source zipped files :param out_dir: the folder to save result :param clear_threshold: threshold of clear pixel percentage, if lower than threshold, won’t be processed :param path_array: path array has the same dimension of inputted image, and the pixel value indicates
the path which the pixel belongs to; if path_array == none, we will use all path
- Parameters:
logger – the handler of logger file
dataset_info – dataset information
is_partition – True, partition each image into blocks; False, save original size of image
low_date_bound – the lower bound of user interested year range
upp_date_bound – the upper bound of user interested year range
b_c2 – False
folder – the folder name of image
- Returns:
- pyxccd.imagetool.prepare_ard.single_image_stacking_collection2(tmp_path: str, source_dir: str, out_dir: str, clear_threshold: float, logger: Logger, dataset_info: DatasetInfo, reference_path: str, is_partition: bool, low_date_bound: str, upp_date_bound: str, folder: str)[source]¶
for collection 2 :param tmp_path: tmp folder to save unzip image :param source_dir: image folder save source zipped files :param out_dir: the folder to save result :param clear_threshold: threshold of clear pixel percentage, if lower than threshold, won’t be processed :param logger: the handler of logger file :param dataset_info:DatasetInfo :param is_partition: True, partition each image into blocks; False, save original size of image :param low_date_bound: the lower bound of user interested date range :param upp_date_bound: the upper bound of user interested date range :param bounds :param folder: the folder name of image :return:
- pyxccd.imagetool.prepare_ard.checkfinished_step2(out_dir, n_cores)[source]¶
- Parameters:
out_dir
n_cores
- Returns:
- pyxccd.imagetool.prepare_ard.checkfinished_step3_partition(out_dir)[source]¶
- Parameters:
out_dir
- Returns:
- pyxccd.imagetool.prepare_ard.checkfinished_step3_nopartition(out_dir)[source]¶
- Parameters:
out_dir
- Returns:
- pyxccd.imagetool.prepare_ard.get_extent(extent_geojson, res, buf=0)[source]¶
read shapefile of a tile from an S3 bucket, and convert projection to be aligned with sample image. arg:
‘extent_geojson’: sharply geojson object res: planet resolution
- Returns:
(float, float, float, float), (int, int)) tuple
- pyxccd.imagetool.prepare_ard.explode(coords)[source]¶
Explode a GeoJSON geometry’s coordinates object and yield coordinate tuples. As long as the input is conforming, the type of the geometry doesn’t matter.
- pyxccd.imagetool.prepare_ard.checkfinished(signal_path) bool[source]¶
Check if the signal file exists