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:


Imports

import warnings
warnings.filterwarnings('ignore')

from satpy.scene import Scene
from satpy.utils import debug_on

from datetime import datetime

from glob import glob

Starting to create satpy scenes

sat_files = glob("input/G18_ABI-L1b-RadC/*")
sat_files
['input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C03_G18_s20230041816176_e20230041818550_c20230041818584.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C11_G18_s20230041816176_e20230041818549_c20230041818594.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C05_G18_s20230041816176_e20230041818550_c20230041819005.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C09_G18_s20230041816176_e20230041818555_c20230041819014.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C06_G18_s20230041816176_e20230041818555_c20230041819032.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C16_G18_s20230041816176_e20230041818561_c20230041819025.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C04_G18_s20230041816176_e20230041818549_c20230041818580.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C12_G18_s20230041816176_e20230041818555_c20230041819009.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C15_G18_s20230041816176_e20230041818555_c20230041819030.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C02_G18_s20230041816176_e20230041818549_c20230041818582.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C07_G18_s20230041816176_e20230041818562_c20230041818592.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C14_G18_s20230041816176_e20230041818549_c20230041819017.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C10_G18_s20230041816176_e20230041818563_c20230041819021.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C13_G18_s20230041816176_e20230041818561_c20230041819034.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C01_G18_s20230041816176_e20230041818551_c20230041818587.nc', 'input/G18_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C08_G18_s20230041816176_e20230041818549_c20230041818599.nc']
scn = Scene(filenames = sat_files, reader='abi_l1b')

dataset_names = scn.all_dataset_names()

print(dataset_names)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[3], line 1
----> 1 scn = Scene(filenames = sat_files, reader='abi_l1b')
      3 dataset_names = scn.all_dataset_names()
      5 print(dataset_names)

File ~/micromamba/envs/geostationary-cookbook/lib/python3.14/site-packages/satpy/scene.py:153, in Scene.__init__(self, filenames, reader, filter_parameters, reader_kwargs)
    150     raise ValueError("'filenames' must be a list of files: Scene(filenames=[filename])")
    152 if filenames:
--> 153     filenames = convert_remote_files_to_fsspec(filenames, storage_options)
    155 self._readers = self._create_reader_instances(filenames=filenames,
    156                                               reader=reader,
    157                                               reader_kwargs=cleaned_reader_kwargs)
    158 self._datasets = DatasetDict()

File ~/micromamba/envs/geostationary-cookbook/lib/python3.14/site-packages/satpy/utils.py:790, in convert_remote_files_to_fsspec(filenames, storage_options)
    788 if isinstance(filenames, dict):
    789     return _check_file_protocols_for_dicts(filenames, storage_options)
--> 790 return _check_file_protocols(filenames, storage_options)

File ~/micromamba/envs/geostationary-cookbook/lib/python3.14/site-packages/satpy/utils.py:802, in _check_file_protocols(filenames, storage_options)
    801 def _check_file_protocols(filenames, storage_options):
--> 802     local_files, remote_files, fs_files = _sort_files_to_local_remote_and_fsfiles(filenames)
    804     if remote_files:
    805         return local_files + fs_files + _filenames_to_fsfile(remote_files, storage_options)

File ~/micromamba/envs/geostationary-cookbook/lib/python3.14/site-packages/satpy/utils.py:811, in _sort_files_to_local_remote_and_fsfiles(filenames)
    810 def _sort_files_to_local_remote_and_fsfiles(filenames):
--> 811     from satpy.readers.core.remote import FSFile
    813     local_files = []
    814     remote_files = []

File ~/micromamba/envs/geostationary-cookbook/lib/python3.14/site-packages/satpy/readers/core/remote.py:25
     22 from functools import total_ordering
     24 import fsspec
---> 25 from upath import UPath
     28 @total_ordering
     29 class FSFile(os.PathLike):
     30     """Implementation of a PathLike file object, that can be opened.
     31 
     32     Giving the filenames to :class:`Scene <satpy.scene.Scene>` with valid transfer protocols will automatically
   (...)     49 
     50     """

ModuleNotFoundError: No module named 'upath'
scn.load([f'C{x:02d}' for x in range(1, 17)])
print(scn.available_composite_names())
rgb_im = 'airmass'

scn.load([rgb_im])
### Uncomment to show it
#scn.show(rgb_im)
result = scn[rgb_im]

result
keys = scn.keys()

keys
area_info = scn["C13"].area

area_info
area_info = scn["C01"].area

area_info
area_info = scn["C02"].area

area_info
scn.load(["natural_color"])
rs = scn["C13"].area

lscn = scn.resample(rs)
lscn.load(["natural_color"])

### Uncomment to show it
#lscn.show("natural_color")
lscn.load(['true_color'])

### Uncomment to show it
#lscn.show('true_color')