 Hello, this is Hans van der Krust, Senior Lecturer at IHE Delft Institute for Water Education. In this video, I'm going to show how to import point data from meteorological stations into PC Raster and to interpolate that to Raster. You start the Anaconda prompt and I do a directory listing and I see a couple of files that we're going to use. Let's first have a closer look at precipitation.tss, which is a PC Raster time series. It comes with a header, then the number of columns, then we define time step as the header of the first column and one, two, three, four as headers of the four columns with the rainfall data corresponding with the stations that measure that that we have in the map, which will come later. So the first thing we need to do is to make our precipitation data that we collected from the stations to be put in this text format. So it can be read by the script in PC Raster Python. Now we'll have a look at stations.text, which is also just a text file. And this is the column format where we have the x-coordinate, the y-coordinate, and the IDs of the different meteorological stations. So you need to prepare a file which has x, y, and id, preferably spaced delimited, but in the tool to convert this to a map you can also set other delimiters. We can convert this text file using call to map, which is a tool which comes with PC Raster. And here you see how you can use it with all these arguments. Let's use the default way first and see what happens. Stations.text, and then the output stations.map. And I define the clone, which is the DEM. So it will get the dimensions, cell size, etc. from the DEM. This is it. So it's important to read these results because it gives feedback that four records were read and that's exactly what we wanted. And let's visualize it. That's the DEM and that stations.map. We see the four points, but it has a continuous scale. So it is imported as scalar and we need it as nominal. So we're going to add n for nominal here as an argument. Now it's converted. PC Raster always overwrites previous things, so if you give it the same name to overwrite. And here we see it as a discrete layer with four classes. So now we know the data we can write the script. This is a dynamic model template. And I'm going to replace in the initial the pass with read.map with the stations. And we use self.met stations because we want to use it in the dynamics or make it a global variable. And then I use self.readmap to read the raster layer, which is stations. I don't need to add .map because in the initial it will read stations.map because it knows to look for .map files. Then I need to prepare a mask, a Boolean mask that I need for the inverse distance interpolation, the IDW interpolation, because it will interpolate within the mask. And the easy way to make a mask is to use the Boolean function, it needs a Boolean mask and then add one. Then it will turn the clone map, the m.map in this case, to a map with only Boolean 1, which is required for the IDW. And I'm going to define variable with the string for the TSS file so you can always change it in the initial when you have a new file and you don't have to go deeper in the script. So self.pressed.tss equals and then point it to the file with the TSS that we've seen before. Then we can create decent polygons out of the matstation data, so still in the initial because those polygons are not going to change with time, but we use those polygons later to assign the values of the matstations. So we use the spread zone function, you can find the usage of all these functions in the PCOS documentation, but if you use the spread zone like this, we need to have the matstations with the numbers and zeros for what was no data and a friction of one and then zero and that will in fact make the decent polygons around those stations. So now we can proceed in the dynamic section, which will be iterated in time for 10 time steps. The first we're going to read the precipitation at the matstations for each time step and create a map out of that. So I call it precip at station, that's the variable where the rainfall data at station will be put in. The function is time input scalar and the first argument is the TSS file and the second argument are the stations on the map. So this links for each time step the value in the table for precipitation to the meteorological station which has the same numbers of the columns in the TSS file. So that does the trick, but then we only have precipitation at the stations. So we need to interpolate it. One of the interpolators that I'm going to write in this script is the inverse distance weighing. So let's call the output precip IDW and the function is inverse distance, it has 5 arguments. The first one is the mask for which you want to interpolate, therefore we defined in the initial that Boolean mask, it requires a Boolean mask, so it will only interpolate for cells that are Boolean true. Then the second argument is R the value which you want to interpolate, so that's the precip at station. Then the next argument is the power, so we use the power of 2, that's for default, and the other parameters we keep at 0, which has to do with the search radius. The second interpolator that we're going to use is the T-cent polygons that we already have calculated, so the only thing we need to do is to assign the precipitation to those T-cent polygons. This is in fact very similar to line 32, the only thing is we use another map to assign it to, so the first argument is the same, precip TSS read from the table, but instead of assigning it to the IDs of the stations, we assign it to the T-cent polygons which have the same ID as the stations they belong to. The last step is to write this to disk and we use the self-report function for that. Let's do first the IDW, so that's the variable and then I save it to the dynamic map stack which starts with the string PIDW, so it will create for the first time that PIDW00, etc. .001, so the 8.3 rule. Then we report the precipitation for the T-cent polygons in PTH, and that's it. So we have our clone defined, the number of time steps which is 10, going to save the file and then run it. It runs without errors and then we visualize the results with Aguila from time step 1 to 10 with an interval of 1 and there are the two interpolated maps and as you see they are animated because it's a whole time series and you can even see the graphs of a certain pixel and I can loop the animation and you see for that pixel you need to interpolate what the value is for the rainfall. So in this video you've learned how to import rainfall data time series into PC Raster and how to then interpolate the data to make Raster time series that you can use further in your models or visualize.