spfeas icon indicating copy to clipboard operation
spfeas copied to clipboard

Compiling partial results

Open bpstewar opened this issue 6 years ago • 1 comments

I just ran a large spfeas process that broke after 2 days becuase the final trigger was NDVI, and the imagery was RGB, making NDVI not possible. While I understand that is my fault, I am wondering how I can salvage the results to eliminate the need to re-run the whole thing with the NDVI trigger removed:

  1. If I create the VRT myself from the tiled results, will it function despite the empty bands?
  2. The YAML is incomplete, but is it necessary to have it complete? What else references the YAML? Can I run classification with a broken YAML?

bpstewar avatar May 09 '18 13:05 bpstewar

@bpstewar I will update SpFeas to check for spectral indices before running other triggers.

As a short-term fix:

  1. Can you view the other bands if you open one GeoTiff tile, or are the images corrupt? If the other bands are fine, the VRT should be okay. You can use gdalbuildvrt or mpglue.vrt_builder. With the latter, you can stack the bands you want with something like:
from mpglue import vrt_builder
list_of_all_layer1 = [...]
list_of_all_layer2 = [...]
comp_dict = {'001': list_of_all_layer1, '002': list_of_all_layer2}
vrt_builder(comp_dict, '/output_image.vrt', relative_path=True)
  1. The YAML file is only used for tracking processed features, so it won't be used with mpglue.classification.

  2. If it is easier, you can also stack all the bands (including the empty ones), and use MpGlue to remove the empty NDVI layers. Below is an example with 2 land cover classes, and the empty NDVI layers are 20 and 21:

import mpglue as gl
CLO = gl.classification()
CLO.split_samples('/samples_file.txt', class_subs={1: 0.5, 2: 0.5}, ignore_feas=[20, 21])
CLO.construct_model()
CLO.predict('/input_image.vrt', '/output_image.tif', ignore_feas=[20, 21])

jgrss avatar May 09 '18 14:05 jgrss