sinkovit / Spatial-ecology

Space use software deployed in the Spatial Ecology Gateway
MIT License
2 stars 0 forks source link

Contour display problem #72

Open sinkovit opened 1 year ago

sinkovit commented 1 year ago

If the map doesn't span a large enough area to contain an entire contour, the display is wonky and we get weird shapes with long straight edges instead of nice smooth contours. See the "good" and "bad" attachments.

Bad contour display Good contour display

If the contour fits on the map, then the first and last points in the contour are the same, otherwise they are different. We can test for this easily with the following block of code after tidydta2 has already been calculated.

good <- TRUE # Contour fits on map
for (gname in unique(tidydta2$group)) {
    x1 <-  tidydta2$lat[which(tidydta2$group == gname)]
    y1 <-  tidydta2$long[which(tidydta2$group == gname)]
    if (x1[1] != x1[length(x1)] && y1[1] != y1[length(y1)]) {
       good <- FALSE # Contour does not fit on map
    }
}

I suggest that we still display the results if the display is wonky, but provide the following warning message "Not all contours levels fit on the map. Either increase map size by using a larger buffer value or decrease the probability for the outermost contour"

monaw commented 11 months ago

Ok, i’ve added this to the code and updated our dev branch. Since tidydta2 is only calculated for when map is being displayed, the weird display is only an issue for mkde plot with a map?

On Nov 3, 2023, at 9:15 AM, Robert Sinkovits @.***> wrote:

If the map doesn't span a large enough area to contain an entire contour, the display is wonky and we get weird shapes with long straight edges instead of nice smooth contours. See the "good" and "bad" attachments.

[Bad contour display]https://urldefense.com/v3/__https://user-images.githubusercontent.com/5232688/280340621-3252d73f-39cb-4e99-895a-49fb4bc2d8e7.png__;!!Mih3wA!CF49wZ9Anx1mrwUzwGyzWlsbLSpfC-OPff2J8q2V8B_04TRf_OttM6PAPbN7N8tNF89ffKxD0Ewe4-ko8wl5UQ$ [Good contour display] https://urldefense.com/v3/__https://user-images.githubusercontent.com/5232688/280340624-9a7f7072-2b5f-4878-8a2a-8052abc285af.png__;!!Mih3wA!CF49wZ9Anx1mrwUzwGyzWlsbLSpfC-OPff2J8q2V8B_04TRf_OttM6PAPbN7N8tNF89ffKxD0Ewe4-nY4npzaA$

If the contour fits on the map, then the first and last points in the contour are the same, otherwise they are different. We can test for this easily with the following block of code after tidydta2 has already been calculated.

good <- TRUE # Contour fits on map for (gname in unique(tidydta2$group)) { x1 <- tidydta2$lat[which(tidydta2$group == gname)] y1 <- tidydta2$long[which(tidydta2$group == gname)] if (x1[1] != x1[length(x1)] && y1[1] != y1[length(y1)]) { good <- FALSE # Contour does not fit on map } }

I suggest that we still display the results if the display is wonky, but provide the following warning message "Not all contours levels fit on the map. Either increase map size by using a larger buffer value or decrease the probability for the outermost contour"

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/sinkovit/Spatial-ecology/issues/72__;!!Mih3wA!CF49wZ9Anx1mrwUzwGyzWlsbLSpfC-OPff2J8q2V8B_04TRf_OttM6PAPbN7N8tNF89ffKxD0Ewe4-lqHcnjPQ$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AEM5Y4BT5SNSMIR73VEDO43YCUKDFAVCNFSM6AAAAAA64VPMT6VHI2DSMVQWIX3LMV43ASLTON2WKOZRHE3TMNJSG4ZTEMI__;!!Mih3wA!CF49wZ9Anx1mrwUzwGyzWlsbLSpfC-OPff2J8q2V8B_04TRf_OttM6PAPbN7N8tNF89ffKxD0Ewe4-n1CnA-XA$. You are receiving this because you are subscribed to this thread.Message ID: @.***>