Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Mapping Invasive Species Using AVIRIS-NG Data

BioSCape Campaign Overview

BioSCape: In October/November of 2023, the US National Aeronautics and Space Administration (NASA) conducted its first Biodiversity field and airborne campaign across terrestrial and aquatic environments in the South African Greater Cape Floristic Region (GCFR). From 4 airborne instruments;

  • Airborne Visible-Infrared Imaging Spectrometer - Next Generation (AVIRIS-NG),

  • Portable Remote Imaging SpectroMeter (PRISM),

  • Hyperspectral Thermal Emission Spectrometer (HyTES), and

  • Land, Vegetation, and Ice Sensor (LVIS),

the BioSCape Campaign’s remote sensing data products provide an unprecedented level of image spectroscopy from VSWIR to TIR wavelengths as well as full-waveform laser altimeter measurements. Airborne data are supplemented with a rich combination of contemporaneous biodiversity-relevant field observations toward an approach to measure and understand functional, phylogenetic, and taxonomic biological diversity as components of ecosystem function.

final_class

This tutorial uses a AVIRIS-NG Level 3 Dataset

Brodrick, P. G., Chlus, A. M., Eckert, R., Chapman, J. W., Eastwood, M., Geier, S., Helmlinger, M., Lundeen, S. R., Olson-Duvall, W., Pavlick, R., Rios, L. M., Thompson, D. R., & Green, R. O. (2025). BioSCape: AVIRIS-NG L3 Resampled Reflectance Mosaics, V2 (Version 1). ORNL Distributed Active Archive Center. Brodrick et al. (2025)

AVIRIS-NG L3 Resampled Mosaics: Surface reflectance data (Level 2b) derived from the AVIRIS-NG instrument were resampled to 5-m spatial resolution and mosaiced into a regular tile system of 807 tiles. A given tile includes multiple AVIRIS-NG scenes from multiple flight lines spanning multiple days. The mosaics in this dataset were generated by stitching together separate scenes and resampling to 5-m resolution in the Hartebeesthoek94 projected coordinate system (WGS-84 datum, EPSG 9221). The mosaic files are distributed on a tiled grid system, and the tile name is included in the file name. Mosaics were generated by manually grouping sets of flight lines into different chunks that should be placed 'in front of' or 'behind' other chunks. The selection criteria included a combination of the weather during observations, flight conditions, flightbox design, and the time the flight was taken.

Dataset Data Processing Levels

  • Level 3: Variables mapped on uniform space-time grid scales, usually with some completeness and consistency.


Credit: The contents of this Notebook were first presented by Glen Moncrieff, Spatial Data Scientist, The Nature Conservancy, at the
BioSCape Data Skills Workshop - From the Field to the Image. October 9 - 11, 2024, Cape Town, South Africa

  • Content has been updated and adjusted to access published BioSCape AVIRIS-NG L3 data in netCDF formats distributed through NASA Earthdata


Tutorial Learning Objectives

In this notebook, we will use existing data of verified land cover and alien species locations to extract spectra from AVIRIS NG surface reflectance data and apply to a Machine Learning Model.

  1. Understand how to inspect and prepare data for machine learning models

  2. Train and interpret a machine learning model

  3. Apply a trained model to AVIRIS imagery to create alien species maps

Bonus Objectives

  1. NASA Earthdata datasets Search and Discovery

  2. NASA Earthdata Cloud access and analysis

  3. Imaging Spectroscopy dataset access, visualization, and analysis


Load Python Modules

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

A Couple Practical Details to Start

1. Earthdata Authentication

Earthdata Login: NASA Earthdata Login is a user registration and profile management system for users getting Earth science data from NASA Earthdata. If you download or access NASA Earthdata data, you need an Earthdata Login.

earthaccess: earthaccess is a Python library that simplifies data discovery and access to NASA Earthdata data by providing an abstraction layer to NASA’s APIs for programmatic access.

earthaccess

earthaccess will be used to:

  • Authentication: - handles a user’s identity (authentication) with NASA’s Earthdata Login (EDL),

  • Search: search the NASA Earthdata Data holdings using NASA’s Common Metadata Repository (CMR), and

  • Access: provide direct cloud file download and access

The earthaccess search_datasets function with the keyword argument can be used to search NASA Earthdata datasets.

  • datasets are often called collections

Collections found: 12
Loading...

Data Collections and Labeling

Explore Sample Land Type Plot-Level Data

