Use cf-xarray to identify lon,lat

  • hvplot.xarray makes it easier to use holoviz with xarray objects
  • cf-xarray allows standardized code with cf-convention xarray objects

I’m pretty used to to specifying the x, y coordinates to hvplot, but it would be nice to use cf-xarray to see if the data is CF compliant and do the the right thing automatically.

Specifically, I’m thinking that for plotting this variable ds['temp']:

Instead of doing this to plot:

ds['temp'].cf.isel(time=0).hvplot.quadmesh(x=ds.temp.cf['longitude'].name, 
                                        y=ds.temp.cf['latitude'].name, 
                                        geo=True,
                                        rasterize=True)

we could let the user do:

ds['temp'].cf.isel(time=0).hvplot.quadmesh(
                                        geo=True,
                                        rasterize=True)

and hvplot could figure out the lon and lat variables using cf-xarray.

Or instead of being part of hvplot, would this be an enhancement to cf-xarray, like what they’ve done here for matplotlib?

2 Likes