 This is on. Can everyone hear me? Understand me? Thanks. All right. Well, thanks for having me here. My name's Eric. I'm a software engineer at CSDMS. And I'm going to talk to you today about PIMT and how it can make models more accessible. So first, what is accessibility? So some definitions are easily obtained so that we want that in our models. We want to be able to get models easily and CSDMS has done a good job of that in getting together a collection of models on GitHub as some model metadata on our website. But PIMT, we want to bring that to the next level so people can programmatically look for models. They can ask models what they provide. They can search models for what they provide or what they use. Accessibility is easily approached. And incidentally, I had a picture of a Python here because PIMTs in Python, but my daughter thought that was too scary. And so it wasn't very accessible. So puppies are accessible. So we want models to be easily approached or entered. We want the barrier to be low so people can get new models that they may not have seen before and know how to use them right away. Easy to talk to or get along with. We want models to be able to talk to one another but also talk to humans, play well with one another. Easily suede or influence is another definition of accessible. Yeah, I guess we want models to be able to do what we want them to do. We want to be able to change them. We want to be able to add to them. And so that's what I mean by an accessible model. Now, before I get into PIMT, I'm going to describe to you a tale of woe, and it's about a model that's not particularly accessible. One may call it inaccessible. I'm not going to name names, but it starts with an S, S, and it ends in ed flux. And it's a model that I wrote. So it is easily obtained. The source code is online and people can get it, no problem. But I have to say it's not particularly accessible. I get emails quite often about they were unable to compile it or build it. So what are the input files like, the output files they don't know how to read? I get a lot of these sorts of emails. Now, to solve that, PIMT can help solve those sorts of issues. When your model is brought into PIMT, so this means your model has a BMI, so most people here know what a basic model interface is. It's just a standard interface that all models can speak. So once you've done that, you bring it into PIMT. We do a lot of things that for you and for your model that can help out with accessibility. So for instance, when we bring it in, we need to build it. So if your model is written in C or C++ or Fortran C, one of the things we're going to do is build it and we'll distribute it as a pre-compiled binary that your users can download. They don't have to worry about compiling anything, and we'll have a recipe on how they could compile it if they wanted to. So this would solve a lot of problems for that model that I was talking about that wasn't going to name because I could just point them to documentation that we have already or an online repository where they could just download their model or download a model without having to build it and compile it. That's a pretty big barrier for a lot of people. Because when it's in PIMT, it has a very standard interface, it has a BMI, which means that we can write automated tests for it. So we can write just a general set of tests for your model, and we'll test those all the time. So we'll make sure that your model doesn't suffer from bit rot, and that's generally the cause that makes most models inaccessible. Maybe some dependencies change, compilers change, things like that. So we'll be constantly testing your model through the BMI. So we'll offer that for you too. We could do nightly tests or weekly tests, whatever. And then documentation. We'll provide documentation for your model, how people can get it, how people can install it. So all of this is part of being in the PIMT community of models. So those are reasons why you might want to get your model into PIMT. And that doesn't even address the coupling thing. So if you wanted a couple models, PIMT is what you're looking for. So to begin with, PIMT is a Python package. I think most of all it's a collection of models, of Earth system models. And it's a BMI-based framework. So in Python, so we take models from lots of different languages. We wrap models automatically from C, Fortran, C++. We bring models in from Python, of course. Another group in the Netherlands, they have wrappers for MATLAB code, so they can take MATLAB code, send it through Octave and then into Python, so they can couple MATLAB codes in PIMT. They also have a web API, that's PIMT, or that's BMI, so it's PIMT-compatible, where you could run models on different servers, run them remotely. So it's a collection of BMI-based models. And then, of course, it's model coupling tools. So for models to communicate successfully to one another, they need to be able to speak the same language, but they also need to be able to map, say, from one grid to another grid. So maybe the grid's one's an unstructured mesh, one's a structured mesh. So we have tools to help with that, or to do unit conversions or time interpolation. So those sorts of issues. So PIMT also provides some solutions to that. If you want to find out more about PIMT, you can do PIMT.readthedocs.io. And that'll get you started with PIMT. So if you were to install PIMT on your machine, you can do that through Kondas. We use the Kondas package manager for all of this, install PIMT. And this will, depending on your operating system, will download a collection of models with it as well. Although we accept models from lots of different languages, we don't. And PIMT itself will run on different platforms, whether your model is able to run on all the platforms, depends on how it was written. Pretty much every model we have is written for Linux and Mac in mind. And Windows seems to be left out a lot. So if you're on a Windows machine, you may not have access yet to all the models in our repository in the PIMT repository. But we're working on fixing that. It shouldn't be too hard to port many of those models to Windows. Okay. So I'm going to run you through a notebook that uses PIMT. Show you just how to run a very simple model. So I hope this model isn't too simple, but it will go through and show you just what a model looks like in PIMT. And if you not use one model, you know how to use every model. This is a model that will, called Frostumber. And it takes as input mean or maximum air temperature, minimum air temperature for the month. And it calculates a fraction of the year that the ground is frozen, I believe. So it's called Frostumber. But it's a very simple model. And with the BMI in PIMT, it doesn't have to be a model like this. It could be a data set, or it could be a workflow. If you're wanting to maybe go grab some data, process it, and spit it out. That could be a BMI model in PIMT as well. So anyway, to get started. So of course, we first import a bunch of stuff like we do in Python. And then the PIMT bit. So we're going to import all the models that I currently have loaded into PIMT. So it just prints out a collection of models that I have. If you were to run this, you may get a different set depending on what you have loaded in your platform. Okay, then we instantiate the model. So now we take the FrostNumber class and create an instance of FrostNumber. We can get some information about FrostNumber if we'd like to. So, well, first of all, you could get help on FrostNumber. So it prints out some nice documentation about some of the input parameters. Just like any Python object. Or you can call, you can look at maybe some, maybe the output variable. Or how about the input variable, the input var names? So we get all the input var names. And so every PIMT component will have these attributes that you can look at. Now we go to the setup stage. So every, I'm going to take just a little bit of time to describe this as a little, it's important. So the set, so every model will have some input files. And these, if you know about BMI, the input file is what you pass the initialize method. So what we are trying to do here, because every model has its very idiosyncratic input files, they're all very different. We want to try to abstract away the idea of an input file. Make it so that a user can programmatically set variables in an input file and create input files through Python and through the setup method. So we use a templating system to create the input files. And so what this command that I'm showing right here would do, would create a default set of input files and store the name of the input file. And the folder where it was created. So we're going to do this just for some default input files or default parameters. And just for fun, I'll show you what the input file looks like. But you never actually have to look at it. You just have to pass those parameters to the initialize method. You get it. So in this case, the frost number model as input file that looks like this. So basically, it's a text file where every line is a different parameter. But again, you don't actually ever have to look at that. That's the idea. Okay, and as I said, those are just default, default parameters. So you could create another set of input files. And so this will create another temporary folder with that same input file I showed you except with minimum max mirror temperatures reset to different values. So now that you've got a set of input files, you can initialize the model. So that's what I've done in this line here. So you frost number dot initialize, that's the BMI initialize method. And then we pass the configuration file in the configuration directory. So it's going to go into that directory, read the input files, allocate memory, set initial values, those sorts of things. And now it's ready to time step. I'm running out of time a bit. So I'm just going to jump forward a little bit. So now I'm going to show you how you could couple the model to, in this case, just a very simple data set, but it could be another model. It could be a complicated data set. It could be anything. And then we're going to advance it through time. And we're going to set its values and get its outputs. So what I'm going to do here, so I'm going to get a pandas data set. Or I'm going to create a pandas data frame from this. Just a very simple data set that I've put up on GitHub. So here it's just a CSV file really of minimum air temperatures and maximum air temperatures for six different years. So I'm going to just save these into some temporary arrays. And now we're ready to time step through the model. So I'll just go through this a little bit. So here the for loop is over six years. Before we update the model, we're going to set the value for the minimum air temperature and the maximum air temperature into Frost number. And we're going to update Frost number so that we'll do the calculations. And then we'll save the calculated value or output value. Then we can plot that up. So it's a very simple example, but if this model is more complicated or if you're coupling to a more complicated data set or coupling to a more complicated model, it would look the same. So we hide all those details and then we can plot up some output. Just to see that, yes, the Frost number actually did change with time as we moved it. So I know this is a very simple example, but I hope it just gives you an idea of what a model would look like in PMT. And that it could be a very complicated model or a data set or a workflow or anything could even be a GUI. You could wrap a GUI in the BMI. So that's all I have for you. I think I've gone over a little bit. So if you're going to come to the clinic tomorrow, you may want to, if you could, I was supposed to send out an email, but I didn't. Install Anaconda on your machine that would help out a lot just to get us going. And then we can install PMT and we'll run through some more complicated examples and I'll answer any questions that you have. So that's it, thank you very much, I appreciate it. Maybe there's time just for one question, one burning question for Eric. Somebody has that. I'm going to go all the way to the back to Jason, go ahead. The BMI Python, so it depends on what you mean by BMI Python. We use that word for a couple of different things. Do you mean that there's a package called a repository called BMI Python? Is that what you mean? Yeah, so that is just what, that's just a specification of what the BMI, the basic model interface, would look like in Python. So for every language, we have a different BMI specification. That's tailored to the language. So I think what you saw is what the BMI would look like if you were writing a Python component and how you did it. Yeah, yeah. And then we have to bring models that are written in different languages with a BMI into this. We have different wrappers for that so that they call running Python. Good, yeah.