Closed PetiteTong closed 2 years ago
Hello! Thank you so much for your interest in this package! For your first question, using a raster in UTM coordinates should be OK for the modelling. The package automatically reprojects the occurrence points if they are in a different coordinate system than the environemntal rasters. I tried it out with the sample data, and it worked well, so no need to reproject the environmental rasters!
For the second issue (the error in the MaxentProj function), I was able to replicate it and fixed the issue. The function originally only worked if the entire scientific name of the species was used for the "spplist" argument (for example, "Canis_lupus" instead of "CL"). I removed that requirement and successfully tested it out so it should not be an issue anymore. If you redownload the package, the updated function should work with your data. Thanks again, and if you have any other questions or issues, please let me know!
-Ben Shipley
Thanks Ben!
You are so quickly to solve it! and now I will try again and add a categorical variables, do I need to add envs_stack$soil <- raster::as.factor(envs_stack$soil)
to tell the program? I am not sure, I will try it. If there is some problems I will tell you~
Best wishes
Petite Tong
Hi! I'm sorry that you've continued having issues with it!
I think I've had this problem before: An error says that maxent cannot work with rectangular pixels (different x and y sizes), but the rasters do not appear to have any different x and y values. It has something to do with some very minor differences in resolution. For example, the "raster" package usually rounds the displayed resolution values to about 5 decimal places, but the difference between the x and the y values might be in the 10th decimal place.
I've been working on trying to fix this issue (it is Issue #2 on Github), but I haven't quite figured it out yet. However, I have two ways to work around the problem:
Then, if you have any future environmental layers, running PredictEnv to make sure all of the environmental rasters are in the same resolution and projection. Then, running every else as normal.
Let me know if you try these two options and you still get errors, and thank you so much for your patience! Ben Shipley
On Fri, Apr 15, 2022 at 3:44 AM PetiteTong @.***> wrote:
Hi, Ben
I tried to do this for study area and other scenarios:
BIO1=raster('.../bio1.bil')
BIO1c=raster('.../bio1.bil')
BIO2c=raster('.../bio2.bil')
BIO3c=raster('.../bio3.bil')
BIO4c=raster('.../bio4.bil')
BIO5c=raster('.../bio5.bil')
BIO6c=raster('.../bio6.bil')
biosc=stack(BIO1c,BIO2c,BIO3c,BIO4c,BIO5c,BIO6c)
names(biosc)=c("bio1","bio2","bio3","bio4","bio5","bio6")
n=nlayers(biosc)
for (i in 1:n) {
projectRaster(biosc[[i]],BIO1,
filename=paste('.../',names(biosc[[i]]), sep=''), format = 'EHdr',overwrite=TRUE)
}
but no use for my problem.
Petite Tong
— Reply to this email directly, view it on GitHub https://github.com/brshipley/megaSDM/issues/4#issuecomment-1099935276, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANDTQKCTUHKA3LLQS4V42XTVFEM4NANCNFSM5TM4WTNQ . You are receiving this because you commented.Message ID: @.***>
Hi,Ben
I want to say thank you very much for your help, It now works well!
I believe you can make it better.
I meet an error in the next step,like this:
> # The time maps will be written out to the directory supplied in "result_dir" > result_dir <- "Results" > createTimeMaps(result_dir = result_dir, + time_periods = time_periods, + scenarios = scenarios, + dispersal = FALSE, + ncores = 2) Error in createTimeMaps(result_dir = result_dir, time_periods = time_periods, : No projected models found in 'result_dir': Ensure that 'result_dir' provides a path to the proper location > result_dir [1] "Results" > additionalStats(result_dir = result_dir, + time_periods = time_periods, + scenarios = scenarios, + dispersal = FALSE, + ncores = 2) Error in additionalStats(result_dir = result_dir, time_periods = time_periods, : No projected models found in 'result_dir': Ensure that 'result_dir' provides a path to the proper location
I'm not sure if it is related to the warning:
> MaxEntProj(input = model_output, + time_periods = time_periods, + scenarios = scenarios, + study_dir = study_dir, + predict_dirs = predictdir, + output = result_dir, + aucval = 0.7, + ncores = 1) [1] " Removing species with Test AUC Values < AUC threshold from subsequent analyses" starting median ensemble starting median ensemble starting median ensemble starting median ensemble starting median ensemble starting median ensemble starting median ensemble starting median ensemble starting median ensemble starting median ensemble There were 40 warnings (use warnings() to see them) > warnings() 警告信息: 1: In threshold(spp.name, modern.rasters, nrep_new, "", currentYear) : 强制改变过程中产生了NA ... 40: In threshold(spp.name, cur.proj, nrep_new, focusScen, ... : 强制改变过程中产生了NA
Or should I use the whole name of the species? Iwill try again.
Thanks a lot for your patience~
Petite Tong
YES!
It is because of the names of the species,"GGZ" "LLZ"are not ok. Just like the first problem. I have resolved it in my file. You can change it in the package when you have time.
Thanks, hope you all well.
Hi,
I'm so glad that you figured it out! Thank you so much for your patience and finding that error in my code! I just fixed it on GitHub.
-Benjamin Shipley
On Sun, Apr 17, 2022 at 7:21 AM PetiteTong @.***> wrote:
Hi,Ben
I want to say thank you very much for your help, It now works well!
I believe you can make it better.
I meet an error in the next step,like this:
The time maps will be written out to the directory supplied in "result_dir"
result_dir <- "Results"
createTimeMaps(result_dir = result_dir,
time_periods = time_periods,
scenarios = scenarios,
dispersal = FALSE,
ncores = 2)
Error in createTimeMaps(result_dir = result_dir, time_periods = time_periods, :
No projected models found in 'result_dir': Ensure that 'result_dir' provides a path to the proper location
result_dir
[1] "Results"
additionalStats(result_dir = result_dir,
time_periods = time_periods,
scenarios = scenarios,
dispersal = FALSE,
ncores = 2)
Error in additionalStats(result_dir = result_dir, time_periods = time_periods, :
No projected models found in 'result_dir': Ensure that 'result_dir' provides a path to the proper location
I'm not sure if it is related to the warning:
MaxEntProj(input = model_output,
time_periods = time_periods,
scenarios = scenarios,
study_dir = study_dir,
predict_dirs = predictdir,
output = result_dir,
aucval = 0.7,
ncores = 1)
[1] " Removing species with Test AUC Values < AUC threshold from subsequent analyses"
starting median ensemble
starting median ensemble
starting median ensemble
starting median ensemble
starting median ensemble
starting median ensemble
starting median ensemble
starting median ensemble
starting median ensemble
starting median ensemble
There were 40 warnings (use warnings() to see them)
warnings()
警告信息:
1: In threshold(spp.name, modern.rasters, nrep_new, "", currentYear) :
强制改变过程中产生了NA
...
40: In threshold(spp.name, cur.proj, nrep_new, focusScen, ... : 强制改变过程中产生了NA
Or should I use the whole name of the species? Iwill try again.
Thanks a lot for your patience~
Petite Tong
YES!
It is because of the names of the species,"GGZ" "LLZ"are not ok. Just like the first problem. I have resolved it in my file. You can change it in the package when you have time.
Thanks, hope you all well.
— Reply to this email directly, view it on GitHub https://github.com/brshipley/megaSDM/issues/4#issuecomment-1100856195, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANDTQKBRHHBSZ6WPNBQY4DLVFPX5HANCNFSM5TM4WTNQ . You are receiving this because you commented.Message ID: @.***>
Hi Ben,
At first I want to say thanks for your excellent work, megaSDM ! This is so convenient and helpful.
When I try to use it with my own occurrence data(tow columns, such as 102.00000 ,28.00000(unit °),as the function requirements), but my rasters are UTM reference frame. Maybe, should I change the rasters' system to make it the same as the point data? because I find that in the
species.csv
, the coordinates of the data are changed to UTM ,with unit m. I’m not sure whether this is ok or not?Another one question is that
there is an error in the function MaxEntProj()
error as : the path of the
maxentResults.csv
is wrong, such as ,in example : D:/megaSDM/TestRun/models/Geomys_pinetis/maxentResults.csv but my error is : D:/megaSDM/TestRun/models/NA/maxentResults.csvI could make sure that the name of the file and the
spplist
is right, and I checked theMaxEntProj
function, but I still could not know how to solve it. and I also want to tell you that at the beginning,occurrences
file was built by myself, I didn't have theSpeciesCounts
file, if I should add one?and the I find it is