
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')
warnings.simplefilter('ignore', SyntaxWarning)
from satpy.scene import Scene
from satpy.utils import debug_on
from datetime import datetime
from glob import globStarting to create satpy scenes¶
sat_files = glob("input/G16_ABI-L1b-RadC/*")
sat_files['input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C12_G16_s20232561536173_e20232561538552_c20232561539031.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C09_G16_s20232561536173_e20232561538551_c20232561538580.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C04_G16_s20232561536173_e20232561538546_c20232561539001.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C03_G16_s20232561536173_e20232561538546_c20232561538589.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C15_G16_s20232561536173_e20232561538551_c20232561539007.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C13_G16_s20232561536173_e20232561538557_c20232561539004.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C14_G16_s20232561536173_e20232561538546_c20232561538592.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C02_G16_s20232561536173_e20232561538546_c20232561538578.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C16_G16_s20232561536173_e20232561538557_c20232561539036.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C01_G16_s20232561536173_e20232561538548_c20232561538585.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C10_G16_s20232561536173_e20232561538557_c20232561539020.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C05_G16_s20232561536173_e20232561538546_c20232561539016.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C07_G16_s20232561536173_e20232561538557_c20232561539026.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C11_G16_s20232561536173_e20232561538546_c20232561539034.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C08_G16_s20232561536173_e20232561538546_c20232561538598.nc',
'input/G16_ABI-L1b-RadC/OR_ABI-L1b-RadC-M6C06_G16_s20232561536173_e20232561538551_c20232561539011.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]
#resultkeys = scn.keys()
#keysarea_info = scn["C13"].area
#area_infoarea_info = scn["C01"].area
#area_infoarea_info = scn["C02"].area
#area_infoscn.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')