Skip to article frontmatterSkip to article content

Advanced Baseline Imager (ABI) data with Satpy

pythia ncar

This notebook is developed during the pythia cook-off at NCAR Mesa-Lab Boulder Colorado, June 12-14, 2024

Participants in the workshop event have the chance to practice collaborative problem-solving and hands-on learning in the field of Python programming.

This notebook is part of the Breakout Topic: Geostationary on AWS, lead by Jorge Humberto Bravo Mendez jbravo2@stevens.edu, from Stevens Institute of Technology

Advanced Baseline Imager (ABI) data with Satpy

Using Satpy to read and Advanced Baseline Imager (ABI) data from GOES-R satellites. Here’s a step-by-step guide:


Overview

It takes a methodical approach to efficiently access, evaluate, and visualize satellite imagery in order to create a Jupyter Notebook to read Advanced Baseline Imager (ABI) data with Satpy. The notebook starts by configuring the environment and importing the modules before gaining access to ABI data from AWS. A Satpy Scene object is initialized by using the Python library Satpy, which is designed for earth-observing satellite instruments. It specifies the ABI data file(s) and the relevant reader. The desired ABI channels or products are then loaded into the Scene object. Then, the loaded data is accessed and visualized using the built-in visualization tools of Matplotlib or Satpy. To ensure that the analysis is clear and repeatable, the notebook places a strong emphasis on comprehensive documentation and explanation. Users can learn more about the analysis of satellite imagery with this methodical approach, opening up a world of possibilities for everything from environmental research to weather monitoring.

Prerequisites

Info

Some prerequisites to understanding Satpy effectively:
  1. Basic Python: Since Satpy is a Python library, knowledge of the Python programming language is required. It is essential to comprehend ideas such as variables, data types, loops, functions, and libraries/modules.

  2. Knowledge of Satellite Data: Although not required, it can be helpful to have some knowledge of satellite data and its uses. This entails being familiar with satellite instruments, data formats, and the different kinds of data that satellites gather.

  3. Concepts of Data Processing: It is beneficial to have a basic understanding of concepts related to reading, modifying, and visualizing data. Understanding these ideas will help in making the most of Satpy, as it offers features for reading, processing, and analyzing satellite data.

  4. Python Libraries: It can be helpful to have some knowledge of other Python libraries that are frequently used in scientific computing, such as NumPy, Matplotlib, and Pandas. These libraries are frequently integrated with Satpy for tasks involving data manipulation and visualization.


Warning

Before starting, we must obtain data
### List of files to download for testing
urls2dwn = [ 
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C01_G16_s20210992350171_e20210992359479_c20210992359525.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C02_G16_s20210992350171_e20210992359479_c20210992359522.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C03_G16_s20210992350171_e20210992359479_c20210992359530.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C04_G16_s20210992350171_e20210992359479_c20210992359514.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C05_G16_s20210992350171_e20210992359479_c20210992359533.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C06_G16_s20210992350171_e20210992359484_c20210992359528.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C07_G16_s20210992350171_e20210992359490_c20210992359539.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C08_G16_s20210992350171_e20210992359479_c20210992359535.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C09_G16_s20210992350171_e20210992359484_c20210992359551.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C10_G16_s20210992350171_e20210992359490_c20210992359536.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C11_G16_s20210992350171_e20210992359479_c20210992359545.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C12_G16_s20210992350171_e20210992359484_c20210992359539.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C13_G16_s20210992350171_e20210992359490_c20210992359555.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C14_G16_s20210992350171_e20210992359479_c20210992359547.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C15_G16_s20210992350171_e20210992359484_c20210992359557.nc',
  'https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadF/2021/099/23/OR_ABI-L1b-RadF-M6C16_G16_s20210992350171_e20210992359490_c20210992359542.nc']
import requests
import os

# Specify the local directory where you want to save the files.
# local_directory = input("Enter the path to the download folder: ")
local_directory = "Output_data/ABI-L1b-RadF/s20210992350171"
# Ensure that the local directory exists; create it if it doesn't.
os.makedirs(local_directory, exist_ok=True)

