A class of filters for large eddy simulations of turbulent inhomogeneous flows is presented. A general set of rules for constructing discrete filters in complex geometry is given and examples of such filters are presented. With these filters the commutation error between numerical differentiation and filtering can be made arbitrarily small, allowing for derivation of a consistent set of equations for the large scale field. The application of such filters for explicit filtering in large eddy simulations and the issue of boundary conditions for the filtered field are also discussed.