I’m trying to set a Validity Mask as part of the KMeansClassification within a Python script, but I’m getting a ‘Floating point exception (core dumped)’ (full output below) when it is defined as follows:
kmeans = otbApplication.Registry.CreateApplication("KMeansClassification")
kmeans.SetParameterString("in", chmname+"_clip.tif")
kmeans.SetParameterInt("ts", 1000)
kmeans.SetParameterInt("ram", 2048)
kmeans.SetParameterInt("nc", inputNC)
##setting vm
kmeans.SetParameterString("vm", "vm.tif")
kmeans.SetParameterString("out", chmname+"_kmeans.tif")
kmeans.SetParameterOutputImagePixelType("out", 1)
kmeans.ExecuteAndWriteOutput()
When I omit kmeans.SetParameterString("vm", "vm.tif")
the script runs fine. If I include the (same) validity mask on the command line with otbcli_KMeansClassification
it runs fine. Incidentally, despite setting kmeans.SetParameterInt("ram", 2048)
the application still uses the default RAM limit of 128MB. I suspect that I’m overlooking something wrt to how the parameters ought to be set, but any advice would be appreciated.
log:
2019-03-07 12:48:48 (INFO): No kwl metadata found in file CT_KK_CHM_clip.tif
2019-03-07 12:48:48 (INFO): No kwl metadata found in file vm.tif
2019-03-07 12:48:48 (INFO): Estimated memory for full processing: 430.541MB (avail.: 128 MB), optimal image partitioning: 4 blocks
2019-03-07 12:48:48 (INFO): Estimation will be performed in 5 blocks of 7706x1303 pixels
2019-03-07 12:48:48 (INFO): Estimated memory for full processing: 430.541MB (avail.: 128 MB), optimal image partitioning: 4 blocks
2019-03-07 12:48:48 (INFO): Estimation will be performed in 6 blocks of 3552x3552 pixels
2019-03-07 12:48:50 (INFO): Estimated memory for full processing: 574.067MB (avail.: 128 MB), optimal image partitioning: 5 blocks
2019-03-07 12:48:50 (INFO): Estimation will be performed in 6 blocks of 7706x1086 pixels
2019-03-07 12:48:50 (INFO): No kwl metadata found in file CT_KK_CHM_clip.tif
2019-03-07 12:48:50 (INFO): Estimated memory for full processing: 574.067MB (avail.: 128 MB), optimal image partitioning: 5 blocks
2019-03-07 12:48:50 (INFO): Estimation will be performed in 6 blocks of 7706x1086 pixels
2019-03-07 12:48:52 (INFO): Estimated memory for full processing: 1196.03MB (avail.: 128 MB), optimal image partitioning: 10 blocks
2019-03-07 12:48:52 (INFO): File CT_KK_CHM_kmeans.tif will be written in 11 blocks of 7706x592 pixels
Floating point exception (core dumped)