function ssl_set_union, set1, set2
if(size(set1, /n_dim) eq 0 && set1 eq -1L) then return, set2
if(size(set2, /n_dim) eq 0 && set2 eq -1L) then return, set1
if(size(set1, /n_dim) eq 0) then begin
dprint, 'Set1 passed to ssl_set_union is not an array'
return, -1L
endif
if(size(set2, /n_dim) eq 0) then begin
dprint, 'Set2 passed to ssl_set_union is not an array'
return, -1L
endif
u = [set1, set2]
u = u[bsort(u)]
idx = where(u ne shift(u, 1L),count)
if (count EQ 0) then begin
return, [u[0]]
endif else begin
return, u[idx]
endelse
end