From 2207b4b5fffeb1225674f51e1573e4bc694e2390 Mon Sep 17 00:00:00 2001 From: Cameron Bodine Date: Wed, 17 Jan 2024 16:00:09 -0700 Subject: [PATCH 1/2] Reduce threadcnt for pred map --- src/main_mapSubstrate.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main_mapSubstrate.py b/src/main_mapSubstrate.py index 74daa5f..b1ca97a 100644 --- a/src/main_mapSubstrate.py +++ b/src/main_mapSubstrate.py @@ -521,6 +521,14 @@ def map_master_func(logfilename='', if map_predict > 0: start_time = time.time() + # Reduce to avoid OOM + threadPrcnt = 0.75 + if threadCnt == cpu_count(): + threadCnt = int(threadCnt * threadPrcnt) + + print("\nPrediction Map requires a lot of RAM...") + print("Lowering threadCnt to:", threadCnt) + if map_predict == 1: a = 'probability' else: From 08f0ac4cb0f24f8b6c9533c6b03d2575ecb3e74d Mon Sep 17 00:00:00 2001 From: Cameron Bodine Date: Wed, 17 Jan 2024 16:07:58 -0700 Subject: [PATCH 2/2] Add warning --- src/class_portstarObj.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/class_portstarObj.py b/src/class_portstarObj.py index 877651d..574f171 100644 --- a/src/class_portstarObj.py +++ b/src/class_portstarObj.py @@ -1992,6 +1992,8 @@ def _mapPredictions(self, map_predict, imgOutPrefix, chunk, npzs): dst.write(out) dst=None + # Don't do this because it will create gaps between chunks + # Do rescale when mosaicing # # Reopen and warp to xres # gtiff = gtiff_temp.replace('temp', '') # gdal.Warp(gtiff, gtiff_temp, xRes = pix_res, yRes = pix_res)