rasterPCA questions
I use rasterPCA with a set of 85 rasters of size 5703 x 2657. Well, rasterPCA takes days (or stops with 'cannot place vector of some Gb'), predict() was never finished yet due to memory consuming or other reasons. So, I never got result yet ))) I have two related questions. The first looks like a bug... When I use rasterPCA(train.stack, nSamples = 10000, maskCheck=F, spca = T) - when I use nSamples = int - I noticed that this nSamples parameter does not work. I looked at the code and found that function uses random sample of size nSamples from rasters with na.rm = T option. However (I checked) na.rm = T does not take effect. My rasters have a lot of NA values. So if nSamples = 10000, real sample is about 100. Increasing nSamples I got a proportional increasing of random sample size. In my case, I got random sample of 10 000, when used nSamples = 3 000 000.
I tried to use parallel computing to increase calculation speed, but this attempt also failed )) Here is my code: beginCluster(n=4) train.pc <- rasterPCA(train.stack, nSamples = ns.pc, maskCheck=F, spca = T) endCluster() but during rasterPCA executing, I see that 1 core is loaded only. Was I wrong here? Thank you