# Iterate through the URLs and download files.
for urld in urls2dwn:
    # Extract the filename from the URL.
    ntw = urld.split('/')[-1]
    
    # Construct the complete path to save the file in the local directory.
    file_path = os.path.join(local_directory, ntw)
    
    # Send an HTTP GET request to the URL.
    resp = requests.get(urld)
    
    # Check if the response is successful (status code 200).
    if resp.status_code == 200:
        # Write the content to the file in binary mode.
        with open(file_path, "wb") as file:
            file.write(resp.content)
        print(f"File '{ntw}' downloaded and saved to '{local_directory}'.")
    else:
        print(f"Failed to download '{ntw}' from the URL: {urld}")
File 'OR_ABI-L1b-RadF-M6C01_G16_s20210992350171_e20210992359479_c20210992359525.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C02_G16_s20210992350171_e20210992359479_c20210992359522.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C03_G16_s20210992350171_e20210992359479_c20210992359530.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C04_G16_s20210992350171_e20210992359479_c20210992359514.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C05_G16_s20210992350171_e20210992359479_c20210992359533.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C06_G16_s20210992350171_e20210992359484_c20210992359528.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C07_G16_s20210992350171_e20210992359490_c20210992359539.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C08_G16_s20210992350171_e20210992359479_c20210992359535.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C09_G16_s20210992350171_e20210992359484_c20210992359551.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C10_G16_s20210992350171_e20210992359490_c20210992359536.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C11_G16_s20210992350171_e20210992359479_c20210992359545.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C12_G16_s20210992350171_e20210992359484_c20210992359539.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C13_G16_s20210992350171_e20210992359490_c20210992359555.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C14_G16_s20210992350171_e20210992359479_c20210992359547.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C15_G16_s20210992350171_e20210992359484_c20210992359557.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.
File 'OR_ABI-L1b-RadF-M6C16_G16_s20210992350171_e20210992359490_c20210992359542.nc' downloaded and saved to 'Output_data/ABI-L1b-RadF/s20210992350171'.

Imports

# To stop extraneous warning messages from clogging the notebook output, 
# import the warnings module and set it to ignore all warnings.
import warnings
warnings.filterwarnings('ignore')

# Scene is a representation of satellite data that enables functions such as data reading, 
# data resampling, data compositing, and data saving.
from satpy.scene import Scene
# This line imports the debug_on function from the satpy.utils module, which is used to enable detailed 
# debug logging in Satpy. This can be helpful for troubleshooting and understanding the internal workings of Satpy processes.
from satpy.utils import debug_on

# Importing datetime for date and time operations. Processing time-stamped satellite data 
# is necessary for accurate time-based operations and analysis.
from datetime import datetime

# Using glob allows for efficient and flexible file handling, especially when dealing with 
# large datasets typically generated by geostationary satellites.
from glob import glob
# The magic command '%matplotlib inline' configures the Jupyter Notebook to display plots directly below the code cells.
# This setting is essential for interactive data visualization, especially when plotting data from geostationary satellites.
%matplotlib inline

Starting to create satpy scenes

Attention

SatPy requires the original file names at all times!

Therefore, don't alter them when you save the data locally. SatPy won't be able to open the files if this is the case.

sat_files = glob("./Output_data/ABI-L1b-RadF/s20210992350171/*")
sat_files
['./Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C10_G16_s20210992350171_e20210992359490_c20210992359536.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C11_G16_s20210992350171_e20210992359479_c20210992359545.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C07_G16_s20210992350171_e20210992359490_c20210992359539.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C12_G16_s20210992350171_e20210992359484_c20210992359539.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C16_G16_s20210992350171_e20210992359490_c20210992359542.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C06_G16_s20210992350171_e20210992359484_c20210992359528.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C01_G16_s20210992350171_e20210992359479_c20210992359525.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C08_G16_s20210992350171_e20210992359479_c20210992359535.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C15_G16_s20210992350171_e20210992359484_c20210992359557.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C09_G16_s20210992350171_e20210992359484_c20210992359551.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C14_G16_s20210992350171_e20210992359479_c20210992359547.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C05_G16_s20210992350171_e20210992359479_c20210992359533.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C02_G16_s20210992350171_e20210992359479_c20210992359522.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C03_G16_s20210992350171_e20210992359479_c20210992359530.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C04_G16_s20210992350171_e20210992359479_c20210992359514.nc', './Output_data/ABI-L1b-RadF/s20210992350171/OR_ABI-L1b-RadF-M6C13_G16_s20210992350171_e20210992359490_c20210992359555.nc']
# Create a Scene object named 'scn' by providing a list of filenames obtained from 'fGRl1b'.
# The Scene object is a core part of the Satpy library, which organizes and manages multiple data sources typically from satellite observations.
scn = Scene(filenames = sat_files, reader = 'abi_l1b')

