jbferet / biodivMapR

biodivMapR: an R package for α- and β-diversity mapping using remotely-sensed images
https://jbferet.github.io/biodivMapR/index.html
GNU General Public License v3.0
47 stars 13 forks source link

Error during executing perform_PCA #13

Closed wuqinyu291 closed 2 years ago

wuqinyu291 commented 2 years ago

Dr. Féret, Thanks for your package. It's very exciting. There's one problem that's been bugging me for a long time. When I ran your example_script, It work well. But when I tried to import a my own raster and ran the demo code on it I got the following error: PCA_Output <- perform_PCA(Input_Image_File = Input_Image_File, Input_Mask_File = Input_Mask_File,

I don't know what is going on, can you give me some advice? Thank you very much!

jbferet commented 2 years ago

@wuqinyu291 thank you for your feedback on the use of biodivMapR. This error is usually resulting from an 'excessive' filtering of the data. Here, your mask may include little to no valid pixels, maybe because of the radiometric filtering (if you used it before computing PCA).

I suggest that you open the raster file named 'ShadeMask_Update' (in your result directory), and check if it actually contains valid pixels (0 values are masked, 1 values are valid pixels kept for the analysis). If ShadeMask_Update has 0 values only (or very low amount of 1 values), then you may want to adjust the thresholds for the radiometric filtering, in order to make sure you keep more valid pixels.

If ShadeMask_Update appears as valid, then I will need more information to understand this: in this case, can you prepare an image subset which allows you to reproduce the error, and share with me the image subset and corresponding R scripts?

Thank you