Congrats! You've made it to xarray's deep end :)
You have data variables in there that I would consider to be non-dimensional coordinates: [time, valid_time, latitude, longitude, lambert_azimuthal...]
. You can think of non-dimensional coordinates as additional labeling information about the coordinates in your arrays, but which you don't generally want to do math on. You can categorize these as coordinates rather than data_variables with ds.set_coords
, e.g.:
# skipping lambert ...
ds = ds.set_coords(['time', 'valid_time', 'latitude', 'longitude'])
You also have dimensions without coordinates. In your dataset, member
is a dimension of rdis
but does not appear in the coordinates list. See the docs on creating a DataArray for an example. You can select elements from member as if it's a RangeIndex (e.g. containing elements [0, 1, .., 24]
Finally, for the most difficult part - you have multi-dimensional coordinates latitude(y, x)
and longitude(y, x)
. These are a bit trickier to work with. Usually this occurs when your data is in a particular cartographic projection. The docs I linked to above have a helpful starting point.
As a quick example (paraphrased from the docs), you can plot your projected data on a map with cartopy:
plt.figure(figsize=(14, 6))
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_global()
ds.rdis.isel(step=0, member=0).plot.pcolormesh(
ax=ax, transform=ccrs.PlateCarree(), x="longitude", y="latitude"
)
ax.coastlines()
Also relevant to multidimensional coords: