Reputation: 517
I'm following along the Pyresample example for plotting a Sentinel-3 Scene along with coastline. However, it seems as if pyresample.kd_tree.resample_nearest
and pyresample.save_quicklook
expect a 2D array as data, rather than the 3D (3-band) Sentinel scene I'm trying to plot:
<xarray.DataArray 'reshape-fb54fb4cbc6c65d43122d7b5e1078a83' (bands: 3, y: 352, x: 507)>
dask.array<reshape, shape=(3, 352, 507), dtype=float64, chunksize=(3, 352, 507), chunktype=numpy.ndarray>
Coordinates:
* x (x) float64 -7.601e+04 -7.571e+04 ... 7.571e+04 7.601e+04
* y (y) float64 5.227e+04 5.197e+04 5.167e+04 ... -5.279e+04 -5.309e+04
* bands (bands) <U1 'R' 'G' 'B'
crs object PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["World Geod...
Attributes: (12/15)
resolution: 300
ancillary_variables: []
start_time: 2020-04-22 13:51:38
area: Area ID: area_id\nDescription: An Area of Interest\n...
end_time: 2020-04-22 13:54:38
sensor: olci
... ...
name: ocean_color
_satpy_id: DataID(name='ocean_color', resolution=300)
standard_name: ocean_color
prerequisites: [DataQuery(name='Oa08', modifiers=('effective_so...
optional_prerequisites: []
mode: RGB
The pseudo-code and error are:
lons, lats = scn_aoi[composite].area.get_lonlats()
composite_data = scn_aoi[composite].data.compute()
swath_def = pyresample.SwathDefinition(lons, lats)
roi = resolution - (resolution * 0.35)
# Below gives ValueError -> 'Mismatch between geometry and dataset'
composite_swath = (pyresample.kd_tree
.resample_nearest(swath_def, composite_data, aoi_def,
radius_of_influence=roi,
fill_value=None))
How can these data be plotted?
Upvotes: 1
Views: 277