# Retrieve the names of all datasets available in the 'scn' object, which represent various satellite data channels.
# This information is crucial for understanding what types of data are available for analysis, such as different spectral bands and derived products.
dataset_names = scn.all_dataset_names()

# Output the list of dataset names. This is useful for educational purposes to show students the variety of data that can be processed
# and to select specific datasets for further analysis in practical exercises.
print(dataset_names)
['C01', 'C02', 'C03', 'C04', 'C05', 'C06', 'C07', 'C08', 'C09', 'C10', 'C11', 'C12', 'C13', 'C14', 'C15', 'C16']
# Load multiple datasets using a list comprehension to generate dataset names.
# List comprehensions provide a concise way to create lists based on existing lists or ranges.
# In this case, we generate names for the datasets 'C01' to 'C16', which are typical channel identifiers in satellite data.
scn.load([f'C{x:02d}' for x in range(1, 17)])

# Explanation of the list comprehension:
# [f'C{x:02d}' for x in range(1, 17)] creates a list of strings from 'C01' to 'C16'.
# 'f' before the string starts an f-string, allowing us to insert variables directly into the string.
# '{x:02d}' formats the number 'x' as a two-digit decimal, padding with zeros if necessary.

# The 'scn.load' function is then used to load these specific datasets into the Scene object.
# Loading multiple channels like this is common in the analysis of satellite imagery,
# where each channel can represent different spectral bands and contain different types of environmental information.
# The method 'available_composite_names' is called on the 'scn' object.
# This method retrieves a list of all the composite images that can be created using the loaded data channels.
# Composite images are made by combining multiple data channels to enhance the visualization and interpretation of satellite data.
# This feature is particularly useful in the study of geostationary satellites, as it allows for more detailed and informative visual representations of atmospheric phenomena.

# Retrieve and print the list of available composite names, providing a crucial insight into the data visualization capabilities.
print(scn.available_composite_names())
['24h_microphysics', 'airmass', 'ash', 'blowing_snow', 'cimss_cloud_type', 'cimss_cloud_type_raw', 'cimss_green', 'cimss_green_sunz', 'cimss_green_sunz_rayleigh', 'cimss_true_color', 'cimss_true_color_sunz', 'cimss_true_color_sunz_rayleigh', 'cira_day_convection', 'cira_fire_temperature', 'cloud_phase', 'cloud_phase_distinction', 'cloud_phase_distinction_raw', 'cloud_phase_raw', 'cloudtop', 'color_infrared', 'colorized_ir_clouds', 'convection', 'day_cloud_type', 'day_microphysics', 'day_microphysics_abi', 'day_microphysics_eum', 'day_severe_storms', 'day_severe_storms_tropical', 'dust', 'fire_temperature_awips', 'fog', 'geo_color', 'geo_color_background_with_low_clouds', 'geo_color_high_clouds', 'geo_color_low_clouds', 'geo_color_night', 'green', 'green_crefl', 'green_nocorr', 'green_raw', 'green_snow', 'highlight_C14', 'ir108_3d', 'ir_cloud_day', 'land_cloud', 'land_cloud_fire', 'natural_color', 'natural_color_nocorr', 'natural_color_raw', 'natural_color_raw_with_night_ir', 'night_fog', 'night_ir_alpha', 'night_ir_with_background', 'night_ir_with_background_hires', 'night_microphysics', 'night_microphysics_eum', 'night_microphysics_tropical', 'overshooting_tops', 'overview', 'overview_raw', 'rocket_plume_day', 'rocket_plume_night', 'snow', 'snow_fog', 'so2', 'tropical_airmass', 'true_color', 'true_color_crefl', 'true_color_nocorr', 'true_color_raw', 'true_color_reproduction', 'true_color_reproduction_corr', 'true_color_reproduction_uncorr', 'true_color_with_night_fires', 'true_color_with_night_fires_nocorr', 'true_color_with_night_ir', 'true_color_with_night_ir_hires', 'water_vapors1', 'water_vapors2']
# Assign the dataset name 'airmass' to the variable 'rgb_im'.
# This variable naming provides clarity when referencing the dataset in multiple places, 
# ensuring consistency and reducing the likelihood of errors in dataset identification.
rgb_im = 'airmass'

