marlonecobos / kuenm

kuenm: An R package for detailed calibration and construction of Maxent Ecological Niche Models.
63 stars 24 forks source link

KUENM MOP #28

Closed Pritam31 closed 2 years ago

Pritam31 commented 3 years ago

Hello when I run MOP in Kuenm I get following error

Error in .local(.Object, ...) : Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", : Cannot create a RasterLayer object from this file.

my codes are is_swd <- FALSE outmop <- "MOP_results"

kuenm_mmop(G.var.dir = gvars, M.var.dir = mvars, is.swd = is_swd, sets.var = "Set_5", out.mop = outmop, percent = 10, comp.each = 2000, parallel = TRUE)

Please help, I am stuck here since many days and not being able to find it's solution anywhere else. Thank you

HoytHe commented 2 years ago

You may have files with extensions "asc", "asc.xml", "asc.ovr" etc. in your variable set folder. We only need those "asc" files to create RasterLayer objects.

When I debug this function, I found that the following lines set pattern as "asc". It should be ".asc$". m_var <- list.files(dirsm, pattern = "asc", full.names = TRUE) g_var <- list.files(dirsg_in[i], pattern = "asc", full.names = TRUE)

you can use trace(function_name, edit= TRUE) to edit the source code. Replace the above lines with follows: m_var <- list.files(dirsm, pattern = ".asc$", full.names = TRUE) g_var <- list.files(dirsg_in[i], pattern = ".asc$", full.names = TRUE)

Good luck!