How can I zoom in on the Full Disk Images #10
Unanswered
blaylockbk
asked this question in
Q&A
Replies: 2 comments
|
Plotting the GOES data with Cartopy involves several steps. You will need MetPy installed to get the projection information. The easyier wayfrom goes2go.data import goes_nearesttime
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import metpy
# Download some data for the full disk
ds = goes_nearesttime(
'2021-10-18 18:00',
satellite='goes16',
domain='F',
)
# Parse out the cartopy coordinate reference system information with MetPy
ds = ds.metpy.parse_cf()
crs = ds.metpy_crs.item().to_cartopy()
# Make a figure. Use `set_extent` to zoom on an area
# Plot the data for ABI channel 1 in projection coordinates
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=crs)
ax.pcolormesh(ds.x, ds.y, ds.CMI_C01)
# Add coastline and country boarders
ax.coastlines(color='dodgerblue')
ax.add_feature(cfeature.BORDERS, color='dodgerblue')
# Zoom (a bit tricky to fine tune because of different projections.)
ax.set_extent([-80, -30, -60, -22], ccrs.PlateCarree())
Setting the extent with lat/lon coordinates might not be what you want because the coordinate reference system is not in lat/lon coordinates. Instead, you can fine tune the zoom area better if you use the GOES coordinate reference system # Plot the data in projection coordinates
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=crs)
ax.coastlines(color='dodgerblue')
ax.add_feature(cfeature.BORDERS, color='dodgerblue')
# Zoom (a bit better to tune in the GOES coordinate reference system)
# [left_limit, right_limit, bottom_limit, top_limit]
ax.set_extent([0, 2_300_000, -5_400_000, -2_000_000], crs)You can do use the ax = plt.subplot(projection=crs)
ax.imshow(ds.rgb.TrueColor(), **ds.rgb.imshow_kwargs)
ax.set_extent([0, 2_300_000, -5_400_000, -2_000_000], crs)(Hmmm, I don't know why this takes >15 mins to plot) The more-involved way
from goes2go.data import goes_nearesttime
import matplotlib.pyplot as plt
ds = goes_nearesttime('2021-10-18 18:00',
satellite='goes16',
domain='F',
save_dir='$TMPDIR')
ds = ds.metpy.parse_cf()
ds = ds.metpy.assign_y_x()
extent = [-80, -40, -60, -20]
center_lon = ds.goes_imager_projection.longitude_of_projection_origin
min_lon, _ = goes_crs.transform_point(extent[0], 0, ccrs.PlateCarree())
max_lon, _ = goes_crs.transform_point(extent[1], 0, ccrs.PlateCarree())
_, min_lat = goes_crs.transform_point(center_lon, extent[2], ccrs.PlateCarree())
_, max_lat = goes_crs.transform_point(center_lon, extent[3], ccrs.PlateCarree())
from toolbox.cartopy_tools import common_features, pc, ccrs
ax = common_features(crs=ds.metpy_crs.item().to_cartopy()).BORDERS().ax
ax.pcolormesh(zoom_ds.x, zoom_ds.y, zoom_ds.CMI_C01)
ax.set_extent(extent, pc) |
0 replies
Zoom on a CONUS image to show west coastAn example for zooming on CONUS images. Again, use the from goes2go.data import goes_nearesttime
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
G1 = goes_nearesttime('2021-11-03', satellite='G17', product="ABI")Plot full figurefig = plt.figure(figsize=[10,10])
ax = fig.add_subplot(1,1,1, projection=G1.rgb.crs)
ax.coastlines(color='y')
ax.imshow(G1.rgb.NaturalColor(), **G1.rgb.imshow_kwargs)Plot zoomed figurefig = plt.figure(figsize=[10,10])
ax = fig.add_subplot(1,1,1, projection=G1.rgb.crs)
ax.coastlines(color='y')
ax.imshow(G1.rgb.NaturalColor(), **G1.rgb.imshow_kwargs)
ax.set_extent([-130, -115, 30, 50], crs=ccrs.PlateCarree()) #<--- This is the important lineSetting the extent with lat/lon coordinates (and specifying the crs) bounds the domain by the upper-left and bottom-right corners. fig = plt.figure(figsize=[10,10])
ax = fig.add_subplot(1,1,1, projection=G1.rgb.crs)
ax.coastlines(color='y')
ax.imshow(G1.rgb.NaturalColor(), **G1.rgb.imshow_kwargs)
ax.set_extent([-130, -115, 30, 50], crs=ccrs.PlateCarree())
ax.gridlines(draw_labels=True, xlocs=range(-140, 0, 2), ylocs=range(30,56,2))
ax.scatter(-130, 50, transform=ccrs.PlateCarree(), s=300)
ax.scatter(-115, 30, transform=ccrs.PlateCarree(), s=300) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment






Uh oh!
There was an error while loading. Please reload this page.
This was a question asked in an email
All reactions