Water Resources Management with the Wolfram Language

Ricardo Martinez Lagunes from the Inter-American Development Bank shows how to use the Wolfram Language to model water systems. He organizes water challenges into four phases: access, availability, healthy bodies, and extremes. The talk includes interactive tools for tracking household water use, utility performance, sanitation options, and how water flows through economies.
Chapters
Hi, my name is Ricardo Martinez Lagunes and I work with the Inter American Development bank and I will be talking about water resources management with Wolfram language. So the first thing I want to talk about is the different phases of water. And to talk about that I I did a tetrahedron that shows the four main phases of water. For example, we have access to safely managed water. I put the picture of children because many people in the world do not have access to water and sanitation. A lot of children die because they don't have safely managed water. That's one of the phases of the tetrahedron. The other phase of the tetrahedron is availability water. One thing is to have the pipe that takes the water to your home, the pipe that takes the sewer to the wastewater treatment plant. Another thing is to have enough water for industries, for cities, for agriculture, for all the different uses. The third one is healthy water bodies. We want our rivers to be free of pollution and be able to sustain life. The fourth one is about the extremes. The water availability changes from one year to another. Sometimes we have a lot of water, we have hurricanes, we have droughts, we have floods. Those are the main four phases of water. And then there is a cross cutting issue which is water governance, which means we need to have strong institutions to be able to manage water appropriately. Now let's start with access to safely manage water and sanitation. By the way, I will not cover all the four phases. It's just to have a framework. But we don't have enough time to go in detail with each of the phases. And besides that, I haven't really developed applications for each of the four phases. So for wider and citation, the UN member countries agreed that water and sanitation are human rights. There's also a sustainable development goal that says that we should have everybody in the world should have access to safely managed water and sanitation. That means they should not get sick when they drink water. They should be able to dispose their excreta and everything. Household SURVEYS Most countries do household surveys and they are a very important tool to get information about what is happening in each dwelling, what is happening in each household. But usually it's a lot of information, usually analyzed with SPSS and Stata, But I'm using Mathematica, which allows me to not only do household surveys, but many other things. This is an example. So the survey is summarized in an array of 34 by 7 by 6 by 9 by 6. This is an icon that has all the information. And we can retrieve the information by giving some coordinates, some coordinates of the whole array. And this is an example. For example, 33 means the whole country. And then 7 is the year. And then we can have rural, we can have urban, and so on. So you see a bunch of numbers. And when we go to the application, which is a CDF file that we used for the National Water Commission, then you can see the interpretation. The interpretation is that maybe this is the best way to see it, is that. Only 57.7 of the population. This is the case of Mexico. Only 57.7% have access to water at their homes every day. And at the same time they have a toilet for the use of the dwelling, exclusive for the dwelling with a connection to a sewer or a septic tank. I'm sorry, everything is in Spanish, but I wasn't able to translate the whole thing. So the application allows you to see with more detail, less detail for different years, for different states of country. You can see the numbers. For example, here, this is another year. Maybe I'm making it too big. So here you can see, for example, this is the population of the whole country. And you can see that only a few people are in the green area. The rest are in the yellow and red areas, which means that they don't have appropriate ways of safely managed water and sanitation. You can see other graphs, but here we can see state by state, these indicators you can play around with the application to see. For example, usually rural is really in a worse situation. In rural areas you find that a lot of people have septic tanks, which may be okay if the septic tanks work properly. So anyways, this is just an application of Wolfram with household surveys. The next one is performance of water utilities. Water utilities usually have what is called non revenue water, which is losses. Losses are huge. About 50% are losses. Some are real losses. That means water that gets lost in the pipes. And some of them is because simply it's unaccounted water. The records for the clients, the records for the meters are not correctly managed. It is important to understand what is happening in water utilities. I have another application that we developed for a program of the Inter American Development bank and the National Water Commission of Mexico for several water utilities, about 110 water utilities. And well, it shows the histogram. And then we can analyze the different water utilities and see what happens. For example, one indicator is the number of employees divided by the number of connections. So you may have a lot of employees for a small number of connections. And you can see here the line that shows the trend for the different. For the different water utilities. And you can play around with different variables. What's more important is to understand the performance of each water utility. So you can compare with a uniform framework. We can do it to compare several municipalities. For example, this and what we're seeing here. Let me try to contrast it with another one that is a little bit different. All of them are very low. But anyways, here what we can see is that for example, this is the amount of money that is collected for each connection. If you accounted for the whole water produced, then for the water that is actually built and then for the water that is actually paid. And then the green area is how much you pay for salaries for compensation to employees and EE means how much you pay for electricity. Electricity is, is one of the main expenses for water utilities. You can see it in this case in pesos or in dollars. But you can also see it in liters. Here you can see I change it to liters, for example, I can change the scale so that we can see it and it's all normalized so that we can compare. I will move, I will make this scale a little bit larger. We can display it in a different way. This was very helpful to understand what's going on with the different water utilities. See for example, this says 1400 liters per each connection. That's the amount of water that is produced by the water utility that is injected in the system. But in the end, only about 600 liters per connection were actually paid. And this unaccounted water or non revenue water is about 44% in this case, 45% in this case. It's all in physical terms. Of course, you can do it in monetary or physical terms. So that's another application. And so it's important to see what happens to compare the different. Since they are all in the same normalized way, we can compare the different water utilities. So that's another issue. Sanitation options Sometimes we think as city dwellers, we think about the solution of having a sewer and then a wastewater treatment plant and then the rest, well, regular toilet, sewer, wastewater treatment plant. But in rural communities it's not necessarily the best option. So we have to explore different options. And there is a Swiss institute that created a set of technologies that can be combined. But the book is a little bit difficult to read to understand. And so this application allows us to check each of the systems, each of the trains, that allows us to dispose of the Expeda to safely manage sanitation. So see for example, here I choose you start with a user interface. In the case of our cities we're used to the, to the interface which is something like this. Maybe we don't have the separation of urine. So that means we have a simple. Maybe something like this. No, this is more rural, but the more conventional one somewhere in here. But it's the u. The user interface, it's right here. So this is the usual, this is with the separation, this is the usual toilet that we know. And the usual toilet mixes all these things like the toilet paper, the excreta, the water that is combined with excreta and the urine. Then at the end you get wastewater that is all combined and that you have to process. In this case a tank of urine is not enough, so you would have to change it. You can play around with the different options. You can start with an already a pre arranged set of solutions and then change for each case and see at the end what is it that you are releasing to the environment. So that's another application. So that's it for the first phase of the tetrahedron. Now the next one is about water availability. How much water we have in the aquifers, how much water we have in the watersheds, and how we share it with the different users. Not only the cities, but also the industries, agriculture, hydroelectricity. We need to understand what's going on in the different watersheds. Now watersheds, in the case of Mexico river basin is divided into many watersheds and smaller pieces. So by using a graph, I mean we started using Excel. But it gets complicated when you try to connect all the pieces. So here for example, there's a tooltip that tells me the name of each of the watersheds, how they connect. And at the end, for example, this goes to the lake Chapala. Let's look at for example Rio Bravo, which is Rio GRANDE in the U.S. it's a river basin that we share with the U.S. let's see the Mexican side. So everything is here in this icon. We have 338 systems with 700 and some watersheds. So let's see, this is a larger, has more components and it goes all the way to the Gulf of Mexico. And for example, this is Rio Florido and so on Rio Valleza and so on. Rio Conchos. Maybe you've heard of Rio Conchos because of the conflict between the US and Mexico and Rio Conchos and so on. Rio Bravo. So Rio Bravo is from the Mexican side and Rio Grande from the US side and so on. There is another huge river basin, which is the Grijalba that has a border with Guatemala. And this is also very complicated, as you can see. And the important thing here is the balance of the water. Balance that we can do. Of course, we have the application that allows you to. Instead of just putting numbers, you have names. And then you can see some of them are very simple, but some of them are very complicated. And also the important thing is to balance the balance water between the different. I will open another cdf, which is balance. So it gets a little bit tricky because if you take water from one watershed, you affect the one below. So this is an example, not just to play around with the numbers. So you may have a certain amount of water that is coming from upstream, then you have a certain amount of water that is raining in the area, and then you have an amount of water that is being abstracted. And at the end, you're left with the difference. Now, what happens if you increase the amount of water that you abstract from the first watershed? Of course, you affect the watersheds below. And the solution to that is basically, you have the graph and then you have the adjacency matrix. And then you do some operations with the adjacency matrix. This shows the operations, and this way you get the new balance. This was done in Excel, but just by trial and error. But this is a much more efficient solution. You can also get the average runoff as water moves from upstream to downstream. There's also a solution with matrices, with the adjacency matrices that are created from the graph. This way you can get the runoff. Well, this is an exercise with a very small system. And then we can add more complexity to see how it works. People can play around with the numbers and have a feeling of how the system behaves before doing it in a natural system. This was done for the National Water Commission of Mexico. Okay, so that's one aspect of. The phase of water, which is water availability, and the next one is aquifers. So, for example, here we can see the information for each of the countries divided into 653 aquifers. The number is higher because it's a code. So it's the number of state and so on, but it's 653. The country is divided into 653 pieces, and we need the information for each different year. So we developed an application to be able to visualize the information of the. Of each aquifer in the country. Actually, the name would be hydrologic unit, hydrogeologic unit, instead of aquifer, because aquifer is a more specific name. Basically, you can see Here with the same data that I showed before, how it behaves throughout the time and what is going on with the recharge, with the availability, with the different elements. And you can check it for each of the 653 aquifers. So this is another application. So you just change the number. And this has turned out to be very useful to understand what's going on in the country. Okay, so let's move to the next one now here, and this gets more interesting when you combine economic activity and you try to find out what happens. For example, if a country grows, we usually say GDP grows by, I don't know, 2% or 3% or now it's like 0.5%, whatever. So the country grows in terms of economic activity. But what happens to the natural resources in the country? In order to solve that problem, countries using the standard, which is the national accounts, the system of national accounts, which has been agreed in the United Nations, World bank and all the big international organizations, countries are using this system in order to determine their gdp. But we have to go beyond GDP and measure the stock of natural capital. Basically, to solve that problem, we need to look at the input output tables. Sometimes the input output tables are like maybe 300 by 300 in some countries, maybe 100 by 100, depending. I worked with Uganda, with Mauritius and several countries. The nice thing is to be able to play around with the matrices and see what happens with different scenarios in this application. Basically behind the scenes you have these matrices and the, the amount of water that is abstracted. And basically at the end of the day what you want to see is what happens. For example, in the case, this is called the sugar land example because Mauritius, the economy was based on sugar mainly, and after sugar it became a touristic place. So what happens if the growth of tourism is 10% and the growth of the population is 3%? The losses in the water systems for agriculture is 60% and the losses in the water supply in the city systems are 60%. This is what you would get, PB's GDP. So you have a growth of the GDP, but the level of water in the aquifer is going down. The problem in Mauritius is that it's an island. So what happens is if you abstract too much water from the aquifer, then you get water from the sea and the whole aquifer is lost because you get salinization. This scenario is not good. Well, in this case, in 10 years you still have some water left. But if you increase the growth of tourism, you get a point where you ruin your aquifer. What can you do if you want to have a growth of, in this case, for the example, 16% of tourism? Well, maybe the policy is to increase the efficiency of use in, in your water supply networks. If you do that, then you can have the growth and maintain the health of the aquifer, so you protect your natural capital. So this shows the relationship between the different products that the country produces. It's a simplified version of 6 by 6, but as I said before, you can have a 100 by 100 matrix that shows that, for example, in order to produce sugar, you need to first have the cane of sugar and then from the cane you use it for manufacturing and so on. There's just a matrix of relationships that you can also show it with a graph. So that's another application. And also for didactic purposes, there's another example. The Sugar Land example is based on a true story, but this one, Applean, is just a made up story. It's supposed to be a town that produces apple, apple pie, apple whatever you think, apple land. And this shows the interrelationships in physical units. So you have wheat to produce flour, you need wheat to produce an apple pie, you need wheat and you need apples and so on. So all the interrelationships, you put it in kilograms, you put it in liters, for example, in the case of milk, to produce the butter. And then you translate it into monetary units, dollars or pesos or whatever. And you can do the matrices in physical terms and then in monetary terms and do all the operations. The nice thing here is that you can change the number. For example, if you increase the number of pies that you produce, you can see the effects on the other products. And this is very useful just to understand how the other system that is more complex works. And I think I'm getting to the end of my presentation. I don't have a lot of information about the phase, the tetrahedron phase of healthy water bodies. But basically we need to process. There's a lot of information about water quality. It's very complicated because you have so many parameters. And then the cycles of droughts and floods. Just an idea. If we have seasons, we have the wet season, the dry season, and then we have dry year and a wet year, maybe one day. If we're able to discover the original. This is just a dream, the original cycles, this is like a Fourier transform of the different cycles, the seasonal cycle, the yearly cycle, and so on. But this is just an illustration because it still doesn't have any application, and I don't think it will for a long time. Finally, the cross cutting issue. We have the four phases of the tetrahedron that are very specific, but then we have water governance. For that we did an application that helps us with the Sustainable Development Goal 6.5.1, which was agreed by the members of the United Nations. That is the degree of implementation of integrated water resources management, which is a concept that includes many things. Each country has to do their own evaluation based on the national policy legislation and so on. So we can play around with the numbers depending on on how the different aspects are evaluated, you get an overall evaluation. Well, this is the end. I still have 30 seconds to say thank you very much and have a nice day.
More from Guy

Cheryl Strauss Einhorn | The Human Edge: Smarter Decisions in the Age of AI | Talks at Google

Rachel Glennerster | Innovation and the Center for Global Development | Talks at Google

Rebecca Winthrop | Rethinking the Purpose of Education in the Age of AI | Talks at Google

Dr. Robert Wachter | A Giant Leap: How AI Is Transforming Healthcare... | Talks at Google