# Load the dataset named 'airmass' using the 'scn.load' method.
# The 'airmass' composite is particularly useful in meteorology as it combines several spectral bands to highlight features like dust, ash, and water vapor,
# making it easier to analyze atmospheric conditions from geostationary satellite data.
scn.load([rgb_im])

# Display the loaded 'airmass' dataset using 'scn.show'.
# This method visualizes the specified dataset, allowing students to see the practical application of satellite data composites 
# and understand their relevance in real-world atmospheric monitoring and analysis.
scn.show(rgb_im)
<trollimage.xrimage.XRImage at 0x7f9eb269d2b0>
# Access the dataset named 'airmass' from the 'scn' object using the previously defined variable 'rgb_im'.
# The variable 'rgb_im' holds the string 'airmass', which acts as a key to retrieve the corresponding dataset from the Scene object.
# This operation is critical in satellite data processing as it allows for direct manipulation and analysis of specific datasets.
result = scn[rgb_im]

# The retrieved dataset can then be used for further analysis, visualization, or processing.
# It's important for students to understand how to efficiently access and work with specific datasets within a complex data structure.
result
Loading...
# Retrieve the keys (dataset names) available in the 'scn' object
# This function lists all dataset identifiers stored in the Scene object, each represented as a DataID object.
keys = scn.keys()

# The output is a list of DataID objects, each encapsulating the metadata for a different satellite data channel or composite.
# These DataIDs include crucial information such as:
# - name: The identifier of the dataset, like 'C01', 'C02', ..., 'C16', 'airmass'.
# - wavelength: A WavelengthRange object indicating the spectral range each channel covers, important for identifying the type of observations (e.g., visible, infrared).
# - resolution: The spatial resolution of the data in meters, which affects the detail level visible in the imagery.
# - calibration: The type of calibration applied to the data, which could be reflectance or brightness temperature, impacting how the data should be interpreted.
# - modifiers: Any additional processing applied to the data channel.

