NASA ARSET Visualizing Land Cover Change P 2
The Story
Welcome to Part 2 of our specialized series on environmental monitoring and geospatial analysis: "NASA ARSET: Visualizing Land Cover Change P2."In this episode of the NASA Live Video Podcast, we advance from our foundational concepts into the practical and powerful workflows used to visualize and interpret changes on the Earth's surface over time. Rapid urbanization, deforestation, and agricultural expansion are continuously reshaping our planet, making the ability to accurately track and visualize these transitions essential for modern environmental conservation.
Through the framework of NASA’s Applied Remote Sensing Training (ARSET) program, we dive deep into the specific tools, platforms, and open-access datasets that allow scientists to map land cover dynamics across different time scales. We discuss effective visualization techniques, how to generate change detection matrices, and how to utilize satellite archives—such as Landsat and Sentinel—to turn raw geospatial data into compelling visual stories that drive policy and planning.
Whether you are an urban planner, an ecologist, a GIS analyst, or someone deeply fascinated by how remote sensing reveals the shifting footprint of humanity on Earth, this episode offers vital, hands-on insights. Subscribe to the NASA Live Video Podcast to catch up on Part 1 and stay connected with the frontier of space exploration, satellite imagery, and cutting-edge earth science!
Speaker 1: Hello everyone, and welcome back for Part two of the
Speaker 1: r SET training on visualizing land cover and land use
Speaker 1: change with NASA Satellite Imagery. My name is Justin Faine
Speaker 1: and I'm part of the r SET Ecological Conservation Team
Speaker 1: based out of the NASA AMES Research Center at the
Speaker 1: South end of the San Francisco Bay. As before, I'd
Speaker 1: like to take a moment to go over some details
Speaker 1: of the r SET program. Our SET is the Applied
Speaker 1: Remote Sensing Training program. We provide free trainings on a
Speaker 1: variety of topics which are divided into thematic areas, which
Speaker 1: is what you see listed here on the right. We
Speaker 1: do our best to listen to feedback from our audience
Speaker 1: to make sure we're doing trainings on the topics you
Speaker 1: are most interested in. We cover remote sensing satellites, sensors, methods,
Speaker 1: and tools at various levels of complexity, from the fundamentals
Speaker 1: of remote sensing to advanced trainings. Our SET trainings come
Speaker 1: in a few different formats. They can be online or
Speaker 1: in person, live an instructor led or asynchronis and self pace,
Speaker 1: but they are always provided.
Speaker 2: Free of charge.
Speaker 1: Many of our trainings are available with bilingual or multi
Speaker 1: lingual options. We only use open source software and data,
Speaker 1: and the trainings are targeted at a variety of levels
Speaker 1: of expertise. This training is called visualizing land cover and
Speaker 1: land use change with NASA Satellite Imagery. These are the
Speaker 1: learning objectives for the entire two part training, of which
Speaker 1: this is part two. By the end of this training,
Speaker 1: you should be able to access NASA Earth observation data
Speaker 1: relevant to land cover and land use change mapping, convert
Speaker 1: NASA Earth observation data into distinct land cover land use
Speaker 1: classes using supervised and unsupervised machine learning classification methods in
Speaker 1: the R programming language. Recognize the role of classification methods
Speaker 1: as one part of a change monitoring strategy. Computer change
Speaker 1: matrix representing the change in land covered land use between
Speaker 1: two dates, and create a map in our studio.
Speaker 2: Visualizing the differences in land cover and land use between
Speaker 2: two dates. The prerequisites to get.
Speaker 1: The most out of this training are the fundamentals of
Speaker 1: remote sensing course and some experience working with our in
Speaker 1: our studio. Note that I'm not asking you to have
Speaker 1: downloaded any of the code or data for this training.
Speaker 1: I'm going to be jumping back and forth between slides
Speaker 1: and code. Later in a way that will probably be
Speaker 1: hard to follow, and I've also gone ahead and prepared
Speaker 1: some of the parts which take a while to run,
Speaker 1: so that we can keep training moving along. I suggest
Speaker 1: that you follow along with this presentation and then explore
Speaker 1: the code afterwards. The code and data I'll be using
Speaker 1: in both sessions of this training will be available on
Speaker 1: the our set GitHub, which you can find on the
Speaker 1: training web page, along with these slides, a recording of
Speaker 1: this presentation and all of the other materials. If you're
Speaker 1: not familiar with cloning data from GitHub repository, we've got
Speaker 1: you covered on that topic as well. There's a short
Speaker 1: video linked on the training web page which covers the
Speaker 1: cloning operation. This is the second part of a two
Speaker 1: part training. The homework for this training will open following
Speaker 1: this session and will be due on March twelfth, which
Speaker 1: is two weeks from now. You can find the homework
Speaker 1: on the training web page, and we'll send out a
Speaker 1: certificate of completion to all who attend both parts of
Speaker 1: this training and complete the homework on time. With the
Speaker 1: logistics covered, we can begin Part two visualizing land cover change.
Speaker 1: Once again, I'm just in fame and I remain your
Speaker 1: sole instructor for this training. I'm a research scientist with
Speaker 1: NASA AMES and the Bay Area Environmental Research Institute in
Speaker 1: Mountain View, California. Here are the objectives specific to the
Speaker 1: second part of this training.
Speaker 2: By the end of.
Speaker 1: Part two, you'll be able to apply a random forest
Speaker 1: model to NASA mmetry to create land cover and land
Speaker 1: use maps for two different time periods and analyze both
Speaker 1: numerically and usually the change in land cover and land
Speaker 1: use over time. Please put any questions into the Q
Speaker 1: and A box in this training. There are a bunch
Speaker 1: of our set people watching the Q and A who
Speaker 1: are working to answer your questions while I'm presenting. Well,
Speaker 1: try to answer any questions you submit at the end
Speaker 1: of this training, but any questions we don't get to
Speaker 1: because of time or because they require some extra time
Speaker 1: on our end answer fully, We'll be answered in that
Speaker 1: Q and A document and uploaded to the training website
Speaker 1: in a week or so. The questions you ask and
Speaker 1: the responses we get from you and the post training
Speaker 1: surveys help us to sign on topics for future our
Speaker 1: set training, So your contributions are appreciated. Now we can
Speaker 1: get started. Just to review, here's some important concepts which
Speaker 1: we went over in the first part of this training
Speaker 1: and the image on the right is where we're headed
Speaker 1: today as we learn how to implement a random forest
Speaker 1: classifier and R and use it to show land covered
Speaker 1: land use change over time. In the previous session, we
Speaker 1: looked at one unsupervised classification method K means in detail.
Speaker 1: Today we're going to focus on supervised classification and ultimately
Speaker 1: build that random forest classifier for land cover. Recall this
Speaker 1: table from part one. With supervised classification were limited by
Speaker 1: the quality and specificity of the training data. Classes are
Speaker 1: targets which we establish ahead of time when we collect
Speaker 1: and label the training data. We'll focus primarily on random
Speaker 1: forest today since it's a great introduction to some other
Speaker 1: important concepts. However, since we discussed K means and detail
Speaker 1: in part one, let's briefly discuss the related K nearest neighbor.
Speaker 1: K Nearest neighbor uses the class labels of the training
Speaker 1: data to decide how to classify new data. K means
Speaker 1: being unsupervised, has no predetermined classes and only relies on
Speaker 1: similarities and brief this is how CA nearest neighbor works.
Speaker 1: Give it a new sample. Check the K nearest points
Speaker 1: or neighbors, and assign the new point the class which
Speaker 1: is most frequent among those neighbors. K can be any
Speaker 1: integer greater than one, but it's usually good to choose
Speaker 1: an odd number to help avoid ties. The points on
Speaker 1: the right are examples of known samples of different classes,
Speaker 1: where each class is represented by a different color. We
Speaker 1: can go through an example step by step step to
Speaker 1: see how this works in practice. Watch how K nearest
Speaker 1: neighbor classifies a new point. We'll set K equal to three,
Speaker 1: find the closest neighboring points, tally the votes, and the
Speaker 1: class that's most frequent in the list of neighbors is
Speaker 1: the class of the new point. Will now shift our
Speaker 1: focus and explore random forest models and lay the ground
Speaker 1: work for making our own random forest model. In R
Speaker 1: random forest is a tree based model, which means that
Speaker 1: it works by creating decision trees. The decision trees explain
Speaker 1: possible ways to divide the data based on binary true
Speaker 1: false filters. New data is classified by applying the decision trees,
Speaker 1: which work to split the training data most accurately. To
Speaker 1: see how this works, let's assume we have a training
Speaker 1: data set which consists of aliens and acorns. Random Forest
Speaker 1: knows that they are different classes because the training data
Speaker 1: is labeled with class information.
Speaker 2: There are some.
Speaker 1: Features which separate the aliens and acorns and our training data.
Speaker 1: Aliens can be blue or green, and acorns are smaller
Speaker 1: than aliens. Each split in the tree represents a binary discision.
Speaker 1: The first decision the first question might ask is it
Speaker 1: larger than some size? The next might ask is the
Speaker 1: object green? And finally it might ask.
Speaker 2: Is the object blue.
Speaker 1: Note that we didn't tell the model to make these splits.
Speaker 1: The random forest model actually makes hundreds of decision trees,
Speaker 1: each of which is the result of leaving out a
Speaker 1: random set of variables and observations. But for demonstration purposes,
Speaker 1: we're only going to consider the single tree where we're
Speaker 1: using all of the variables and all of the observations.
Speaker 1: So we've built a decision tree that describes a series
Speaker 1: of questions which we can answer to sort objects. Any
Speaker 1: object sorted into the left hand side is more likely
Speaker 1: to be an alien, and any objects sorted into the
Speaker 1: right hand side are more likely to be acorns. Now
Speaker 1: we can apply this to some data that the model
Speaker 1: hasn't seen before and observe what happens. The decision tree
Speaker 1: correctly sorted all of the objects, but notice that there's
Speaker 1: an unused path. This would represent acorns, which are bigger
Speaker 1: than aliens, but neither blue nor green. In this case,
Speaker 1: we got lucky and the big acorns still being correctly classified.
Speaker 1: But we might also ask what about small aliens, And
Speaker 1: now we see that we have a problem. There were
Speaker 1: no small aliens in the training data, so our model
Speaker 1: couldn't classify it correctly. This highlights the importance of having
Speaker 1: high quality training data that's representative of variations in the
Speaker 1: real world. In Part one, I mentioned that it was
Speaker 1: a good idea to have multiple samples for each class
Speaker 1: in your training data. As you can see in the
Speaker 1: false color image of our study area, the water has
Speaker 1: a high degree of variation due to suspended sediments. If
Speaker 1: we only took one or two measurements for training data,
Speaker 1: the model might not correctly classify clear and turbid water
Speaker 1: as both belonging to the water class. Taking many training
Speaker 1: data measurements ensures that we're providing the model with a
Speaker 1: full picture of the variability of spectral reflectants within a
Speaker 1: single landcover class. In this example, I've pulled the data
Speaker 1: for two of our water training points. I've indicated the
Speaker 1: actual points these correspond to in the map on the right,
Speaker 1: where you can see that one sample is very turbid
Speaker 1: and the other is relatively clear. Providing both samples to
Speaker 1: the model helps it learn that water can have a
Speaker 1: wide range of characteristics so that it can correctly classify
Speaker 1: picksel of water that lie between these extremes. To return
Speaker 1: to our previous analogy, we're accounting for both big acorns
Speaker 1: and small aliens. Here, I've laid out a high level
Speaker 1: overview of the workflow. We'll be covering an r as
Speaker 1: we build a random forest model for classification, So let's
Speaker 1: head to our studio to see how it's done. Just
Speaker 1: as a reminder, you'll have access to the code, data, slides,
Speaker 1: and training materials via the training page and the rset GitHub.
Speaker 1: I highly recommend that you watch the demonstration and then
Speaker 1: explore the code after the training is concluded. I've also
Speaker 1: precomputed some of the results for the sake of time,
Speaker 1: so if you try to follow along, you'll probably fall behind.
Speaker 2: With that, let's build.
Speaker 1: Our own random forest model. We'll be building a random
Speaker 1: forest model for supervised classification, and we'll begin by loading
Speaker 1: all of the live libraries we're using this training. This
Speaker 1: is the same set we used in the code for
Speaker 1: part one, and I'm also setting the same random seed
Speaker 1: so that your outputs will look like mine. Just as
Speaker 1: in part one, we need to load the raster data
Speaker 1: for twenty seventeen and twenty twenty four. I'm also going
Speaker 1: to go ahead and make the same RGB plots for
Speaker 1: both years as we did in part one, so we
Speaker 1: have them ready if we need to use them as
Speaker 1: base maps later. I won't go over this since you've
Speaker 1: seen the process before, but you can refer to the
Speaker 1: comments and the code block for a quick refresher. Now
Speaker 1: we can also load the training data points that I
Speaker 1: prepared for this training. The points are associated with the
Speaker 1: image from twenty seventeen, since we are going to build
Speaker 1: our model on the twenty seventeen data before applying it
Speaker 1: to the twenty twenty four data. Notice that I also
Speaker 1: apply the naomit function to remove any points that are
Speaker 1: missing a class label. The training sets small enough that
Speaker 1: we could do a manual check for missing gas labels,
Speaker 1: but this is just good practice.
Speaker 2: For cleaning any training data. Set.
Speaker 1: It's also useful to take a look at the training
Speaker 1: points in the context of the imagery, so let's plot
Speaker 1: them on top of the RGB plot for twenty seventeen
Speaker 1: we stored earlier. The points should be colored according to
Speaker 1: their class. We can confirm that they're representing the land
Speaker 1: cover types we expect. Here, I'm using a variant of
Speaker 1: the okapia ETO colors for the points and setting the
Speaker 1: philosthetic to match the LC class variable. We find ourselves
Speaker 1: in a situation where the training points and the underlying
Speaker 1: raster are spatially associated, but the training points don't have
Speaker 1: any information about the reflectance values stored in the raster.
Speaker 1: We can extract the reflectance values of the raster at
Speaker 1: each of the training points using the extract function with
Speaker 1: the bind options set to true, so that the results
Speaker 1: include the reflectance values as well as the land cover
Speaker 1: class labels. We also need to ensure that the LC
Speaker 1: class variable is stored as a factor, which is the
Speaker 1: art data type for categorical values or random. Forest will
Speaker 1: assume we're trying to do regression and throw an error
Speaker 1: because regression on character.
Speaker 2: Vectors is undefined.
Speaker 1: Here's a quick check of our combined training data to
Speaker 1: make sure everything worked as we expected, and we can
Speaker 1: see here that we have the land cover class and
Speaker 1: the reflectance values for each of the bands and our raster.
Speaker 1: We can also see that lank cover class LC class
Speaker 1: variable is listed as factor, which indicates that it's been
Speaker 1: converted to the r factor data type, just like we
Speaker 1: want it. The reflectance values are still listed as double,
Speaker 1: which is double precision floating point data. That's a numeric
Speaker 1: data type. And with that sort of we're free to
Speaker 1: move on. There are a few important elements to the
Speaker 1: random forest function call. We'll go ahead and run the
Speaker 1: function here and then explain what each part's doing. This
Speaker 1: is a breakdown of the arguments to the random forest
Speaker 1: function call. These aren't all of the possible arguments, but
Speaker 1: they're the ones that I think are core to understanding
Speaker 1: random forest or just practical to know. The formula is
Speaker 1: a formula describing the relationship between the objective and the predictors.
Speaker 1: When we type ELS class tilda period, the variable is
Speaker 1: predicted by all of the variables in data. ELC class
Speaker 1: is excluded since it's the target of the predictors for classification.
Speaker 1: This always takes the form class tilda predictors, where the
Speaker 1: period just stands in for everything that's not.
Speaker 2: The class.
Speaker 1: Data is the data from which to draw all of
Speaker 1: the class and value information. This must contain labels as
Speaker 1: factors as that factor data type for classification to take place.
Speaker 1: Proximity equals T. Proximity equals true gives you an output
Speaker 1: where the values are closer to one when the pairer
Speaker 1: of observations are more similar. Well, look at how to
Speaker 1: visualize these later. You can set this to f to
Speaker 1: false to turn it off if it's not.
Speaker 2: Important to you.
Speaker 1: Speaking of importance, importance equals T returns information about how
Speaker 1: much each of the predictors contributed to the final model.
Speaker 1: In tree equals one hundred, adjust how many random trees
Speaker 1: to build. This defaults to five hundred, but we're only
Speaker 1: using one hundred. Our example is very limited, so in
Speaker 1: my testing, building more trees didn't really seem to improve
Speaker 1: the results, and it just takes longer to run. Do
Speaker 1: trace false. If you set this to one or twue,
Speaker 1: then it returns verbose information for each tree built. For
Speaker 1: any number greater than one, it will give the verbose
Speaker 1: information for every n trees. So if you're doing five
Speaker 1: hundred trees and you set into fifty or set do
Speaker 1: trace to fifty, it will give you ten trees every
Speaker 1: fifty trees, it will give you an output. But now
Speaker 1: we have a trained random forest model which describes the
Speaker 1: classification process to return to the example and the slides.
Speaker 2: You can think of this as being.
Speaker 1: Equivalent to the decision tree with all of the yes
Speaker 1: no questions filled out. Importantly, the model object is not
Speaker 1: a raster we can plot. In order to get from
Speaker 1: the model object to a raster output, we have to
Speaker 1: apply the trained model using the predict function. Since the
Speaker 1: model's already trained, we can apply it to both the
Speaker 1: twenty seventeen and twenty twenty four imagery. So now let's
Speaker 1: jump back to the slides to look at how we
Speaker 1: can quantify the land cover change. Here I've laid out
Speaker 1: another high level overview of the workflow we'll be covering
Speaker 1: in r As we look at how to quantify land
Speaker 1: cover change with a change matrix. We'll apply the model
Speaker 1: which you just saw at the end of the last segment,
Speaker 1: compare the model results for two dates, compute the change matrix,
Speaker 1: and then talk about how to interpret changes overall. So
Speaker 1: now that we have the two maps of land cover
Speaker 1: change in twenty seventeen and twenty four, we can create
Speaker 1: a change matrix which shows how many pixels of each
Speaker 1: class in twenty seventeen became pixels of the same or
Speaker 1: a different class in twenty twenty four. To do this,
Speaker 1: we'll join the single band rasters for each year into
Speaker 1: a multiband raster and use the crosstab function. I'm actually
Speaker 1: going to do this in two slightly different ways. The
Speaker 1: first will return a matrix style table, whereas the second
Speaker 1: will return the same information in a long format, which
Speaker 1: is conducive to sorting and a bit easier to read,
Speaker 1: in my opinion. First, let's look at the change matrix
Speaker 1: in the typical form. In this case, the rows correspond
Speaker 1: to the predicted landcover class in twenty seventeen, and the
Speaker 1: columns correspond to the predicted landcover class in twenty twenty four.
Speaker 1: It may look a bit complicated at first, but let's
Speaker 1: just consider the changes in pixels that were classified as
Speaker 1: water in twenty seventeen. Here we see that of the
Speaker 1: pixels classified as water in twenty seventeen, about one and
Speaker 1: a half million were classified as barren ninety thousand were
Speaker 1: classified as forests, one hundred and sixty eight thousand were
Speaker 1: classified as vegetation, and one point two million remained classified
Speaker 1: as water. Notice that when something's classified as a change
Speaker 1: from water to water, we can instead say that those
Speaker 1: pixels did not change, and all of these A to
Speaker 1: A pairs lie along the diagonal of our matrix. Since
Speaker 1: the diagonal of the matrix represents the number of pixels
Speaker 1: which didn't change or rather were a change from the
Speaker 1: class to the same class, and the sum across the
Speaker 1: rows represents the total number of pixels for that class
Speaker 1: in twenty seventeen, we can very easily calculate the percentage
Speaker 1: of each class that remains unchanged. As I've done here,
Speaker 1: we immediately see that the barren class changed the least,
Speaker 1: at ninety two point twenty five percent of the pixels
Speaker 1: classified as baron in twenty seventeen still being classified as
Speaker 1: baron in.
Speaker 2: Twenty twenty four.
Speaker 1: Vegetation saw the most change, as only thirteen point four
Speaker 1: to four percent of the pixels which were classified as
Speaker 1: vegetation in twenty seventeen were still classified as vegetation in
Speaker 1: twenty twenty four. Referring back to our change matrix. You
Speaker 1: may also notice that the twenty seventeen vegetation pixels most
Speaker 1: commonly changed to baron in twenty twenty four, and with
Speaker 1: only a bit more math, we can calculate that sixty
Speaker 1: six point three five percent of the vegetation pixels became
Speaker 1: barren pixels in twenty twenty four. Notice that this matrix
Speaker 1: format gives us a handy from class to class syntax
Speaker 1: for isolating specific changes between any pairs of classes. The
Speaker 1: long version I mentioned earlier simply takes all of the
Speaker 1: information and the change matrix and stretches it out so
Speaker 1: that each of the possible from class and two class
Speaker 1: pairs are listed individually. This is particularly useful if you
Speaker 1: want to filter and sort your data to get the
Speaker 1: magnitude of change. You could summarize the data further, such
Speaker 1: as when you're looking for the total loss gain of
Speaker 1: a particular LC class.
Speaker 2: In this case, I'm doing vegetation.
Speaker 1: Now you can see that we've isolated the overall changes
Speaker 1: in vegetation measured by the magnitude of both gain and loss,
Speaker 1: and determine that the vegetation class only lost sixty seven
Speaker 1: point one percent of the pixels it gained To put
Speaker 1: that another way, even though vegetation experienced the greatest overall change,
Speaker 1: it still had a gain of about one and a
Speaker 1: half pixels for each pixel at lost. We can therefore
Speaker 1: say that the vegetation class expanded between twenty seventeen and
Speaker 1: twenty twenty four overall, but areas which were previously vegetation
Speaker 1: didn't tend to remain vegetation. Change matrices give us a
Speaker 1: really good quantitative insight into the magnitude and direction of
Speaker 1: change over time, but it's also important to understand where
Speaker 1: these changes occur in space. We'll return to the slides
Speaker 1: while I will lay out the process for turning all
Speaker 1: of this information into a map of land cover and
Speaker 1: land use change. So we've applied classification to the imagery
Speaker 1: for both of our dates, and the change matrix gave
Speaker 1: us some information about the direction and magnitude of land
Speaker 1: cover change. But now that we've answered the question of
Speaker 1: how land cover is changing over time, we want to
Speaker 1: map the changes to figure out where the changes occur.
Speaker 1: Instead of an overview as I provided for the last
Speaker 1: two sections, let's look at a simplified example. We use
Speaker 1: simple mathematical and logical operations to compare land cover maps
Speaker 1: and create maps of land cover change. A simple approach
Speaker 1: to finding which cells have changed is to use not
Speaker 1: equal operation. Going cell by cell, the operation checks to
Speaker 1: see if the earlier and later land cover classes are different.
Speaker 1: Where there has been a change, the output returns true
Speaker 1: or one. Where there's not been a change, the output
Speaker 1: returns false or zero. The result is a binary map
Speaker 1: with the same dimensions as the input, which answers the
Speaker 1: question where change has occurred. You might want to apply
Speaker 1: this binary map as a mask over the land cover
Speaker 1: maps to figure out what types of change occurred in
Speaker 1: the areas we identified with binary mask. In practice, this
Speaker 1: is really as simple as multiplying the mask by the
Speaker 1: land cover map.
Speaker 2: The result is a.
Speaker 1: Change map which shows only the pixels where we detected
Speaker 1: land cover change and shows what the land cover class changed.
Speaker 2: Two.
Speaker 1: This is very simple to do programmatically, so let's go
Speaker 1: back to our to see how it's done. Just as
Speaker 1: we did in part one of this training, I'm gonna
Speaker 1: use a plotting helper function so that all of our
Speaker 1: plots use a consistent layout and legend. This is very
Speaker 1: similar to the plotting helper function in part one, so
Speaker 1: I won't go over it in detail. Now I can
Speaker 1: use the plotting helper function to create plots of each
Speaker 1: of the classified rasters and arrange them side by side,
Speaker 1: which is what you see here. In the twenty seventeen image,
Speaker 1: the one on the left, we see a large extent
Speaker 1: of flooded areas outside of the main course of the river,
Speaker 1: which are replaced by the barren class. In the twenty
Speaker 1: twenty four image on the right, we also see some
Speaker 1: significant expansion of vegetation in parts of the forested area
Speaker 1: to the south.
Speaker 2: Of the river.
Speaker 1: This is giving us visual clues about the strange metrics
Speaker 1: regarding vegetation we were seeing in the change matrix. Although
Speaker 1: very few pixels which were vegetation in twenty seventeen remained
Speaker 1: vegetation in twenty twenty four, the expansion of vegetation in
Speaker 1: the forested areas explains why there was still an overall
Speaker 1: gain in the vegetation class. In the slides, I mentioned
Speaker 1: that all we need to do in order to create
Speaker 1: a binary change mask is to use the not equal
Speaker 1: logical inequality operator. So let's do that now and then
Speaker 1: plot the results, and here we have our binary change mask.
Speaker 1: That's exactly what he demonstrated in the slides with the
Speaker 1: small toy model follows exactly the same procedure, and following
Speaker 1: on from the slides, we might be interested in applying
Speaker 1: that mask back to one or both of the previously
Speaker 1: classified link cover maps, which is as symbol as multiplying
Speaker 1: the original map with this new change mask.
Speaker 2: However, the TEA package in our gives a.
Speaker 1: Much cleaner way of achieving the same result, using the
Speaker 1: mask function, which is much easier to remember, and specifying
Speaker 1: that we want our mask value to be zero or false.
Speaker 1: Now we can plot both maps using the same helper
Speaker 1: function we used earlier. By only highlighting the pixels that
Speaker 1: experience change between twenty seventeen and twenty twenty four, we
Speaker 1: can get a better idea of the locations where certain
Speaker 1: changes took place.
Speaker 2: If we think of.
Speaker 1: These maps in terms of the change major, we've essentially
Speaker 1: visualized everything except for the diagonal of the matrix, which
Speaker 1: is now ana. We can see in stark contrast, the
Speaker 1: loss of forest to vegetation and the loss of water
Speaker 1: to barren, as well as where in the scene these
Speaker 1: changes are occurring. That map on the right is the
Speaker 1: same one I had promised to show you how to
Speaker 1: make at the beginning of this presentation. So for one
Speaker 1: final time, we're going to return to the slides for
Speaker 1: a summarine conclusion, and then we'll open up the Q
Speaker 1: and A session. I will say at the end of
Speaker 1: this document, which will be on the training web page,
Speaker 1: I've provided some additional details which I don't have time
Speaker 1: to get into now, about other ways that you can
Speaker 1: visualize the results and assess the appropriateness of your remote
Speaker 1: sensing random forest model. So let's review what we've learned today.
Speaker 1: In part two, today learned how to recognize the importance
Speaker 1: of training data for supervised classification. Compare K meines and
Speaker 1: K and N methods for clustering and classification. Construct decision
Speaker 1: trees as used in random forest models. Apply a random
Speaker 1: forest model to NASA imagery to create land cover land
Speaker 1: use maps at two different time periods, and analyze both
Speaker 1: numerically and visually the change in land cover and land
Speaker 1: use over time. So now let's review what we've seen
Speaker 1: in both parts of this training. Over the course of
Speaker 1: this two part training, we've hopefully learned how to access
Speaker 1: NASA Earth observation data relevant to land cover and land
Speaker 1: use change mapping, convert NASA Earth observation data into distinct
Speaker 1: land cover land use classes using supervised and unsupervised machine
Speaker 1: learning classification methods in the our programming language. Recognize the
Speaker 1: role of classification methods as one part of a change model.
Speaker 1: During strategy computer a change matrix representing the change in
Speaker 1: land covern land use between two dates. And finally, create
Speaker 1: a map in our studio visualizing the differences in lank
Speaker 1: cavern land use between two dates. A reminder about the
Speaker 1: homework it will open today following this training and what
Speaker 1: will be due in two weeks on March twelfth. You
Speaker 1: can find the homework on the training web page and
Speaker 1: will submit your answers.
Speaker 2: Via Google Forms.
Speaker 1: You will qualify for the Certificate of Completion if you've
Speaker 1: attended both live webinars and complete the homework assignment by
Speaker 1: the deadline. Of course, I've been your trainer, but I
Speaker 1: want to thank the rest of the r SET team
Speaker 1: as well. You've been hearing me talk for a long time,
Speaker 1: but there are many other people who putting countless hours
Speaker 1: to bring these trainings to you. They're the ones who
Speaker 1: handle the logistics, the review of the materials, and all
Speaker 1: the other behind the scenes work to make our set
Speaker 1: trainings possible. You can contact me via email or direct
Speaker 1: any questions and comments to our set to the r
Speaker 1: st Gmail address. You can sign up for the rset
Speaker 1: newsletter to stay up to date on future trainings following
Speaker 1: these instructions, and here are a couple of links to
Speaker 1: other resources I personally recommend Geeks for Geeks has a
Speaker 1: good selection of articles about data science and the random
Speaker 1: forest algorithm, which covers some of the other details I
Speaker 1: had to skip over for the sake of time. IBM
Speaker 1: has a fantastic guide to machine learning which has subsections
Speaker 1: for supervised and unsupervised models, but also some other types
Speaker 1: of machine learning that I didn't cover in this training.
Speaker 1: The r Terra package we've been using is an incredibly
Speaker 1: powerful set of tools for spatial data analysis and has.
Speaker 2: A really good set of tutorials.
Speaker 1: And finally, I want to give a shout out to
Speaker 1: Josh Starmer's stack quest videos, which are fun and easy
Speaker 1: to understand videos on statistic machine learning. Whenever somebody contacts
Speaker 1: me with a question about stats or mL, I checked
Speaker 1: to see if there's already a stat quest playlist on.
Speaker 2: The subject and send that to them.
Speaker 1: First, and for one last time, I want to thank
Speaker 1: you all for attending the SARSET training. In just a moment,
Speaker 1: we'll jump over to the Q and A document and
Speaker 1: address some of the questions you've submitted. Okay, let's get
Speaker 1: into the Q and A for part two. So question
Speaker 1: one was actually a question that we had in the
Speaker 1: earlier session Session A this morning, but I wanted to
Speaker 1: bring it up again here just in case anybody else
Speaker 1: ran into the same.
Speaker 2: The same issue.
Speaker 1: I was storing the multi band HLS data with the
Speaker 1: get large file storage. It seems that we had so
Speaker 1: many people wanting to take this training and trying to
Speaker 1: download the data at once that we had a rate limit,
Speaker 1: So I went ahead and put the data up on
Speaker 1: Google Drive. You're welcome to download it from there instead
Speaker 1: if we continue to run into issues with the get LFS.
Speaker 1: Question two, what's the difference between this method and Google
Speaker 1: Earth Engine GEE? Also, is land cover and land use
Speaker 1: data for Iraq available only for the year twenty seventeen,
Speaker 1: so this should be equivalent to the ge.
Speaker 2: Implementation of random forest.
Speaker 1: And there may be an already existing land cover and
Speaker 1: land use data set for Iraq, or you can make
Speaker 1: your own using hyperspectral or multi spectral imagery using the
Speaker 1: same process we should today in our or find an
Speaker 1: example in Google Earth Engine. I know there are some
Speaker 1: examples out there, one of which I reference in question.
Speaker 1: For question three with regard to forrest, what classification method
Speaker 1: should I use in addition to reflectance values if I
Speaker 1: want to add elevation, aspect, slope, or any other values
Speaker 1: such as tree type, evergreen, deciduous, Will there be too
Speaker 1: many variables to consider? That doesn't seem like an unreasonable
Speaker 1: number of variables to consider if you think that those
Speaker 1: might be important for the landcover type in your study area.
Speaker 1: For example, if one of the target classes that you're
Speaker 1: interested in is a plant that only grows on a
Speaker 1: south facing slope, adding the slope and aspect, or if
Speaker 1: you have like a highly varied topographic area, I could
Speaker 1: see elevation coming into play there. You simply would need
Speaker 1: to stack all of that extra data with your multi
Speaker 1: spectral bands the RAST and SPRC functions, just like we
Speaker 1: did in the first part of both sections to bring
Speaker 1: our data in before you extract the band information for
Speaker 1: your training data point locations. As to which classification method
Speaker 1: you should use, that's going to be highly dependent on
Speaker 1: the constraints and the particulars of the study you're looking
Speaker 1: to do. Could be done with random forest, but there
Speaker 1: might be better options out there, just depending on exactly
Speaker 1: what it is you're trying to answer. As I mentioned
Speaker 1: in the answer to question two. Question four, can we
Speaker 1: do random forest classification in Google Earth Engine? Yes, and
Speaker 1: there is an example like linked here from the folks
Speaker 1: at NASA Goddard who have made a Google Earth Engine
Speaker 1: app for random forest methods to detect mangrove maps to
Speaker 1: detect mangroves. So it's a very cool tool. You can
Speaker 1: also find other implementations of random forest and Google Earth
Speaker 1: Engine for examples.
Speaker 2: Question five.
Speaker 1: How were the locations for the training data set generated?
Speaker 2: Was it done in points on qgis?
Speaker 1: Yes. I used the twenty seventeen imagery as a base
Speaker 1: map and drop the points on the base map using
Speaker 1: qgis so that I could see what label I needed
Speaker 1: to add. That makes it very easy and quick, and
Speaker 1: then I could zoom in and out as I needed
Speaker 1: to make sure that my training data points were accurate
Speaker 1: and that I was capturing a good range of.
Speaker 2: The variability within each land cover.
Speaker 1: Class, which is when I took points for both the
Speaker 1: clear and turbid water to include in my water class.
Speaker 1: Question six, what is the most efficient way to obtain
Speaker 1: a training data set for a random forest model? The
Speaker 1: gold standard is going to be getting data on the
Speaker 1: ground through field work and having that tied to a
Speaker 1: date for which there is a cloud free satellite image.
Speaker 1: For practical reasons, sometimes that's harder to do than others,
Speaker 1: so it's perfectly perfectly acceptable to do what I've done
Speaker 1: here and use high resolution imagery and drop your points
Speaker 1: on the imagery, just as I described. As far as
Speaker 1: the efficiency of using points versus lines or polygons for
Speaker 1: homogeneous areas, it's more efficient to use polygons because you're
Speaker 1: sampling many pixels all of the pixels that are covered
Speaker 1: by your polygon at once, rather than taking individual samples
Speaker 1: of individual pixels at a point.
Speaker 2: Question seven. The label classes used in the.
Speaker 1: Training They use the twenty seventeen imagery, but note that
Speaker 1: the twenty seventeen and twenty twenty four imatry were taken
Speaker 1: roughly the same time of year, so we can assume
Speaker 1: that the spectral profiles for each land cover class are
Speaker 1: similar between the years. That is to say that the
Speaker 1: vegetation in twenty seventeen should be analogous to the vegetation
Speaker 1: spectral profile in twenty twenty four, which is why we're
Speaker 1: able to get away with training the model on data
Speaker 1: from one year and applying it to two different years.
Speaker 1: What about metrics, How can we evaluate weight classification performance? Again,
Speaker 1: this is fantastic. I wanted to get into this, but
Speaker 1: really wanted this training to focus on giving you an
Speaker 1: intuitive sense of the how and why of classification. There
Speaker 1: is an additional information section at the end of the
Speaker 1: part two document where I cover some of the topics
Speaker 1: and explore some of the available functions in the random
Speaker 1: Forest explainer package, which I very cleverly had added to
Speaker 1: the package. Imports at the top of both of the sections,
Speaker 1: so you should already have it download if you're running
Speaker 1: the code. Question nine, when using the r random forest tool,
Speaker 1: does our randomly create the training and validation data from
Speaker 1: the entire day set or is this.
Speaker 2: A manual process? There are evaluation.
Speaker 1: Metrics that are inherent to the way that the random
Speaker 1: forest model builds many trees using subsets of the training
Speaker 1: data points and subsets of the variables for each of
Speaker 1: those training data points.
Speaker 2: However, if you wanted.
Speaker 1: To do a post classification assessment, you could make say
Speaker 1: a seventy thirty split on your training data, but you
Speaker 1: would have.
Speaker 2: To do that manually.
Speaker 1: Some of the evaluation metrics that are already available to
Speaker 1: us are things like the out of bag error if
Speaker 1: that makes sense. If not, there is more information in
Speaker 1: the Random Forest Explainer package help and.
Speaker 2: In the additional information section Question ten.
Speaker 1: What would be the best way to do a multi
Speaker 1: year analysis of land cover in the same area in
Speaker 1: several different times months or years. As I mentioned briefly,
Speaker 1: when doing direct comparison, it's important to make sure that
Speaker 1: the images you're comparing are in the same part of
Speaker 1: the phenological cycle. As you can imagine, green vegetation has
Speaker 1: a significantly different.
Speaker 2: Spectral profile than vegetation that.
Speaker 1: Is sinescent or you know, in the autumn as it were.
Speaker 1: But you can train a model for each each pair
Speaker 1: of months if there is significant difference throughout the year,
Speaker 1: throughout the phenological cycle. Otherwise, what you've seen today works
Speaker 1: year to year as long as as long as you're
Speaker 1: keeping track of the time of year and the part of.
Speaker 2: The phenological cycle. You're looking at.
Speaker 1: Reading question eleven. I'm not sure if this is within
Speaker 1: the scope of this webinar, but can you talk about
Speaker 1: the relationship between study scale and resolution of images? For example,
Speaker 1: if one wants to examine the changes in vegetation in
Speaker 1: the home range of an animal species that lives in
Speaker 1: a forest in the DRC in the last twenty five years,
Speaker 1: pared with changes in the vegetation and the African continent
Speaker 1: during the same period, require different resolutions.
Speaker 2: Yeah.
Speaker 1: So the issue you're going to run into here is
Speaker 1: that as you move to lower resolution lower spatial resolution
Speaker 1: satellite imagery to deal with larger study areas, such as
Speaker 1: a continent scale, you're going to get more mixed pixel effects,
Speaker 1: which is to say that a single pixel might contain
Speaker 1: multiple target land cover classes.
Speaker 2: There are some.
Speaker 1: Spectral unmixing techniques that can help get around this, but
Speaker 1: in general you would prefer to be able to use
Speaker 1: the same resolution at both scales, and even better if
Speaker 1: they're on a commonly aligned grid. Is it possible to
Speaker 1: have the R script used for the demo? Yes, the
Speaker 1: R script, the R markdown files and the rendered HTML versions,
Speaker 1: which are just a little nicer to look at. All
Speaker 1: of those for parts one and two are available in
Speaker 1: the GitHub which is linked there and also on the
Speaker 1: training web page. Okay, and it seems that questions are
Speaker 1: already slowing down. I'm actually going to scroll back to
Speaker 1: the questions from part one and see if there's anything
Speaker 1: that I think might be important to.
Speaker 2: Bring up.
Speaker 1: All of these questions will be posted, so don't worry.
Speaker 1: Don't worry if I bring something up that you haven't
Speaker 1: seen yet. Oh yes, the other thing that I would
Speaker 1: like to bring up, which was question thirty eight in
Speaker 1: the first session, which satellite data set is best for
Speaker 1: land use land cover assessment from nineteen eighty to twenty fifteen.
Speaker 1: What do you recommend and why? This is going to
Speaker 1: be dependent on your study area. But I do want
Speaker 1: to point out that it is best practice to ensure
Speaker 1: that you're using the same sensor for both your previous
Speaker 1: and current or each of the time steps in between,
Speaker 1: for your land cover and land used analysis. Random forest
Speaker 1: will only work if the bands are exactly as they
Speaker 1: were in the training data. So if you were to say,
Speaker 1: train your model on landsat and then try to apply
Speaker 1: it to Tanager data, which has a different set of bands,
Speaker 1: the random forest model would fail, So that is a
Speaker 1: consideration when working with these longer term projects. Given the
Speaker 1: working that spatial data in r can be computationally intensive,
Speaker 1: what you recommend for this type of analysis, specifically, what
Speaker 1: spatial resolution and approximate raster size and number of pixels
Speaker 1: would be reasonable to handle on a standard personal computer.
Speaker 1: This is something that has been greatly improved in just
Speaker 1: the past few years with the Terra package which we
Speaker 1: used in the demonstration today and on Tuesday. There is
Speaker 1: the capability of doing on disc processing, which means that
Speaker 1: you're less limited by the RAM that your personal computer has.
Speaker 1: I have done all of this on a standard consumer
Speaker 1: grade laptop and these images are roughly on the order
Speaker 1: of half a gigabyte, but you could reasonably do images
Speaker 1: up to say five gigabytes. It's really just depending on
Speaker 1: what makes sense for your study area, and there are
Speaker 1: always ways that you can go about letting the process
Speaker 1: take longer or spreading it across multiple cores to conserve
Speaker 1: your computational resources.
Speaker 2: Question fourteen.
Speaker 1: My supervisors suggested to use the landsat and dem is
Speaker 1: it possible to lay them out together for LULC analysis. Yes,
Speaker 1: I don't recall which question that was, but the process
Speaker 1: would just be to stack your rasters before.
Speaker 2: You do the training data extraction.
Speaker 1: So you would take your multi band raster and combine
Speaker 1: it with the DEM data before you do the extraction,
Speaker 1: so that you're labeled. Extracted training data points contain all
Speaker 1: of the bands as well as the DEM value. Question fifteen,
Speaker 1: how does the spatial and temporal resolution of NASA satellite
Speaker 1: imagery affect the accuracy of land use change detection? I
Speaker 1: will take this in two parts because the answer for
Speaker 1: spatial and temporal resolution are slightly different. The spatial resolution,
Speaker 1: particularly when dealing with legacy products that have lower spatial resolution,
Speaker 1: you do run into the issues of mixed pixels, where
Speaker 1: a single pixel might actually represent a portion of one
Speaker 1: land cover class and some some portion of another. So
Speaker 1: it's always best to understand the scale at which your
Speaker 1: your landscape is self organized. That is, the minimum pixel
Speaker 1: size you need to be able to distinguish one land
Speaker 1: cover from another.
Speaker 2: In terms of the temporal.
Speaker 1: Resolution, You're not only dealing with the temporal resolution in
Speaker 1: terms of revisit time, which, depending on factors like cloud cover,
Speaker 1: might limit your ability to get accurate imagery at exactly
Speaker 1: one year or two years on, which is necessary for
Speaker 1: addressing the seasonality of things like vegetation, but also the
Speaker 1: period of record. So if you're looking to go back
Speaker 1: a very long time, your or limited by what products
Speaker 1: have been available for that long And the further back
Speaker 1: you go in time, the lower the spatial resolution tends
Speaker 1: to be, so there's sort of a trade off there.
Speaker 1: And just a reminder, all of these questions will be
Speaker 1: up on the training web page within a week after
Speaker 1: I've had time to go through and clean up and
Speaker 1: answer everything more thoroughly.
Speaker 2: And yes, thank you.
Speaker 1: I see in the chat Elizabeth, the link on slide
Speaker 1: thirty nine does appear to be incorrect, and that is
Speaker 1: the correct link. We'll have that fixed on the upload
Speaker 1: to the training web page. But yes, thank you for
Speaker 1: catching that. It seems I copied the same link twice.
Speaker 2: And since it.
Speaker 1: Looks like there are no more questions coming in, I
Speaker 1: think we can go ahead and call it a bit early.
Speaker 1: I do want to say one more time, I really
Speaker 1: appreciate everybody attending both these sessions. Don't forget to do
Speaker 1: the homework, and we'll send out that certificate of completion.
Speaker 2: Thanks again, everyone,
Podbean