Quick Start#
This notebook demonstrates a basic workflow with the goes_ortho package, to download a short time series of GOES-R ABI imagery (the ABI-L1b-RadC product), and build a zarr file.
The notebook ends by creating a gif image (with the helpful geogif package) for us to get a quick preview of the imagery.
[ ]:
import goes_ortho as go
# we'll use geogif and xarray to look at the imagery
import geogif
import xarray as xr
First, specify the time range, location bounds, satellite, product (and if applicable, band and variable) that we’d like to access.
We will also need to provide an API key for OpenTopography.org which you can create with a free account. This allows goes_ortho to access digital elevation models to perform the orthorectification step.
The workflow below was developed to read a json file containing information about what we’d like to download. This was done to 1) allow these functions to run through github actions (still an experimental feature) and 2) keep a record of datasets we’ve downloaded. This is something that may change in the near future since it adds an unnecessary step for most use cases.
[ ]:
startDatetime = "2022-08-10T00:00:00Z"
endDatetime = "2022-08-10T00:59:00Z"
[min_lon, min_lat, max_lon, max_lat] = [-123, 46, -121, 48]
satellite = "goes18"
product = "ABI-L1b-RadC"
band = 2
variable = "Rad"
OPENTOPO_API_KEY = "YOUR_API_KEY_HERE"
Using the data above, we make the required json file.
[ ]:
# Make request file from user input
go.get_data.make_request_json(
f"{satellite}-build-zarr-b{band}",
startDatetime,
endDatetime,
[min_lon, min_lat, max_lon, max_lat],
satellite,
product,
band,
variable,
OPENTOPO_API_KEY,
)
Now we can provide the json file to the build_zarr function. This function downloads, clips, orthorectifies, and merges all imagery into a single zarr file.
[ ]:
# Download GOES imagery and build zarr file
go.get_data.build_zarr(f"{satellite}-build-zarr-b{band}.json")
To preview what our new zarr file looks like, we can open it with xarray, and use geogif to make a little gif animation.
[ ]:
# open the zarr file
ds = xr.open_zarr(f"{satellite}-build-zarr-b{band}.zarr")
# select our variable of interest
da = ds[variable]
# create the gif animation
gif_bytes = geogif.dgif(
da,
fps=5,
cmap="Greys_r",
date_format="%Y-%m-%d %H:%M:%S",
date_position="ul",
bytes=True,
).compute()
# write gif to file
with open(f"{satellite}-b{band}.gif", "wb") as f:
f.write(gif_bytes)
Take a look at the gif image we just made:

[ ]: