 All right. Well, good morning, everyone. I think everyone can hear me. I hope I think it's a it's 1001 So we've got enough people here. Maybe we can get started. All right. I'm told you can all hear me Well, first of all, thanks very much for joining me today So to learn a little bit about pi MT. I'm just going to give you a very brief description of pi MT today And maybe in some future Webinars we can get a little bit more into the details So pi MT is a CSD mess is Python modeling toolkit it used to actually form the Backend to what we call the the web modeling tool which was basically a graphical interface that users could use to To run models into couple models But we decided we tried to clean that up and bring it out and expose it to the community So developers and model users can run models directly through Python and through a an interactive environment so most of this presentation is going to be based on the documentation page for pi MT and Let's see. So mark actually if you're paying attention, maybe can you put the link in the in the chat? It's pi MT Dot read the docs dot IO and this would be the place that you would go to for all things related to pi MT And so before we continue As you probably know CSD mess well used to be housed at University of Colorado, but recently we moved into Hogwarts and so today I'm coming to you from the Great Hall at Hogwarts So it sounds a little echo-y. I apologize So I'm going to take you through first of all the documentation page here and Take you through some useful links that we have And these are to the left under useful links So I'll start from the bottom here The first thing is the issue tracker So we'd recommend that if you have any questions Any feature requests you find any bugs you want a new model to be introduced into pi MT This would be the place you would go You can also send me an email directly or CSD message email directly But we'd rather you go there So if I click on the issue tracker You can see it'll take us to github And to to file a new issue you just have to click the green button And then fill out the issue You could label it as a bug a Question you know an enhancement if you want to add a new some new a new model Or you'd like us to add a new model So that would be the place to go this would allow especially for bugs or if you run into any problems Other people can also see the issues so that they can So if you fix that they can look to you to your solution to fix their problem As I just showed you pine teas also and on github as is all CSDM software So this is the CSM at a pine tea repository And we absolutely welcome pull requests. We would love it if you fork pine tea And if you have find a bug and you can fix it or you have an enhancement or whatever Maybe or even just documentation the documentation is all added here. Maybe just a typo you found Please submit a pull request and we'll review it as quickly as we can and get it into the main branch Let's see. So the next one will be the pine tea plug-in. So plug-ins here refers to models So these are models that are part of pine tea So I'm not going to talk about this too much today. This will also be in a future webinar, perhaps This is just a list of repositories with light wrappings of models written in different languages So that we can bring them into pine tea So for this first case we have child Which is a c++ program that has a BMI and there's a very light wrapping here because All of these models expose a BMI we can automatically wrap each of them So that they can be imported into pie and tea and we'll just Python in general So this is where they would be housed. I'm not going to say any more about that We'll save that for another time And then finally pi mt is installable From condo forage. So if anyone uses the anaconda Python distribution They would know that conda is a package manager that they use and so we tap into that. So all CSDMS products are conda installable So that means we build for all of our packages As well as all the contributed models to pi mt. We have condo recipes that build pre-built binary Libraries for each of the models and all our software so that it can easily be installed on different platforms Without users having to compile them This eliminates a lot of headaches for us and for model developers Now if so all the products that CSDMS writes are going to be compatible with Windows and Linux and Mac and if Python is involved, we're only going to support Python 3 from now on That's a choice we made. It just simplifies things a lot on our end If people contribute models that haven't been written for all of those platforms Until we port them to those platforms or someone ports them to those platforms They won't be available. That's not something that we automatically do So for instance many people Model developers will write their models to work for Linux and then Mac So I think all of the contributed models we have now will work for Linux and Mac But not all of them will work for Windows for instance, but we can definitely port them over if possible or if there's a demand So those are some places you can go to To get some help with PyMT So now we can dig into PyMT just a little bit more. So just in three points PyMT is One it's a collection of coupling tools It's a toolbox that includes tools for coupling models that operate on different computational grids Most of our models I suppose operate on a uniform rectilinear grid But many of them also operate on unstructured grids or even a different uniform rectilinear grid that of a different resolution So we include Model coupling tools like the SMF mapper grid mapper to map values from one grid to the values of A grid for another component They'll operate sometimes at different time steps and we may have to do some time interpolation So we have tools for that So that we can Advance a model if we need to advance a model to a partial time step and it's not able to do that Internally we can keep trip we can Interplay between the between two time steps so that the models can sync up and exchange values at the correct time So we have lots of tools like that But again, I'm not going to talk about that today That could be a future webinar as well I'm going to talk about these next two things so Pianti is primarily a collection of Earth surface models that are importable and runnable within Python interactively within Python All these models have been imported because they import because they expose a basic model interface Once they're in Pianti, we then decorate this basic model interface make it a little more human usable The BMI was really intended at first for machines to talk to one another and it may seem a little clunky To use interactively within Python So we've tidied that up a little bit and made it a little bit more polished in Python and Pianti And then it's also an extensible plug-in framework so that we can easily add New models into Pianti as they come in so that would require wrapping them with a very light wrapper as I mentioned before We do that with models written in C and C++ and Fortran and of course Python There's been some requests to include additional languages and depending on the demand we may go down that road as well That's what I'm going to talk about today So I'm going to scroll down here a little bit and jump into the quick start Just to show you What how what it would be like to install Pianti So this would be if you're installing Pianti as As a user so as a developer you can of course install it from source But the youth users would normally install it with Kanda So Kanda is a package manager So Kanda install Pianti and then this dash C Kanda forage just tells it where to look So Kanda forage is an online repository of Kanda packages and that is where we publish all of our Packages including all the models that are included in Pianti and whether they are Python Whether they are Python or C or whatever they're included as pre-compiled binaries Sorry, I was looking at the chat. I got distracted and then so as I said so that would that would install the base model of of Pianti the basic the core Pianti Then if you want to install an additional model and so a plug-in you could install as a separate package So here we would install Con install Pianti hydra trend and so this would download hydra trend a pre-built version of hydra trend. It's a C model So that it can be imported into Pianti So that's how you would install Pianti Now I'm going to run through Just how you might want to use a model that is in Pianti. So I'm going to jump over here to a Jupyter notebook and Actually, I'll start a new notebook Python 3 Okay, and so we're going to install we're going to use The coo model and I'll explain this a little bit more. It's a specific profile us model just as an example so first you do So from pi MT models How about we do Import Pianti models This will import all the models that are currently in my Installation of Pianti if you just installed that the default version you wouldn't have all of these So this is just a collection of a bunch of models some of them are C C plus plus But we're going to look at this one called coo And I'm going to use that for a couple reasons one. It's available on Windows Mac and Linux It's one of the few unfortunately that we have for Windows But maybe most importantly, I'm going to use that because it's the shortest name and It's easier for me to type so and it's easy It runs quickly so we can we don't have to wait for things to Do to run when we start to run it so we'll begin by So we imported all the models now. We're just going to instantiate one of the models So we have a model called coo now It's an instance of an object We can get help on it like we can with all objects in Python Sophie get some help on coo. It'll give a brief description of it. This is provided by the model authors And then we want to list the model authors The version and just some metadata that goes along with the model We want to make make it absolutely clear that this model is not a CSMS model Even though it's within PIMT so we don't want to take credit for it So we want to be very careful that the who that it the credit is taken by or is given the model authors and There's external links if you want to find more specific help about the model itself And then that lists a bunch of parameters that we can set with the coo model and I'll get to that in just a little bit Get rid of that And the first thing we want to do before we run a model and this is I'm going to be saying this over and over again So I'm sorry if I repeat myself, but I will So we're just looking at the coo model now But everything we do here will apply to all the models in PIMT They all have the same interface and the same methods and so anything that works with this should work with another model So when you're It's going to run a model the first thing you need to do is set up all the input files And this isn't a BMI method This is something that PIMT adds to your model and so this we call a method called setup And what setup will do will stay create a new directory and stage a new model run based on some input parameters So I'm we're just going to do this. This is going to do the defaults You'll see that it's created or it's returned a Tuple of two strings the first is the name of the configuration file it created and the second is the folder that it created it in So by default it'll create a temporary folder and we do that because the user never actually really has to see this I'm going to take you through a little bit today. Just so you can see what's going on in the background But if you really did want to Create in a separate folder, maybe in your home directory or current directory you can do that as well So let's see. So I'm just going to show you what's in this folder. We just created So these are all these text files were were just created by this setup method and then if we then we can look at the Configuration file that I just created So this is the configuration file that we just created So, you know, it looks like an input file, but it's a very specific format. It's specific to the perm-a-model toolbox and In all our models like this all all the models will have their own input file formats And so what we want to do with pi mt is try to abstract that away and Make it so that people don't have to worry about all these formats and they can just programmatically create and stage new model runs So if we go back to our our help I Said there were a bunch of parameters We scroll down here a little bit So all these parameters, so these are all parameters that we can set at the beginning of the model run that are put into the input file So for instance, here's one T error So I this is the air temperature and in some short and easy to type. So again, we're going to use that one So the default for air temperature is minus nine degrees Celsius. So we'll I don't know, we'll set it up to do something else So you do set up T error equals say minus 5.0. So now we've created an input file With these new parameters, hopefully I say hopefully, but of course. So if we go down here, we should be able to find T error. So now it's set it to minus 5.0 So this is an easy way to the setup method is an easy way to create new input files and it's something that pine T provides on top of your model. I'm going to show you one useful thing that we can do With this and we're going to enhance this in the future. So this is I'll just show you this As something that we are going to add to make a little bit easier, but you can do this now. So I got the little backwards, but so for so we're going to create a whole bunch of input files. Now, say so, we'll create a bunch of tears from 95 or from minus 20 to five. And then we're going to do that set up the air equals and then this particular tear. So now we've just set up a sensitivity study on for TSE we will see how tear affects the outputs of the cool model. So we just set up 50 model runs there. And then you can either go in, you know, from outside of Python and just run the command line on each of these maybe send it to a cluster to run on different nodes. Or you can run a different sub processes within Python, but it's an easy way to create a sensitivity study. We in the future are going to try to incorporate Dakota a little more into pi empty so we can make this even easier. You can construct more more advanced experiments like uncertainty quantification. And we'll probably to do that will probably use our we have some Python wrappers for Dakota and we'll probably use those to to get that into pi empty. Okay, so now so let's let's start again with a new models.coo so create a new coo will set it up. Just the defaults And now we'll start to get into some BMI methods. And so now that we've set up a new model run we need to initialize the two models. So in this step, we're going to read in The input files allocate some memory do that that sort of stuff do everything needs to be done before the model time stepping begins. So the coo initialize Pass those arguments to it. So now it's initializing the coo model. So now we're ready to go. Now we can start time stepping and examining the variable to calculated variables. And so let's so we can look at a, there's lots of different methods we can look at coo as this is the current time in the model. And where the units units of years Then to advance the model through time. We just do the update method. And now we should have a So right now time one. Okay, so now we know how to advance a model any BMI or any PIMT model through through time now we need to get some values out of it. So it just did some work and calculated something. So let's take advantage of that. And see what happens. So we would to do that. We would use the get value Method and then the first method. The first argument is a string that is the name of the argument, the variable that we want to get. So We're not familiar with this particular model. We need to know what pose strings are. So we'll just use the, we can just use the attribute output for names. And so this returns a tuple of in this case two strings, it could be many more could be none at all, although it wouldn't make much sense to have a model for the variables. So here we have soil temperature and soil active layer thickness. And so let's look at that calculated values for Soil temperature. This get value method if you're familiar with BMI is very much like that, but we've decorated it with a few, a few additional keywords so can do and I'll just get into that in a little bit. And in this case it'll allocate a new new array for you. Or you can pass a buffer to place values into Or you can pass a buffer to place values into So soil temperature. So this is new calculate soil temperature, but what are the units for this. So so pi mt adds a dictionary to your component called var that has the Information about each of the variables. In this case we have soil temperature and we see that the units are Are degrees Celsius. So if we go back here So it's degrees Celsius but say we have a component that wants to use different units. So we make that we make it easy so that you can get a value in particular units if you like as well. So if you want to change the units. So we do that through a unit keyword and we just pass a string for the new unit so we can get So this is the answer in degrees ranking. So if you ever have a model that runs in ranking for 79 is your answer for this thing. So again, so I've taken you through the very basic steps and it seems pretty simple, but I think just I hope just by this you've learned how to run a very simple model co model. With some easy steps and again this will apply to all the models in pi mt. So if you understand the setup the initialize the update to get and set values you've understood you understand how to run a complete model. I'm going to jump over to another example now still using the co model. And this will show how to couple it to in this case I'm not going to couple to another model exactly. I'm going to couple it to a data set. And this data set is going to be some temperatures from Barrow Alaska from 1961 to 2015. But I could just as easily couple it to another BMI model or a data set that's been wrapped with a BMI, but in this case it's going to just I'm going to couple it with a pandas data set. So we go and get the the data set and you can see the data set here. So I've just downloaded it from GitHub has three columns of data, each column is sort of air temperature, snowpack depth, and then the temperature amplitude. I'm not I think temperature amplitude is probably the difference in the highs and lows. So I'm going to assign now just each column to a to a variable. And then the next step as I did before, I'm going to instantiate co set it up, run the initialized method. And then now I'm going to start time stepping. So we have a for loop here that time steps through each of the years I think there were 50 years. And so now instead of calling the get value, we're calling a set value. So in co we're going to say co dot set value. And then this is the input var name. And then we're going to pass it the deval the appropriate value from our data set. We're going to do that for the three values. We're going to update co for a new the new time step and save the thickness. There we go. And then so now we've run co through a time through a data set time series from a data set and created some output. So this would not have been possibly easily possible from the previous version of co. So we've done here is abstract away the. So I think you could have done this statically with an input data set with co would have been a particular file format. So here we've used pandas to get the to bring in a data set. And then we've coupled that to the model so that we can dynamically change the values as the model runs. So that's basically everything that I wanted to cover for the most part. So I've shown you how to how to how to bring a model, how to import a model into pi mt. I mean, again, this could be any model. If you not use one model, you're going to know how to use them all and then how easy it is to run it. So I think as a model user, you'll find pi mt very easy to use. I'm very powerful when you want a couple models or if you just want to run a single model and experiment with it. I find it's a very easy way to play with models, particularly compared to working with models from compiled languages. Like see, you know, it's almost as though you're running it in a debugger. You can run it for a little bit, change some values, see what happens, see if the model blows up, see if something cool happens. See if there's a bug, you can advance it through time and see if there's instability. And you can use all the power of Python and all the tools that go along with Python as you're doing all this. You can advance it through time, change some things and plot up some results. And then so as a model developer, I think you'll also find it useful to use pi mt and to get your models into pi mt and we'll do a few things for you that maybe it wasn't obvious from this presentation so far that we do for you. So if you have a model and you put a BMI on it, that's 90% of the work. From there, we can automatically wrap it to bring it into pi mt. And in doing so, you get a bunch of advantages. So for instance, you can use your model, we will build your model as a condo package, so it's easily installable, we'll do that for you. So you don't have to have an installation guide for your model for other users, perhaps. You can just point them to our help pages and they can easily install a through condo install a pre-built binary version of your model, which is very useful for compiled languages like C. We will provide all this documentation on our website for you so you can just point them here. We'll construct a tutorial for your model as a Jupyter Notebook and provide it on our documentation page as well. You can see from this is from the main page under examples. These are all Jupyter Notebooks of some of the models that we have and we'll add that to this for you so that users can see that it's working. We will test these models regularly or test these notebooks regularly. We will include your model and model test into our continuous integrations. We'll test it regularly so users can be sure that it's working properly. As well as people will then be able to use it within the PyMT framework or within a Python framework just in general. So we'll do all these things for you and we might just give you a C semester if you'd be a my your model. I'm just saying I haven't run that by line yet but I think we could do that and we would love to have your model within PyMT. Just a quick story. Just how powerful this is. Someone recently asked me for a model that I wrote many years ago in C and I was responding to them. I was just writing this long email about how to compile it and all these crazy input file formats that I had come up with on my own. And then as I was writing this I realized no no no I just have to point them to this web page and they can just use the PyMT version of it and it's so much easier for them. We just would provide all this documentation for you. They can just go through this and then they'll know how to use the model. And if they're familiar with another PyMT model they'll know how to use it right away. So anyway I think I think that's all I had to say. That's right at 1030 so that was my goal. Anyway if you have any questions feel free to you can contact me directly or go to our issue tracker page or if you have any questions right now I'd be happy to answer them. Thanks.