MagicForrest / DGVMTools

R package for processing, analysing and visualising ouput from Dynamic Global Vegetation Models (DGVMs)
GNU General Public License v3.0
29 stars 22 forks source link

calcNME function not working #49

Closed halima1993 closed 4 years ago

halima1993 commented 4 years ago

Hey Matthew! Hope you are well. I want to compare two datasets, modelled and satellite data. When I use this function, an error come up calcNME(dataframeavi$avitablehkh1,dataf1$VegCX2X0.7) Error in calcNME(dataframeavi$avitablehkh1, dataf1$VegCX2X0.7) : could not find function "calcNME"

Is there any additional package for calcNME to operate, or have you removed this function. Let me know=)

MagicForrest commented 4 years ago

Hi Halima,

I made calcNME() an internal function (and not 'exported') to keep the documentation of DGVMTools down to a reasonable size. This idea is that that function is called internally by compareLayers(). If it is useful to you (and others) I can export it for use outside DGVMTools. In the mean time the function is very simple you can just define it in your script/environment. Here it is :

calcNME <- function(mod, obs) {

return( sum(abs(mod - obs), na.rm=TRUE) / sum(abs(obs - mean(obs)), na.rm=TRUE))

}

Where mod is the vector of modelled values, and obs is the vector of observed values. Does that work for you?

MagicForrest commented 4 years ago

Hi Halima,

Did this work out? Can I close this issue?

halima1993 commented 4 years ago

Yes you may.