For plot-level training data, we will use a small dataset over the Cape Town Peninsula of South Africa of manually collected invasive plant and land cover labels

  • ct_invasive.gpkg

  • This geopackage is uploaded to the shared-public folder area of the Hub

Loading...
Loading...

Summarize and Visualize the Training Data Land Types

LandType Bare ground/Rock 32 Eucalyptus 30 Forest 34 Mature Fynbos 44 Pine 36 Recently Burnt Fynbos 32 Water 32 Wattle 24 Wetland 55 dtype: int64
group 1 254 2 65 dtype: int64
Loading...

Imaging Spectroscopy Data

Search and Access BioSCape AVIRIS-NG L3 Data

Total Datasets (results) found: 870
Loading...
{'cloud_hosted': True, 'uuid': 'f79147b0-2c63-41de-a476-cec3ef9f960c', 'render_dict': Collection: {'ShortName': 'BioSCape_ANG_V02_L3_RFL_Mosaic_2427', 'Version': '2'} Spatial coverage: {'HorizontalSpatialDomain': {'Geometry': {'GPolygons': [{'Boundary': {'Points': [{'Longitude': 18.8167, 'Latitude': -33.438}, {'Longitude': 18.8225, 'Latitude': -33.3487}, {'Longitude': 18.7143, 'Latitude': -33.3439}, {'Longitude': 18.7085, 'Latitude': -33.4332}, {'Longitude': 18.8167, 'Latitude': -33.438}]}}]}}} Temporal coverage: {'RangeDateTime': {'BeginningDateTime': '2023-10-22T00:00:00Z', 'EndingDateTime': '2023-11-26T23:59:59Z'}} Size(MB): 6760.123710632324 Data: ['https://data.ornldaac.earthdata.nasa.gov/protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_28_14_QL.tif', 'https://data.ornldaac.earthdata.nasa.gov/protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_28_14_UNC.nc', 'https://data.ornldaac.earthdata.nasa.gov/protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_28_14_RFL.nc']}

Create and Visualize Bounding Boxes of the AVIRIS-NG L3 files

From each granule, we’ll use the CMR Geometry information to create a plot of the AVIRIS-3 flight lines from our temporal and spatial subset

Below, we convert NASA’s Unified Metadata Model (UMM) geometry to a geopandas dataframe to plot the search results over a basemap.

Loading...

Open and Explore a single AVIRIS-NG L3 Reflectance file to inspect the data

  • Using a granule name filter to identify a particular file set, we will search_data using the dataset doi and use the data_links method to directly access and then open data files.

['s3://ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_11_QL.tif', 's3://ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_11_UNC.nc', 's3://ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_11_RFL.nc']
Loading...
Loading...
Loading...
[<File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_11_QL.tif>, <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_11_UNC.nc>, <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_11_RFL.nc>]

Open the netCDF Reflectance File

  • xarray is an open source project and Python package that introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays

  • notice the use of xarray’s open_datatree to accomodate the hierarchical grouping of the AVIRIS-NG netCDF file

  • we will extract the reflectance variable from the groupings

Loading...

Plot just a red reflectance

Loading...

Plot the quicklook image

Loading...

Subset the AVIRIS-NG data files to the Intersection of the Plot data

For our analysis demonstration in this Notebook, we’ll narrow the flight tiles to the area of the Plot data in the Cape Penisula.

  • we’ll use the earthaccess bounding_box parameter to query granules that spatially intersect with the bounding box of class_data

Loading...

Extract Spectra for each Land Plot

Now that we are familiar with the data, we want to get the AVIRIS spectra at each label location. Below is a function that does this and returns the result as a xarray

Loading...
Loading...
Loading...
got 40 points from AVIRIS-NG_BIOSCAPE_V02_L3_37_11
got 3 points from AVIRIS-NG_BIOSCAPE_V02_L3_37_12
got 26 points from AVIRIS-NG_BIOSCAPE_V02_L3_38_11
got 3 points from AVIRIS-NG_BIOSCAPE_V02_L3_35_10
got 11 points from AVIRIS-NG_BIOSCAPE_V02_L3_36_12
got 7 points from AVIRIS-NG_BIOSCAPE_V02_L3_39_12
got 22 points from AVIRIS-NG_BIOSCAPE_V02_L3_38_12
got 67 points from AVIRIS-NG_BIOSCAPE_V02_L3_36_11
got 32 points from AVIRIS-NG_BIOSCAPE_V02_L3_34_11
got 4 points from AVIRIS-NG_BIOSCAPE_V02_L3_39_11
got 104 points from AVIRIS-NG_BIOSCAPE_V02_L3_35_11
Loading...
Loading...

