jmsigner / amt

37 stars 13 forks source link

Resolution and scaling of KUDs #100

Closed ecbolas closed 8 months ago

ecbolas commented 8 months ago

Discussed in https://github.com/jmsigner/amt/discussions/99

I wasn't sure where to post this so putting it here, too!

Originally posted by **ecbolas** January 5, 2024 Hello, I have a couple questions about scaling and resolution-> I am making individual KUDs, that I want to scale between 0-1, and then average into a single UD to represent the population. The reason for scaling is to account for different sample sizes between individuals, but I want each of their UD’s to have the same “weight” when averaged into the population-level UD. This population UD raster will then be used as a covariate in an RSF. The other covariates/rasters for the RSF are 30m resolution, so I want to make sure my population UD matches that resolution. My questions are: 1) When I make the template raster for the KUDs and give it a resolution, what is the unit of resolution? In other words, what does the number mean that I am giving it? 2) For my work flow, I am using hr_kde, then hr_ud. However, I noticed that hr_kde also returns a UD, and that the max and min values for the two UD calculations are different, can you explain that please? For example, the hr_kde UD max value goes to any number, but the hr_ud UD min/max returns numbers between 0-1 (see below with outputs of the two different UDs for the same animal). Which is related to my next question -> 3) If all the individual KUDs were made with the same template raster, are they already on the same scale/scaled to each other? Is the UD function already scaling them? I’m trying to determine if I need to use terra::rescale before I average them together, or if they are already on an equivalent scale. When I apply terra::rescale, the max and min values come back the same. However, while the plot of the hr_KDE UD and hr_ud look identical to one another, the rescaled UD plot looks different. Code: # make kdes catsHR<- catstrack1 %>% mutate(HR_KDE = map(data, ~hr_kde(., trast = base_trast, levels = c(0.95, 1)))) # make UDs catsHR2<- catsHR %>% mutate(UD = map(HR_KDE, hr_ud)) # look at UD in hr_kde vs UD from kr_ud for the same individual > catsHR$HR_KDE[[1]]$ud class : SpatRaster dimensions : 134, 200, 1 (nrow, ncol, nlyr) resolution : 0.0062052, 0.0062052 (x, y) extent : -119.4016, -118.1605, 33.70379, 34.53528 (xmin, xmax, ymin, ymax) coord. ref. : lon/lat WGS 84 (EPSG:4326) source(s) : memory name : lyr.1 min value : 0.000 max value : 1392.781 > catsHR2$UD[[1]] class : SpatRaster dimensions : 134, 200, 1 (nrow, ncol, nlyr) resolution : 0.0062052, 0.0062052 (x, y) extent : -119.4016, -118.1605, 33.70379, 34.53528 (xmin, xmax, ymin, ymax) coord. ref. : lon/lat WGS 84 (EPSG:4326) source(s) : memory name : lyr.1 min value : 0.00000000 max value : 0.05430307 Thank you so much! Feel free to comment on anything that I’ve proposed doing and I can share more code if needed 😊
jmsigner commented 8 months ago

See here: https://github.com/jmsigner/amt/discussions/99