Modeling the complexity of environmental and ecological systems