Merge with point data to add labels class and group

  • data set just has the spectra

  • The merge() function from xarray combines the variables from the two datasets along their shared coordinates

Loading...

We have defined all the operations we want, but becasue of xarrays lazy computation, the calculations have not yet been done.

  • We will now force calculations and store results in memory

  • We want to keep the result in chunks, so we use .persist() and not .compute()

  • The code is commented out, but available

[########################################] | 100% Completed | 13m 9ss
Loading...

Inspect AVIRIS spectra

Loading...

Plot the spectral profile extracted for each point location by LandType (class)

Loading...

At this point in a real machine learning workflow, you should closely inspect the spectra you have for each class. Do they make sense? Are there some spectra that look weird? You should re-evaluate your data to make sure that the assigned labels are true. This is a very important step

Prep Spectra Data for ML model

  • drop bad wavelenghts

  • Normalize data

As you will know, not all of the wavelengths in the data are of equal quality, some will be degraded by atmospheric water absorption features or other factors. We should remove the bands from the analysis that we are not confident of. We will simply use some prior knowledge to screen out the worst bands.

Loading...

Next we will normalize the data, there are a number of difference normalizations to try. In a ML workflow you should try a few and see which work best. We will only use a Brightness Normalization. In essence, we scale the reflectance of each wavelength by the total brightness of the spectra.

In applications like hyperspectral imaging or spectral data analysis, brightness normalization helps eliminate differences caused by varying magnitudes of the reflectance. This ensures that the analysis of spectral features focuses entirely on the shape or characteristics of the spectra, independent of overall brightness or intensity.

The reflectance values are scaled to create a consistent baseline for comparing spectra or features.

Plot the new, clean spectra

Loading...

CONGRATULATIONS! You have collected and labeled spectra data for each of the plot locations to use in a Machine Learning Model


Train and Evaluate the ML model

We will be using a model called xgboost. There are many different kinds of ML models. xgboost, or Extreme Gradient Boosting, is a class of models called gradient boosted trees, related to random forests. When used for classification, random forests work by creating multiple decision trees, each trained on a random subset of the data and features, and then averaging their predictions to improve accuracy and reduce overfitting.

Gradient boosted trees differ from random forests in that they build trees sequentially, with each new tree focusing on correcting the errors of the previous ones. This sequential approach allows xgboost to create highly accurate models by iteratively refining predictions and addressing the weaknesses of earlier trees.

Import the Machine Learning libraries we will use.

Our dataset has a label group indicating to which set the data belong

  1. training

  2. test/evaluation

group 1 254 2 65 dtype: int64

Separate the data into training and evaluation subsets for model training and evaluation, respectively

Train ML model

The steps we will go through to train the model are:

  • First, we define the hyperparameter grid. Initially, we set up a comprehensive grid (param_grid) with multiple values for several hyperparameters of the XGBoost model.

  • Next, we create an XGBoost classifier object using the XGBClassifier class from the XGBoost library.

We then set up the GridSearchCV object using our defined XGBoost model and the hyperparameter grid.

GridSearchCV allows us to perform an exhaustive search over the specified hyperparameter values to find the optimal combination that results in the best model performance. We choose a 5-fold cross-validation strategy (cv=5), meaning we split our training data into five subsets to validate the model’s performance across different data splits. We use accuracy as our scoring metric to evaluate the models.

After setting up the grid search, we fit the GridSearchCV object to our training data (X_train and y_train).

This process involves training multiple models with different hyperparameter combinations and evaluating their performance using cross-validation. Our goal is to identify the set of hyperparameters that yields the highest accuracy.

Once the grid search completes, we print out the best set of hyperparameters and the corresponding best score.

The grid_search.best_params_ attribute provides the combination of hyperparameters that achieved the highest cross-validation accuracy, while the grid_search.best_score_ attribute shows the corresponding accuracy score. Finally, we extract the best model (best_model) from the grid search results. This model is trained with the optimal hyperparameters and is ready for making predictions or further analysis in our classification task.

This will take approx 30 seconds

Best set of hyperparameters:  {'learning_rate': 0.1, 'max_depth': 5, 'n_estimators': 50, 'subsample': 0.75}
Best score:  0.6576470588235294

Evaluate Model Performance

We will use our best model to predict the classes of the test data. Then, we calculate the F1 score using f1_score, which balances precision and recall, and print it to evaluate overall performance.

Next, we assess how well the model performs for predicting Eucalyptus by calculating its precision and recall.

  • Precision measures the accuracy of the positive predictions. It answers the question, “Of all the instances we labeled as Eucalyptus, how many were actually Eucalyptus?”.

  • Recall measures the model’s ability to identify all actual positive instances. It answers the question, “Of all the actual Eucalyptus, how many did we correctly identify?”.

  • You may also be familiar with the terms Users’ and Producers’ Accuracy. Precision = User’ Accuracy, and Recall = Producers’ Accuracy.

Finally, we create and display a confusion matrix to visualize the model’s prediction accuracy across all classes

Accuracy: 0.676923076923077
F1 Score (weighted): 0.674065621789407
Precision for Class 6: 0.5
Recall for Class 6: 0.7142857142857143
<Figure size 640x480 with 2 Axes>
  • Accuracy provides a general measure of how well the classifier performs overall

    • It is the Number of Correct Predictions divided by the Total Number of Samples

  • Precision measures the proportion of true positive predictions relative to the total predicted positives for a class

  • Confusion Matrix Computes the matrix summarizing the classifier’s predictions. Each row corresponds to the true label, and each column corresponds to the predicted label. The diagonal elements represent correctly classified samples, while off-diagonal elements represent misclassifications

Loading...

Interpret and Understand ML model

Model interpretation in machine learning is crucial for understanding how models make predictions, especially in complex models. SHAP (SHapley Additive exPlanations) scores are a popular method for interpreting model predictions. They provide a way to explain the output of any machine learning model by assigning each feature an importance value for a particular prediction.

SHAP scores explain the contribution of each feature to a model’s prediction using concepts from cooperative game theory. They start with a baseline prediction, which is the average prediction across all data points. For each feature, SHAP calculates how much the prediction changes when the feature is included compared to when it is not, considering all possible combinations of features. The SHAP value for a feature is the average of its contributions across all combinations, ensuring fair distribution.

  • Positive SHAP values indicate the feature increases the prediction, while negative values suggest it decreases it.

Loading...

Visualize a prediction’s explanation

Force Plot We can select an individual prediction to inspect how the input features have influenced its assignment to a class.

  • Features pushing the prediction higher are shown in red, those pushing the prediction lower are in blue

  • base value (the average model output over the training dataset we passed) to the model output

predicted class: Eucalyptus
true class: Eucalyptus
Loading...
predicted class: Forest
true class: Pine
Loading...

Beeswarm We can also inspect the importance of features across all instances of a particular class.

  • To get an overview of which features are most important for a model we can plot the SHAP values of every feature for every sample

  • The color represents the feature value (red high, blue low)

<Figure size 800x550 with 2 Axes>

Finally, lets overlay this on the actual spectra for a individual observation to understand how spectral features are contributing to our predictions.

<Figure size 1200x600 with 2 Axes>

Deploy the Model to AVIRIS-NG Scenes

First, limit predictions to natural areas only

This model was only trained on data covering natural vegetaton in the Cape Peninsula, It is important that we only predict in the areas that match our training data. We will therefore filter to scenes that cover the Cape Peninsula and mask out non-protected areas.

Loading...

Limit the Cape Town Peninsula AVIRIS-NG scenes to those that intersect with the South Africa Protected Areas

Loading...

Predict over one AVIRIS scene

We now have a trained model and are ready to deploy it to generate predictions across an entire AVIRIS scene and map the distribution of invasive plants. This involves handling a large volume of data, so we need to write the code to do this intelligently. We will accomplish this by applying the .predict() method of our trained model in parallel across the chunks of the AVIRIS xarray. The model will receive one chunk at a time so that the data is not too large, but it will be able to perform this operation in parallel across multiple chunks, and therefore will not take too long.

Here is the function that we will actually apply to each chunk. Simple really. The hard work is getting the data into and out of this function

  • chunk - a portion of input data (e.g., a subset of the dataset) The function processes chunks for efficient computation and prediction

  • model - This is our trained machine learning model

  • predict_proba() is used to predict the class probabilities

Now we define the function that takes as input the path to the AVIRIS file and pass the data to the predict function. This is composed of 4 parts:

  • Part 1: Opens the AVIRIS data file using xarray and sets a condition to identify valid data points where reflectance values are greater than zero.

  • Part 2: Applies all the transformations that need to be done before the data goes to the model. It puts the spatial dimensions (x and y) into a single dimension, filters wavelengths, and normalizes the reflectance data.

  • Part 3: Applies the machine learning model, best_model, to the normalized data in parallel, predicting class probabilities for each data point using xarray’s apply_ufunc method. Most of the function involves defining what to do with the dimensions of the old dataset and the new output

  • Part 4: Unstacks the data to restore its original dimensions, sets spatial dimensions and coordinate reference system (CRS), clips the data, and transposes the data to match expected formats before returning the results.

Let’s test that it works on a single file before we run it through 100s of GB of data.

Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_11_RFL.nc>
Loading...

The AVIRIS tile is AVIRIS-NG_BIOSCAPE_V02_L3_36_11_RFL.nc

Loading...

Let’s plot an image of the tile’s AVIRIS-NG_BIOSCAPE_V02_L3_36_11_RFL.nc output. This takes some time to plot.

Loading...

ML models typically provide a single prediction of the most likely outcomes. You can also get probability-like scores (values from 0 to 1) from these models, but they are not true probabilities. If the model gives you a score of 0.6, that means it is more likely than a prediction of 0.5, and less likely than 0.7. However, it does not mean that in a large sample your prediction would be right 60 times out of 100. To get calibrated probabilities from our models, we have to apply additional steps. We can also get a set of predictions from models rather than a single prediction, which reflects the model’s true uncertainty using a technique called conformal predictions. Read more about conformal prediction for geospatial machine learning in this amazing paper:

Singh, G., Moncrieff, G., Venter, Z., Cawse-Nicholson, K., Slingsby, J., & Robinson, T. B. (2024). Uncertainty quantification for probabilistic machine learning in earth observation using conformal prediction. Scientific Reports, 14(1), 16166.

OK, now we are ready to apply the prediction to each tile.

  • This loops through each AVIRIS-NG L3 tile, but won’t take long, as we have not yet asked it to perform the computation.

Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_37_11_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_37_12_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_34_12_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_38_11_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_10_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_35_10_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_37_10_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_12_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_39_12_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_38_12_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_36_11_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_34_11_RFL.nc>
Loading...
Loading...
Loading...
file: <File-like object S3FileSystem, ornl-cumulus-prod-protected/bioscape/BioSCape_ANG_V02_L3_RFL_Mosaic/data/AVIRIS-NG_BIOSCAPE_V02_L3_35_12_RFL.nc>

Merge and Mosaic results

The results are now available as a list of xarrays, one for each scence. We want to combine these together into a single seamless mosaic for the entire Cape Peninsula. Fortunately we don’t have to write a ton of code to do this as rioxarray already has a mosaic function

This next code block will force computation and take about 10-30 mins to run on a 4 core, 16GB RAM machine. We wont run this, but rather load the results computed earlier.

Restart if/as Needed

The file we are about to load is large. If the kernel is restarted, we will remove all existing data and free up space. We will then need to reload packages.

view the result

Now we can inspect our results. Where do they look good? Where do they look bad? We should at this point return to the beginning of our workflow and refine every step of the process. Probably most importantly we should update our training data to include points that correct the errors that we see in our earlier outputs. This process of using early predictions to update our data is called ‘Active Learning’

CREDITS:

Find all of the October 2025 BioSCape Data Workshop Materials/Notebooks

This Notebook is an adaption of Glenn Moncrieff’s BioSCape Data Workshop Notebook: Mapping invasive species using supervised machine learning and AVIRIS-NG

  • This Notebook accesses and uses an updated version of AVIRIS-NG data with improved corrections and that are in netCDF file formats

Glenn’s lesson borrowed from:

References
  1. Brodrick, P. G., Chlus, A. M., Eckert, R., Chapman, J. W., Eastwood, M., Geier, S., Helmlinger, M., Lundeen, S. R., Olson-Duvall, W., Pavlick, R., Rios, L. M., Thompson, D. R., & Green, R. O. (2025). BioSCape: AVIRIS-NG L3 Resampled Reflectance Mosaics, V2. Oak Ridge National Laboratory, Oak Ridge, Tennessee, USA. 10.3334/ORNLDAAC/2427