FUNCTION MAGERRSUM, ARG, WC=WC ;+ ; NAME: ; MAGERRSUM ; ; PURPOSE: ; Sum magnitude errors (companion routine to MAGSUM) ; ; MODIFICATION HISTORY: ; 27 Jul 2007 Written by Mattia Vaccari ;- if not(keyword_set(wc)) then wc=99.0 if n_elements(arg) eq 0 then begin print,'Argument is undefined! Returning -1...' res=-1.0 goto,FIN endif else if n_elements(arg) eq 1 then begin print,'Argument has only one element! Returning argument...' res=arg goto,FIN endif res=-1.0 ;j=where(arg ne wc) j=where(abs(arg-wc) gt 1.e-3) ;if (where(arg ne wc))[0] ne -1 then res=total(arg)/sqrt(n_elements(arg)) else print,'No Valid Arguments! Returning -1...' if j[0] ne -1 then res=total(arg[j])/sqrt(n_elements(arg[j])) else print,'No Valid Arguments! Returning -1...' FIN: ;if res eq wc then res=-1.0 if abs(res-wc) lt 1.e-3 then res=-1.0 return, res end