Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying fieldIndex to add more VIs #46

Open
pjjagwe opened this issue Aug 25, 2023 · 3 comments
Open

Modifying fieldIndex to add more VIs #46

pjjagwe opened this issue Aug 25, 2023 · 3 comments

Comments

@pjjagwe
Copy link

pjjagwe commented Aug 25, 2023

Hi @filipematias23,
I added more VIs to the Indices.txt file used to run the fieldIndex function.

image

When i run this code;
X.Indices2 <- fieldIndex2(X.RemSoil$newMosaic,Red=1,Green=2,Blue=3,RedEdge=4,NIR=5,
index = c("NDVI","NDRE", "BI", "SCI", "GLI", "HI","NGRDI", "SI", "VARI", "HUE", "BGI", "PSRI", "GNDVI",
"RVI", "TVI", "CVI", "CIG", "CIRE", "DVI", "EVI", "GDVI","GLI","GOSAVI","GRVI", "GEMI","GARI"
,"GSAVI","IPVI","LAI", "MNLI","MSAVI2","MSR","NLI","OSAVI","RDVI","SAVI","TDVI","VARI","WDRVI","SR"))

I get an error: Error in eval(parse(text = as.character(Ind$eq[as.character(Ind$index) == :
object 'EVI' not found
In addition: Warning messages:
1: In for (f in 1:length(filename)) { :
closing unused connection 4 (C:/Users/pjjagwe/AppData/Local/Temp/RtmpaOFv1e/raster/r_tmp_2023-08-25_181651.200041_16852_88055.gri)
2: In for (f in 1:length(filename)) { :
closing unused connection 3 (C:/Users/pjjagwe/AppData/Local/Temp/RtmpaOFv1e/raster/r_tmp_2023-08-25_180154.128608_16852_62923.gri)

@pjjagwe
Copy link
Author

pjjagwe commented Aug 25, 2023

@filipematias23 Could you kindly share some insight.

Thanks

@filipematias23
Copy link
Collaborator

Hi there, try using the parameter "myIndex" in fieldIndex(). You can write the new indices direct in the coding. Here is one example:

Test.Indices<- fieldIndex(mosaic = Test,
Red = 1, Green = 2, Blue = 3, RedEdge=4, NIR=5,
index = c("NGRDI","NDVI"),
myIndex = c("Write your Index", "Write your Index", "2*Green/Blue"))

Hope it helps...!

All the best,
Filipe

@pjjagwe
Copy link
Author

pjjagwe commented Aug 29, 2023

Thanks @filipematias23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants