 we're going to be working through this introduction to Neon Source Sensor Data products or Data Tutorial. And I put the link to that tutorial in the chat there so you can pull that up. I'm going to be live coding during this. And let me share my screen so you can see that. So hopefully you're seeing my RStudio window here and can see that. And this is the Data Tutorial. That link that I put in the chat that we're going to be working through today. There are two ways you can follow along. During this Data Tutorial, you can even just copy the code as I type it into R and copy that in on your end to work through it. Or if you prefer, you can scroll all the way down to the bottom of the Data Tutorial. And you can download the lesson code. And so there's this R file down here, soil temperature moisture at co2.r that contains all the codes that we're going to run through today in the tutorial. So with that, let's get started. And today, the format is going to be that we're going to take a look at some soil co2 concentration data and look at controls on that soil co2 concentration data in the context of soil moisture and also soil temperature. So do soil temperature and soil moisture seem to be influencing soil co2 concentrations at one of our neon sites? We're going to be downloading quite a lot of data. So we're downloading the soil temperature data product, the soil water content data product, and the soil co2 concentration data product. And we're going to be downloading a full year's worth of data. So it is quite a lot of data. And so I'm going to have us jump right in and begin with that data download. And then while that download is running, to probably take a few minutes, depending on everyone's internet connection, I'm going to show a few slides about how the data is collected in the field and also where you can find some more information about those data products. And then we'll come back to the tutorial again and start working with that data. So the very first thing, which hopefully a lot of you have already done, but if you haven't, you need to install the Neon Utilities R package. So if you haven't done that already, you could do that just by typing in install.packages and then Neon Utilities. I've already installed Neon Utilities, so I'm not going to run this. But if you haven't done it, please do that so that you can follow through with the rest of the data tutorial. But one thing that we will all need to do is load the Neon Utilities package into our environment. So I'm going to write library and then Neon Utilities and run that line so that we can work with the functions that are contained within it. And we're going to start off, as I said, downloading some data. Let's start off by downloading the soil temperature data. And so I'm going to put that into something called ST for soil temperature. We're going to make use of the load by product function that's contained within Neon Utilities. So right, load by product. It comes up with a little prompt here, so I'm just going to enter on that. And then if we click in the parentheses there and hit the Tab button, it comes up with a lot of the options that we can specify in here. The first thing that we want to specify is the DPID, or data product ID. So that's the identifier that Neon assigns to all of our data products. And for soil temperature, I can tell you what it is. And I'll show you in a minute where you can find that information. So you want to do quotation marks. And then uppercase DP, data product 1.00041.001. And that's the identifier of the Neon soil temperature data product. The next thing we want to specify is we can put a comma in, hit Tab again. We could pull up the list again. The next thing we're going to specify is the site. Today, we're going to be working with data from the Santa Rita experimental range in Arizona, which has a Neon site code of uppercase S-R-E-R. After that, we're going to specify the start date for the time period that we want to download. And we're going to download all the data from 2021. So I'm going to write, we've got start date equals, and then in quotation marks, 2021, Python 01 for January 2021. And then we're going to put in the end date to be 2021, Python 12. So December 2021. This is going to be quite a lot of data. Once we add all the three data products together, it's going to be around 200 megabytes. So if you're concerned about the amount of data, if your internet connection might be a little bit slow, if you prefer, you can reduce to a smaller timeframe. So perhaps change, instead of starting in January, you could change that to 01 to 06 and start in June, and just go through to August, so change the 12 to 08. But otherwise, you'd be able to continue with the rest of this tutorial. You'll just be working with a smaller data set. But otherwise, if you've got a reasonable data connection, we could download this full year worth of data. The next thing I'm going to specify is the package. There are two package types. We just can use the basic package. There is also an expanded package that includes usually just additional information about our data quality metrics, but we don't need that for our tutorial. So you can get by with a smaller, smaller basic package. And then we're going to specify the time index. The B soil data products that we're working with come as both 30-minute averages and also one-minute averages. We're going to work with the 30-minute data just because it's smaller than the one-minute data. And the last thing that we need to specify is this check size, check.size equals. I'm going to set that to F for false. So basically saying we don't want to check the size or the amount of data that we're going to download before we download it. If we didn't specify that at all or if we put a T or true here, then before we downloaded the data, this load by product function would give us an estimate of how much data we were downloading and ask us if we wanted to continue with that. But once you've worked with the data a little bit, it's kind of easier to have it set to false so you're not just getting asked for that. So now I'm going to run this line and it's beginning the data downloads. You can see that happening down here at the bottom of my screen that's identified these 471 files and it's beginning to download more. Well, that's happening. Let's just copy this whole line and we're just going to modify it slightly to download our soil water content data. So I just pasted it below. We're just going to change two things. So I'm going to change the ST to something called SWC for soil water content. And then we're going to change the data products ID instead of being 0, 0, 0, 4, 1, which is soil temperature. We want to change it to 0, 0, 0, 9, 4, which is soil water content. And again, I'm going to show you in a minute where you can find those data products IDs. Now we can run that line and the rest of the information all stays the same. You still want to download it from Santa Rita experimental range for the year of 2021. I'm going to copy it one more time and we're going to replace the SWC with CO2. This is where we're going to put soil CO2 concentration data. And that has a data product ID of 0, 0, 0, 9, 5. And then we can download all of that data. So while that is downloading, I just want to share a couple of slides about how this data is collected in the field. So I'm going to share these slides here. So this is just the sort of standard neon map that you may be seeing if you looked at the neon website, showing the location of all of our neon sites, 81 monitoring sites dotted around the US, 47 terrestrial sites, 34 aquatic sites. The soil data products that we're working with today are only collected at the terrestrial sites. And we're working with the data from the Santa Rita experimental range, which is the site that circled in red down at the bottom left here. So zooming in to what a terrestrial site would look like, or at least the sensor component of a terrestrial site, all of the sites would have the same basic layouts. Of course, there are slight differences in the ecosystems, but they're going to have the same sort of neon infrastructure in all of them. So over on the left here, we've got our instrumented tower, where we make a range of meteorological measurements, as well as the eddy covariance measurements and some other measurements as well. Below that, we've got our instrument parts, where we collect all the data from the site before sending it to the neon headquarters for processing. In the bottom left down here, we've got our precipitation gauge, surrounded by some wind shielding. And then all of the terrestrial sites include five sensor-based soil plots, and they're usually arranged in a transect, radiating out from the tower as shown here. So this is the Central Plains Experimental Range site in Colorado, but any of the other sites would look broadly similar to this. These soil plots are spaced between 25 and 40 meters apart, based on an assessment of the spatial variability of soil temperature and moisture that we conducted during the site establishment phase. And they're usually positioned in the upwind or the predominantly upwind direction from the tower to maximize connectivity with the tower-based measurements and also in the locally dominant soil type immediately surrounding the tower. So zooming into an individual soil plot, that would look something like this. And this is one of our soil plots out at the Lengua Landing site in Alabama. But again, all of these soil plots would look broadly speaking the same, of course, with different vegetation and backgrounds. Now, this soil plot happens to contain every single possible sensor that could be deployed in a neon soil plot. But not all of the soil plots will include all of these different sensors. However, all five soil plots at each terrestrial site will include a soil temperature profile. And you could see the top of that here. They also include a soil moisture profile and the top of that action right here. And then a soil CO2 concentration profile, which is made up of these three large air white PVC tubes here. It's sort of hard to see on this picture, but they're buried at slightly different depths. So they're making measurements at slightly different depths in the soil to build up that soil CO2 concentration profile. And all of these measurements are within a few meters of each other. For soil temperature, we have up to nine measurement levels down to two meters deep, assuming we could get that deep in the soil. For soil moisture, we have eight measurement levels down to two meters deep. And then for soil CO2 concentrations, we have the three measurement levels. And those are concentrated near the soil surface. So they're usually not deeper than about 20 centimeters deep for the deepest one. And then all of the other sensors that are shown here are only present in a subset of the soil plots. And in some cases only in the subset of the sites. So that's kind of the setup in the field. I wanted to also show you where you could find some more information about the data products themselves. I'm just gonna pull up my browser here and we are gonna navigate to the neon homepage. So neonscience.org. And if I hover over this data and samples, tap here and click on the arrow underneath it. Brings up this menu. I'm gonna click the arrow that is next to data portal, bringing up another menu. And then if we click on explore data products, this is where we can find more information about the neon data products. And there's a search bar over here on the side where we got soil temperature typed into mine. So it's gonna be bringing up data products that are related to soil and temperature. And if we scroll down here, we started to see some of these data products linked here. And the third one down is our soil temperature data products. And here you can see it's data products ID, right underneath where it says soil temperature. And if we click on this link, this is the webpage that is gonna describe the soil temperature data product. Again, we've got it's data product ID, prominently displayed. So you can find that. We've got some basic information summarizing how the data is being collected, information about how you can cite the data if you end up using it in a paper or something. Some more information about how that data is collected. You've got this documentation section, which is really in depth. Probably not the best place to start unless you really wanna dive into all of the details because it can be almost overwhelming to look at it. But one of the documents that can be good to take a look at is this quick start guide, which should be available for all of the NEOM data products. And you can download that here, or if you just scroll down a tiny bit further, it's actually displayed in the document viewer. And this is the quick start guide is a really short document that just gives you a quick summary of the data product and some common ways that you might want to manipulate that data to do the types of analyses that are commonly undertaken. And so that can be a good document to take a look at when you're first starting to work with a new NEOM data product. Going down a little bit further, you've got the issue log. So listing any issues that are affecting the data, or this data product, either ongoing issues, which are these highlighted ones, or already resolved issues, which are also included further down in the table. Then we've got our availability table. Oh, and I guess up here, I'll just point out, you can also manually download the data, although we won't be using that feature today. We can be doing it all programmatically in R. And then right at the bottom, there's this visualization section that you can also use. So that's one way you can navigate to these pages. I actually find it easier nowadays to just do a web search. Just write in NEON and then swivel water content or something like that, the name of the NEON data product. And almost always the top link that comes up is the data product web page. I usually navigate to the web pages like that nowadays. And this web page is going to be laid out almost exactly the same as the soil temperature example that I showed. So I won't go through it. But one thing I did want to point out here is just in the second paragraph here, we've got this sentence here, it tells us that the measurement depths are not currently being reported correctly in the sensor positions file in the soil water content and water salinity data products. And so that's important for what we're going to be doing today because we're going to be using the soil water content data products. And we want to know the measurement depths of the sensor that we're going to be using. So it goes on to tell us that there is a workaround with this SWC underscore depths, V2 CSV file that has been added where we can download and get the correct installation depths. So I'm just going to scroll down on this page and download that file so that we can use it in a few minutes when we get to that stage. So going down to this documentation section, I can find this file here SWC underscore depths V2. I'm just going to click the download button and pull that up right now. And I'll open it up and we'll have that available when we need it. But right now, let me go back to my RStudio window. Okay, so hopefully everybody's data has finished downloading. Mine has, hopefully that's the case for you. Let's start working with our soil temperature data. I'm going to plot a time series of the soil temperature data that we have just downloaded. But as I mentioned, there are a lot of soil temperature sensors at each site. So each of the five soil plots at the Santa Rita experimental range site is going to have a soil temperature profile consisting of up to nine measurement depths. So we don't want to plot all of that data. That'd be too much to look at just quickly. We're just going to pick one sensor. And so we're going to work with data from soil plot one and from measurement level two, which is the sensor that has a nominal depth of approximately six centimeters. And I'll show in a minute where you could find the exact measurement depth. Before we do that, let's get a feel for what we're actually working with. So I'm going to use the head function. So just write head parentheses. And then we're going to type in ST where we put our soil temperature data and then dollar sign. And then RStudio is bringing up the five tables that are present within it. We're just going to use two of these tables today. So we're going to use the sensor positions table. And we're also going to use this one called ST underscore 30 underscore minutes. That's our time series data. So let's take a quick look at that. So we're going to print the first few lines of this data table. And that's what's showing up down here. So if we look in here, we've got a column. This is the first six lines. And then it's just showing the next columns down here. But the first column is the domain ID. We just downloaded data from one site. It's in domain 14 or D14. The site ID is, of course, SRER, which we specified. And then we've got the horizontal position here. These ones are all 001 indicating soil plot one. And that should range up to 005 for soil plot five. Next we have the vertical position. These are all 501, which is indicating our shallowest measurement level. So by convention, the neon vertical indices that are measured below the soil surface start with five. Whereas if they're above the soil surface, then they would start with a zero. So 501 is our shallowest vertical position. And that would increase down to 509, which would be our deepest soil temperature sensor. We've got the start date time for our averaging intervals. We're starting on the 1st of January. And then we've got the end date time for our averaging interval. So you can see it's 30 minutes later. Then the column that we probably most care about is the soil temp mean. So the mean soil temperature within that 30 minute interval. Then there's some additional columns here that I'm not really gonna go into, but summarized data collected during that averaging interval. But the other column that we are gonna be using is this final QF column. So final QF that stands for final quality flag and all of the neon data products or at least all the sensor data products have a column that's gonna be something like this, something QF usually for the final quality flag. And a final quality flag of zero means that data passed all of our automated QAQC tests and there were no known issues relating to it. A final quality flag of one would indicate that something is suspect about that data and you may not want to use it or at least you might wanna look into what was going on with that data before you do use it. So that might mean that it failed some of the automated QAQC tests or it might mean that somebody we found that something had happened in the field that had maybe affected that measurement even maybe in the case of soil temperature and animal that dug a burrow right next to the sensor or pulled the sensor out of the ground or something like that. So that gives you a feel for what the data is like that we've got in there. I mentioned that we're just gonna work with data from one of the soil plots, soil plot one and also measurement level two. So let's identify the rows in this data table that correspond to that. So first I'm gonna create something called P1 for plot one, rows, T for temperature. And then we're gonna use our grep function which is like a searching function. I'm gonna search for 001 corresponding to soil plot one. I will be looking for that in ST dollar sign the 30 minute data table. So ST underscore 30 underscore minutes. And then we wanna look for that in the horizontal position column. So if I run that it's now bringing up this vector over here we've got over 141,000 rows that correspond to soil plot one in that in the data that we downloaded. But we also wanna find the rows that correspond to measurement level two. So I'm gonna make another vector D2. So depth two or measurement level two, rows, T for temperature again. We're gonna use grep again. And this time we're gonna look for 502, search for the rows and 502 indicating measurement level two. And so again, we'll be looking at our soil temperature package in the 30 minute data and then dollar sign in the, this time we wanna look in the vertical position column. So I can run that and we've got this vector over here with 83 over 83,000 rows in it that all correspond to measurement level two but that'll be measurement level two in any of the soil plots. And I'm just gonna show in a minute how we're gonna filter that further. So the last thing that we wanna do is we wanna make sure that we're only using the data that passed the QAQC test. So it doesn't, isn't any of this suspect data. So I'm gonna wait one more vector, good rows, T. These are the rows that are gonna have passed the QAQC test. And then to that, we're gonna use on which functions of which parentheses, ST the 30 minute data table and then the final quality flag that we just saw. So final QF, which final QF rows are set to zero. So we're gonna do two equal signs and then a zero and run that and we've got like 621,000 rows that passed that. That's gonna be for all of the different measurement levels. So we now know the rows that correspond to each of these individual criteria but we wanna find the rows that correspond to all of these criteria together. So coming from soil plot one, measurement level two and that passed the QAQC test. And we're gonna do that using the intersect function. So I'm gonna make one more vector which I'm gonna call use these T for temperature. And we're gonna then write intersect. And this is gonna find the common rows in these two and some of these vectors that we've created. First I'm gonna paste in the P rows, P1 rows T, the rows corresponding to soil plot one then put a comma and then I'm gonna paste in D rows, D sorry, D2 rows T and the measurement level two rows. And so if I run this right now, this would find all the rows that are from soil plot one measurement level two. But we also wanna filter down to the rows that passed the QAQC test or filter out those bad ones. So I'm gonna put the, this whole intersect section into parentheses, right? Another intersect at the beginning of it. And then at the end or between these last two ending parentheses, right, a comma and I'm gonna paste in there the good rows T or the rows that passed that those QAQC test. And now I can run that and now we have this vector use these T up here which has got just over 17,000 rows that met all of those criteria. So come from soil plot one measurement level two and pass the QAQC test. So that's what we're gonna want to include in our time series plot. Before we make that plot, let's find out the depths that our sensor is installed at. To get, we're gonna use the sensor positions file to do that and just to get a feel for what that sensor position file looks like. I'm gonna use the head function again. So head, parentheses, ST, dollar sign. And then I'm gonna click on the sensor underscore positions underscore 0, 0, 0, 0, 4, 1 you're part of the data product ID. And if I run that, it brings up the first few lines the first six lines of this sensor position file. So that some of these column names should look pretty familiar. You've got the site ID in here, S-R-E-R, the sensor reader experimental range. Next, we've got this core dot ver column that's the horizontal position or horizontal index and vertical index. So for example, in the first row, it's 0, 0, 1 corresponding to soil plot one dot 5, 0, 1. So measurement level one in soil plot one. The next row is 0, 0, 1. So again in soil plot one, but this time 5, 0, 2 indicating that's measurement level two. We've got some additional information about these locations. A star date and time for that position starting back in 2010. And then an end date and time for that position. Now often these end date and times are set to NA which I think sometimes causes confusion but all that means is that that sensor is still at that location. It's still at the same place. It's still collecting data. If that's something that happened to that sensor, we'd had to reinstall a new sensor in a different location than there would be an end date. And then another row with a different start date and either another end date or perhaps NA and its end date indicating that it's still there. So these ones are all set to NA indicating that those sensors are still operating in the same location. And then if we scroll down a little bit further, now we're starting to get to the area where we've got some information about how the sensor is installed. So the column that we're really gonna be interested in is a C offset column and that's the sensor depth relative to the soil surface. We've got some additional columns about how the sensor has been installed. We've got the latitude and longitude and elevation of the reference corner of the soil plot and then the position of the sensor in the, or it's offset in the east direction and then in the north direction relative to that reference corner. So this sensor was, let's see about two, just under two centimeters west of the reference location and then just over two meters north of the reference location. And so that's kind of how those sensor position files are laid out. Let's find the depth of our sensor. So to do that, I'm gonna write ST or still temperature package we got. The sensor positions file and then I'm gonna do the brackets, square brackets and then we're gonna use the grep function to tell us which rows corresponds to our measurement level and soil plot. So we're gonna use grep, parentheses. We're going to look for 001 for soil plot one and then dot 502 for measurement level two and we're gonna look for that within ST and dollar sign, the sensor positions file, dollar sign and in that for dot ver column. So if we read that right now, it would print the whole row that corresponded to that sensor location. We're just interested in the depth. So I'm gonna put a comma and then specify we just want the Z offset which is the sensor depth. And then if I run that now down here at the bottom, it's printed out the depth of that sensor. So it says negative 0.06. The negative sign indicates that the measurement is below the soil surface and then these are in meters units. So it's 0.06 meters below the soil surface with six centimeters below the soil surface. So that's good. So now we know where our sensor, what our sensor depth is and we can use that in our legend when we plot the data. So let's plot that data and take a look at what the soil temperature was like. So I'm gonna use the plot function ST dollar sign. We first wanna specify our date and time stamps. So we're gonna use this 30 minute data table and then we're gonna use the start date time column within that data table. But we don't wanna plot all of those time stamps that are in there. We only want the ones that corresponded to our sensor and the positive QA QC test. So I'm gonna put the square brackets and then use these T when we filter down to the rows that related to the sensor or the rows that we were interested in, our sensor and the positive QA QC test. Then I'm gonna put comma, I'll move to the next line just to keep it clear. And now we're gonna add the Y axis data points. So ST dollar sign, that 30 minute data table, dollar sign. And then we want to plot the soil temperature within each of that averaging intervals. Again, we'll put the square brackets and then use these T. And we could run it right now and it would give us a time series plot. I'm just gonna make a few other modifications that'll make it a little bit easier for us to see the data. So first off, we're gonna be plotting a year's worth 30 minute data. So there's gonna be a lot of data points and by default R uses a relatively large point size. I'm gonna change that the size of that point character. So I'm gonna write PCH for point character and then put equals and then in quotation marks I'll just put a period. So it's gonna use a period for our data points, something really small. I'm gonna set an X axis label for X lab equal to just empty quotation marks. It's gonna be obvious that this is a time series plot. So we don't need any label on it. For the Y axis label, Y lab equals, I'll say soil temperature in degrees C. And then I know that there is a way, I just forget it to like write in the ASCII come on for the degrees sign. I never remember what that is. So instead I do this weird little work around where I pull up like an email or something and I insert the degree sign into it and then copy it over into there. That works pretty fine, even if it's not the most efficient way of doing it probably. So I've got somebody on the school knows a better way of doing it. That's how I do it. And then we've got degrees C in there. And then the last thing we wanna do is add a title to our plot. So we're gonna write main, just the title and we'll call it S-R-E-R, our site code soil plot one and already 2021. So now we can run that and we should see our time series plot. So yeah, we've got our time series plot popping up over here. Pretty expected pattern, warmer soil temperatures in summer months, cooler temperatures in winter. We see pretty extreme differences in the soil temperature over the diurnal cycles of the day to night, which you would expect to see in the desert side down in Arizona where it's really dry and you get those large temperature swings. The last thing we wanna do is add a legend to our plots. A legend. Whoops. Legend. And then we'll put it in the top left corner and we want the legend to say six centimeters, the depth of our sensor. I'll put a line, just a solid black line next to it. So LTY for line type equals one. And then I'm gonna say DTY or box type equals and then N for no box around it. And if I run that, then we've added our legend to our time series plot here. So that's what we've done that now for soil temperature and we're now gonna do something very similar for soil water content. So I'm just gonna make a new section and code here soil water content. And we're gonna make a time series plot for soil water content. And just like before, there are a lot of sensors within the site. We just wanna plot one of those sensors. So again, we'll use soil plot ones. We're using the same data from the same soil plot and we're gonna use measurement level one, which has a nominal depth of about six centimeters. So it should be close in depth to our soil temperature data. So first we're gonna write P1 rows but this time M for moisture. And we're gonna use the grep function again. We're gonna search for 001 soil plot one. And this time we're looking for that in our soil water content or SWC object that we created. But we still want to use the, it's still formatted in a similar way to our soil temperature data. So we're gonna use this SWS underscore 30, underscore minute for our time series data. And we're gonna look for that in the horizontal position. So you can see it's formatted pretty similar to the soil temperature data. So that's our plot one rows. Now let's find measurement level one. So write D1 for depth one, rows M, grep, and we're gonna look for 501, corresponding to measurement level one from soil water content sensor. An SWC dollar sign, the 30 minute data table, dollar sign. And now we're looking in the vertical positions column. So you can run that. And just like the soil temperature, we only wanna use the good data that passed the QAQC test. So write good, rows M, oops, M, and we'll just say which parentheses on the best WC dollar sign, our 30 minute data table, dollar sign. Now soil water content includes two different sub-products within it. It includes the volumetric soil water content. It also includes an ion content, salinity, the electrical conductivity. We're just wanting to use the volumetric soil water content today. So I'm gonna find the final quality flag that relates to that, which is this one, which is BSWC final QF, volumetric soil water content, final quality flag, and then which ones of those equal zero. So two equal signs and a zero. And that's those rows. And then the last thing we need to do is we found the rows that correspond to each of these individual criteria. We want the rows that correspond to all of these. So we're gonna write use these M and we'll use that intersect function again, intersect parentheses and copy in the P1 rows and POMR copy in the D1 rows and so soil plot one, measurement level one. Then I'm gonna highlight that whole thing, put it inside parentheses, write another intersect at the beginning of it, and then between the two ending parentheses, put a comma and copy in the good rows and there. And so that's data that's coming from soil plot one, measurement level one, and across the QAQC test. So now we'll remember when we looked back at our the soil water content page, it told us that sensor positions file didn't have the correct sensor depth. And instead we downloaded this file that I just pulled up here. And now on this one, I'll give you data for you. This has got data or the depths but all of the neon sites, but I'm gonna filter down to the sites and the soil plot and the measurement level that we're interested in. So I'm gonna just, and I'm just gonna do this the next level of simplicity that you could do it in R. If you wanted to, we're gonna find the SRER site and I'll just click that one. We're just interested in soil plot one. So I'm gonna deselect all of those and just check soil plot one. And then in the vertical position dot fur, we're just interested in measurement level one. So I'm just gonna click the 501 line. And then in our sense of depths column here, we've got a sense of depth of actually the same as our temperature sense of negative 0.06. So indicating that it was six centimeters below the soil surface. And we see that it's still in that original position. So now we know that this sensor was also measuring at six centimeters deep. And we can use that in our plot legend. But one thing I want to do, well, soil water content data, it's in units of meters cubed per meters cubed. And the cubed parts of those units are of course superscript, but the plot function doesn't let us specify the superscript. So we're gonna create that access label ahead of time and then bring that into the plot function so that it can display those superscripts. So I'm gonna make this y-axis label now take something called label M, soil moisture label. We're gonna use the expression function, so expression, parentheses, and then we're gonna paste together various components. So I'd paste parentheses, and then we start off, we want our label to say soil water content. It's gonna be in units of meters, oops, meters cubed. So I can write the M for the meters, but then I want that cubed to be superscript. So I'm gonna move outside of that, the quotation marks put an up-carat to indicate superscript and then new quotation marks like the space three. So that's saying that that three is gonna be displayed superscript. Then I'll move outside of those quotation marks, put a comma to end the superscript, new quotation marks space M for our next meters cubed. So it's gonna be the per meters cubed part. And then move outside of those quotation marks with the up-carat for the next superscript, which we're gonna put new quotation marks and then negative three. So that negative three is gonna be in superscript, and then moving outside of the quotations, put a comma to end the superscript, and then we just need to put the final closing parentheses on that. And now I can run that and that's created a label that we'll be able to use in the plot. So let's make that plot right now. So we're gonna use the plot function, parentheses. We're gonna start off with our timestamp. So SWC, we're using the 30-minute data, dollar sign and our start date time column. But just like before, we don't use all of the time points. We just want the time points that relate to our measurement level of the pasta QA QC test. So we're gonna put in the square brackets, use these M, then our Y-axis, we want to add SWC, the 30-minute data, dollar sign, and we want to add in the volumetric slow water content. So that's this one here, VSWC, mean, square brackets, and then use these M. And just like before, we're gonna slightly modify the way that the plot displays. So it's easier to see all the data that we're gonna be plotting. So we're gonna change the point character, PCH, to equal quotation marks and period. So it's gonna use a period for plotting it. We're gonna have our X-axis label, XLAB, just set to empty quotation marks. So we'll put anything there. And then our Y-axis label, YLAB, is gonna be set to label and that label we just created. And if we run that, now we get our time series plot of soil moisture, which you can see sort of typical patterns for soil moisture, spikes up in soil moisture, presumably relating to rain events and then gradual declines, at least until the next rain event occurring. And so pretty typical patterns. The one thing that hasn't quite worked, right, is we've got our label displaying, right, but it's being chopped off a little bit. The margins on the plot isn't quite big enough. So let's modify those margins so that we can see our X-axis label properly. So in the line above the plot, I'm gonna write par for the graphical parameter. Then I'm gonna write mar equals to mar for margins and then see parentheses. And we're gonna specify what size margin we want for all sides of the plot. And it starts off with the bottom and then it moves to the left-hand side and the top and then the right-hand side. So we put three for the bottom, something bigger for the left side, where we need some more space, five, and then two for the top and then one for the right-hand side. And now if I run that and then the plot line again, now we see we've created a bit more space, everything's shifted over a little bit and we can see our label correctly. And the last thing we need to do is add a legend. Again, we can put it in the top left corner. We've got space. We want the legend to say six centimeters. We just want the solid black line next to it. So LTY for line type equals one and then BTY for box type equals N for none. And I can run that and now we've added our legend to the soil moisture time series plot we created. So that's gonna be now our time series for soil temperature and soil moisture. Now let's make one for soil CO2. And again, we're gonna do it in a pretty similar way. The one thing that's gonna be different for soil CO2 is we're gonna plot all three measurement levels since there's not too many of them. But we'll start off identifying again the rows that correspond to soil plot one. So we're getting the data from the soil, the same soil plot as our temperature and moisture data. It's gonna make this factor P1 rows C for CO2 this time. We're using our grep function again and we're gonna be searching for 001 for soil plot one. We're looking now, we're gonna be using our CO2 list that we created where we put our CO2 data, dollar sign. Again, we've got a similar set of files showing up and we're gonna be using the 30 minute data. So SCO2C, soil CO2 concentration and then underscore 30, underscore minute, 30 minute data. And then we're gonna be looking for that in the horizontal position to find all the rows for soil plot one. I can run that. Next, let's find the rows that correspond to measurement level one. So D1 rows C. And we're gonna do grep again. We're gonna look for 501 for measurement level one. And then we're gonna look in CO2, dollar sign, 30 minute data table, dollar sign. And we're gonna look in the vertical position, CO2. And I can run that. And then I'm just gonna copy that last line, we'll paste it two more times because we can just slightly modify it to find measurement level two and three. So for the second line where I've copied it, I'm gonna change it from D1 rows C to D2 rows C and then I'm just gonna change what we were searching for from 501 to 502. And then in the third row where we copied it, I'm gonna change it to D3 rows C. I'm gonna be looking for 503. And I can run those two lines and that's gonna be the rows that correspond to each measurement level. We also wanna find the rows that pass the QA, QC test. So we'll write good rows C. We'll use the which function. So which parentheses, C over two, dollar sign, the 30 minute data table. And we're gonna look for our final quality. I'm gonna get some scrolling down a little bit here. Final QF equals, so two equal signs and then a zero. I can run that. And then we wanna find the rows that correspond to all three of these criteria for each measurement level. So I'm gonna write use these C1. So these are gonna be the rows that we use for measurement level one. For the CO2 data intercepts, it's like before parentheses and copy in P1 rows C. I'll copy in first, I'll do the measurement level one. So I'll copy in D1 rows C. So that's gonna be the rows from soil plot one measurement level one. I'm gonna put that inside parentheses. Write another intersect at the start of it. And then between the last two ending parentheses, put a comma, copy in the good rows C. Once that passed the QA QC test. And I can run that. And we've got this vector up here, use these C1. It's got almost 17,000 rows corresponding to measurement level one and soil plot one plus the QA QC test. Now I'm just gonna copy that line two more times. And we're just gonna modify it slightly for measurement level two and three. So in the second line where I've copied it, I'm gonna change it to use these C2. And I'm gonna change it instead of being D1 rows C. It's gonna be D2 rows C. And then in the third line, I'm gonna change it to use these C1 to use these C3. And now we'll change it to D3 rows C. Like among those lines. Now we've got our, we know the data that we wanna use in our time series plot. We just need to find out the depths of our sensors. It's gonna make a vector called rows. And we're gonna search. We're gonna use the grep function again to look for all the rows in the sensor positions file that have 001, the total point one. We're gonna be looking in CO2, dollar sign. This time in the sensor positions file. So sensor underscore positions, underscore 0095. And looking in the four dot ver column, the second column here. And we can run that. And we expect there to be at least three rows that correspond to that. Cause we know that there are three measurement levels in each soil plot. And so if I look up here at the rows vector that's appeared up here, we can see it does include three different values. Rows one, two and three correspond to soil plot one. And so those are the rows of the sensor position file that we're interested in. Now let's find the measurement depths for those rows. So we're gonna write CO2, dollar sign, the sensor positions file, and then the square brackets. I'm gonna say that we wanna print the rows that we called rows. So rows and then comma. And then we're just interested in the sensor depth. So I'm just gonna write Z offset. So that's the column that we print. So we're printing these rows that we identified and then we're just printing the Z offset column. And if I run that, we get three values appearing down here. So these sensors we're measuring the shallow ones at two centimeters, then the next one's at five centimeters and the next one was at 19 centimeters below the soil surface. So we've got those sensor depths now. Similar to a soil moisture, our soil CO2 concentration Y axis label is gonna have subscripts in. So that's the two of the CO2 is gonna be a subscript. So we wanna make that label ahead of time. So let's do that. And then we're gonna make our time so it's on. So we make something called label C. We'll use the expression function again. So expression, parentheses. We're gonna paste together the different components. Paste, parentheses. And we wanna label to start off saying soil CO. And then I'm gonna move outside of those quotation marks, put in square brackets to indicate a subscript and just put a two inside those square brackets. Then a comma outside of them to indicate the end of the subscript. New quotation marks, space, concentration, and then in parts of a million units, so PPM units. Now we can run that. And now we've got our Y axis label and we can make our plot. So we're gonna write plot, parentheses. We wanna plot CO2 data. We're gonna be using the 30 minute data file. We wanna have our timestamp on the X axis. Start date, time, square brackets, and we'll write use these C1. So first we're gonna be plotting the data for measurement level one. We wanna on the Y axis to be plotting the CO2 data, the 30 minute data, dollar sign, and then soil CO2 concentration mean square brackets. And again, use these C1. And then just like before, we're gonna slightly modify how our graph displays. So we'll change the point character of PCH to equal period again, a really small data points. X axis label or X lab will equal empty quotation marks, no X axis label, Y axis label, Y lab equal to a label that we just made, which we call label C. And then the last thing that we wanna do is specify our Y axis limits of it. So I happen to know from playing around with this data a little bit already that if we have a Y axis going from zero to 10,000 that it'll be sufficient to pop all of the data that we're gonna be working with. Of course, if this is your first time, use, you know, looking at that data, you're not gonna know that, but it doesn't usually take too long to play around with it a little bit to see what's the right data range. So I'm gonna write Y limb, so the limits of the Y axis equals C and then parentheses zero. So starting at zero, going up to 10,000. So now I can run that, and we have our time series plot of soil CO2 concentration, at least for measurement level one at this site. You can see, you know, concentration is pretty close to atmospheric for long chunks of the year, but then in late summer, we get these increases in CO2 concentration before it drops back down. So that's measurement level one. Now let's add in the other measurement levels because we're adding the points to this same plot. We don't wanna create a new plot. We're gonna use the points function, so we're gonna write points. And then I'm just gonna put parentheses and then I'm just gonna copy the first three lines that we put in our plot function. So I've timestamped our soil CO2 concentration mean and then the PCH specifying that we're using a period for our data points. And I gotta paste that into the points section. And then there's just a couple of things we need to change. So instead of plotting the use these C1 data, we wanna plot use the C2 measurement level two. I changed that for the timestamp and also for the soil CO2 concentration mean to use the C2. We still use the same PCH character. And then the last thing you wanna do is put it, plot it as a different color. Some right call equals, and we'll do red. And if I do that, now we've added our red, data points are measurement level two. You can see a pretty similar pattern related to measurement level one, except that the CO2 concentrations tend to be a little bit higher once they start increasing. Now let's add measurement level three. So I'm just gonna copy this whole points section. And all we need to do is change it from use the C2 to use the C3 for both the timestamp and the soil CO2 concentration mean. And I'm gonna change the color for red, blue, so we can distinguish it. I'll plot that. And again, we've added that one. And let me see the pattern is pretty similar, but the concentrations are even higher, which is quite typical for soil CO2 concentration profiles. They tend to be higher, deeper down in the soil and lower near their surface where it's easier for the CO2 molecules to diffuse it to the atmosphere. So they're built up quite so high concentrations near the surface. The last thing we'll do is add legend. So legend, again, we can just put it in the top left where we put a lot of space in our graph. We want our legend to say, so the legend equals, and then this time we've got three components to our legends and put C parentheses and then in quotation marks and put two centimeters and comma, new quotation marks, put five centimeters and then 19 centimeters. The three measurement depths that we found for our sensors. We want a solid line plotted next to them, so line type or LTY equals one for solid line. But we want the color of those lines to vary, so color equals C and then parentheses. And we want the first line to be black, the second line to be red, and the third line to be blue to match up data points. And then lastly, I would say ETY equals N in quotation marks to say no box around our legend. So then we've got our legend here with these color code N lines next to it relating to the data points. So we've made up a three time series now and probably you can remember a little bit what the soil temperature and soil moisture look like and you might have some ideas but what's influencing soil CO2 concentrations of this site. But to make it easier to see that it can be useful to plot all three of these graphs together on a single plot. And so the very last thing we're gonna do before we open it up for questions is create a multi-panel plot. And so let me wait one new section here and call it multi-panel plot. And the only thing that we really need to modify is we just need to tell R that we want to have three graphs all displayed on a single plot. And so to do that, we use the MF call parameter. So I'm gonna type par for the graphical parameter parentheses MF call equals and then C parentheses three one. And so that's telling R that we want in our plots to have three rows and just one column. So there's gonna be all three graphs that are gonna be plotted on top of each other. We'll start off with our soil temperature graph and soil moisture and then soil CO2 concentration. And then we don't really need to write any new code. We can just copy what we've already done but I'm gonna write a section called soil temp. I'm gonna scroll all the way up to the top to our soil temperature graph that we made earlier on. And I'm just gonna copy the plot and the legend lines, that section, copy that, scroll all the way down to the bottom and paste it in underneath. I'll make another section just so you can keep track of what we're called SWC for soil water content. Scroll up to the soil water content graph and I'm gonna copy plot and legend lines, copy and paste that down here. And then lastly, soil CO2 and copy all the way from plots through our two points where we added the different measurement levels and then getting the legend as well and paste that down there. And then if I go back up to that MF call, so par MF call line, if I run that, we can start assembling this multi-panel plot. And so if I run the first plot, I've added the soil temperature time series and then added its legend, then the soil water content time series and its legend and then the soil CO2 time series for measurement level one and then adding in measurement level two and three and the legend for that. And then I don't think I'll spend too much time trying to interpret this. I guess to me looking at it, it looks like maybe both soil temperature and soil moisture are factors that influence soil. CO2 concentrations at this particular site, so we only see these higher concentrations when the soils are both moist and also when they're warmer a lot of the times of the year. I will just finish up saying that many people or many users are more interested in soil respiration rates than soil CO2 concentrations of cells. And you can calculate soil respiration rates using this neon data along with some other neon data products but you need to calculate the soil CO2 diffusivity coefficient so how quickly the CO2 can diffuse through the soil in order to convert these concentration gradients into a respiration rates. Some users have already done that and in the data tutorial right at the bottom I put some links to where you can see examples of that and even one of the links, it links to a GitHub repository where you can see the code that a researcher implemented to do just that. If that's something that you're interested in. And then with that, I will finish up and looks like we've still got about 25 minutes for questions.