HannaMeyer / CAST

Developer Version of the R package CAST: Caret Applications for Spatio-Temporal models
https://hannameyer.github.io/CAST/
108 stars 30 forks source link

modeldomain in NNDM + clustered #51

Closed carlesmila closed 1 year ago

carlesmila commented 1 year ago

Hi Hanna :smile:

I had a look at sampleFromArea function within _plotgeodist.R but I didn't dare to modify the inner CRS transformations because I don't fully understand what is going on and I could somehow damage plot_geodist.

The way I solved it is: NNDM (and subsequently kNNDM) now does not depend on sampleFromArea anymore, it now only accepts a polygon (same CRS as training points) as modeldomain (I think accepting a raster and specially a stack is dangerous and unnecessary) and the sampling is done directly in the function using sf::st_sample. I modified examples that used nndm in _plotgeodist.R and the 4th vignette accordingly.

I also used this PR to push clustered_sample as discussed and to improve the docs in NNDM. Happy to discuss.