# Print the keys to show the available datasets and their properties, aiding in understanding the capabilities and focus areas of the satellite instrument.
keys
[DataID(name='C01', wavelength=WavelengthRange(min=0.45, central=0.47, max=0.49, unit='µm'), resolution=1000, calibration=<1>, modifiers=()), DataID(name='C02', wavelength=WavelengthRange(min=0.59, central=0.64, max=0.69, unit='µm'), resolution=500, calibration=<1>, modifiers=()), DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=()), DataID(name='C04', wavelength=WavelengthRange(min=1.3705, central=1.378, max=1.3855, unit='µm'), resolution=2000, calibration=<1>, modifiers=()), DataID(name='C05', wavelength=WavelengthRange(min=1.58, central=1.61, max=1.64, unit='µm'), resolution=1000, calibration=<1>, modifiers=()), DataID(name='C06', wavelength=WavelengthRange(min=2.225, central=2.25, max=2.275, unit='µm'), resolution=2000, calibration=<1>, modifiers=()), DataID(name='C07', wavelength=WavelengthRange(min=3.8, central=3.9, max=4.0, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='C08', wavelength=WavelengthRange(min=5.77, central=6.185, max=6.6, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='C09', wavelength=WavelengthRange(min=6.75, central=6.95, max=7.15, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='C10', wavelength=WavelengthRange(min=7.24, central=7.34, max=7.44, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='C11', wavelength=WavelengthRange(min=8.3, central=8.5, max=8.7, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='C12', wavelength=WavelengthRange(min=9.42, central=9.61, max=9.8, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='C13', wavelength=WavelengthRange(min=10.1, central=10.35, max=10.6, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='C14', wavelength=WavelengthRange(min=10.8, central=11.2, max=11.6, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='C15', wavelength=WavelengthRange(min=11.8, central=12.3, max=12.8, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='C16', wavelength=WavelengthRange(min=13.0, central=13.3, max=13.6, unit='µm'), resolution=2000, calibration=<2>, modifiers=()), DataID(name='airmass', resolution=2000)]
# Access the area information associated with the 'C13' dataset in the 'scn' object.
# The area property of a dataset within a Scene object provides geographical and geometric details about the satellite data.
# This includes information such as the projection, extent, resolution, and size of the dataset, which are crucial for spatial analysis.

# For the 'C13' dataset, which typically represents an infrared channel on geostationary satellites, 
# understanding its area is essential for accurately interpreting spatial phenomena observed in the imagery, such as cloud formations or surface temperatures.
area_info = scn["C13"].area

# Print the area information to provide insights into the spatial characteristics of the 'C13' dataset.
# This information supports tasks such as mapping, data integration with other geospatial datasets, and more precise environmental monitoring.
area_info
Loading...
# Access the area definition information for the 'C01' dataset in the 'scn' object.
# The 'area' property of a dataset provides detailed geographic and geometric information about where the satellite data was collected.
# This includes details such as projection type, coordinate reference system, image extent, and pixel resolution.

# The 'C01' channel, which often captures data in a visible light wavelength (approximately 0.47 µm),
# provides high-resolution imagery useful for detailed visual inspections of cloud cover, surface features, and atmospheric conditions.
area_info = scn["C01"].area

# Print the area information to give insights into the geographic scope and detail level of the 'C01' dataset.
# This is crucial for applications such as mapping, tracking environmental changes, and integrating satellite data with other geographic information systems (GIS).
area_info
Loading...
# Access the area definition information for the 'C02' dataset in the 'scn' object.
# The 'area' property of a dataset provides crucial geographic and geometric information about the data's capture region.
# This includes the projection type, coordinate system, extent of the image, and pixel resolution.

# The 'C02' channel is typically in the visible spectrum (centered around 0.64 µm), offering detailed imagery suitable for analyzing surface features,
# cloud formations, and atmospheric phenomena. This channel is instrumental in meteorological analysis and environmental monitoring.
area_info = scn["C02"].area

# Print the area information to provide insights into the geographic scope and resolution of the 'C02' dataset.
# Understanding this information is vital for accurate mapping, environmental monitoring, and integration with other geospatial data sources.
area_info
Loading...
# Load the "natural_color" dataset using the 'scn.load' method.
# The "natural_color" composite is a popular visual representation that combines multiple spectral bands
# to produce an image that approximates what the human eye would see from space. 
# This is particularly useful in earth observation for visualizing land cover, water bodies, and other natural features.

# The composite typically leverages red, green, and blue spectral bands to enhance the clarity and detail of the image,
# which makes it ideal for presentations, educational purposes, and initial visual assessments in environmental studies.
scn.load(["natural_color"])

# This step is crucial for subsequent visualization and analysis tasks, as it prepares the data for easy interpretation and application.
The following datasets were not created and may require resampling to be generated: DataID(name='natural_color')
# Get the area definition of the "C13" dataset from the 'scn' object.
# The 'area' property contains critical geographic and geometric information, including projection, extent, and resolution,
# which is essential for accurate geographic referencing in satellite imagery analysis.
rs = scn["C13"].area

# Resample the scene to the specified area definition.
# Resampling is a critical process in satellite data handling, allowing datasets to be standardized to a common spatial grid.
# This standardization is necessary for accurate comparison and integration of different data types and sources.

# Here, 'scn.resample(rs)' adjusts all data in the scene to match the area definition of the 'C13' dataset.
# This is particularly useful when preparing data for detailed analysis or visualization,
# ensuring consistency across different datasets within the same scene.
lscn = scn.resample(rs)

# The resulting 'lscn' is a new Scene object containing all the original data,
# but now aligned to the same geographic grid as the 'C13' dataset.
# This uniformity is crucial for subsequent processing steps, such as creating composites or conducting multi-temporal analysis.
# Load the "natural_color" dataset for the resampled scene.
# The 'natural_color' composite is designed to mimic the colors visible to the human eye by combining specific spectral bands.
# Loading this dataset into the resampled scene ('lscn') ensures that the data is properly aligned and standardized across the same geographic area.

lscn.load(["natural_color"])

# Display the "natural_color" dataset.
# This step involves visualizing the loaded dataset using the 'show' method, which renders the satellite image according to the data's true or natural color representation.
# Visualizing data in this way is particularly useful for presentations and educational purposes, providing a realistic view of earth's features such as vegetation, water bodies, and urban areas.

# lscn.show("natural_color")

# This visualization step is crucial for analyzing environmental and atmospheric conditions,
# as it allows observers to easily identify and assess visible features without the need for specialized image interpretation skills.
# Crop the resampled scene (lscn) to a specific geographic region defined by latitude and longitude bounds.
# The bounds are given as a tuple in the format (lon_min, lat_min, lon_max, lat_max).
# This operation is useful for focusing the analysis on a particular area of interest, reducing data volume and enhancing processing efficiency.
scn_c1 = lscn.crop(ll_bbox=(-65.7, 10.7, -55.9, 20.1))

# Display the "C13" dataset from the cropped scene (scn_c1).
# The "C13" channel typically represents an infrared wavelength used for observing cloud structure and surface temperature,
# crucial for meteorological studies and weather forecasting.
# Displaying this dataset allows for detailed observation of atmospheric conditions within the specified geographic area.

### Uncomment to show it
#scn_c1.show("C13")

# Visualizing specific channels like "C13" in defined geographic regions helps in targeted analysis,
# such as monitoring storm development or evaluating climate patterns in detail.
# This capability is particularly valuable in educational settings for demonstrating real-world applications of satellite data analysis.
# Load the "ash" dataset from the cropped scene (scn_c1).
# The "ash" composite is specifically designed to detect and visualize volcanic ash in the atmosphere using satellite data.
# This dataset is crucial for monitoring volcanic activity and assessing the distribution and movement of ash clouds,
# which can have significant impacts on air quality and aviation safety.
scn_c1.load(['ash'])

# Display the "ash" dataset from the cropped scene (scn_c1).
# Displaying this dataset allows for visual assessment of ash presence within the specified geographic area.
# The visualization is particularly useful in educational and operational settings for demonstrating how satellite data can be applied to real-world environmental challenges.

### Uncomment to show it
# scn_c1.show('ash')

# This step not only aids in the educational demonstration of satellite capabilities but also provides practical insights into the management of natural disasters.
# Such visualizations are essential tools in emergency response planning and environmental monitoring.
# Load the "so2" dataset from the cropped scene (scn_c1).
# The "so2" dataset is designed to detect sulfur dioxide (SO2) concentrations in the atmosphere using satellite data.
# SO2 is a significant volcanic gas and industrial pollutant, making this dataset crucial for monitoring air quality and volcanic activity.
scn_c1.load(['so2'])

# Display the "so2" dataset from the cropped scene (scn_c1).
# Displaying this dataset allows for a visual assessment of SO2 distribution within the specified geographic area.
# The visualization helps in understanding the spatial extent and concentration of sulfur dioxide, which is essential for both environmental and public health assessments.

### Uncomment to show it
# scn_c1.show('so2')

# This step not only aids in the educational demonstration of how satellite imagery can be utilized to monitor environmental pollutants but also provides practical insights into the management of air quality.
# Such visualizations are valuable tools for researchers, policymakers, and educators in understanding and addressing atmospheric pollution.