CubedSphere Basic design: data structure and functionalities

#CubedSphere-Basic-design:-data-structure-and-functionalities

Data Structure

#Data-Structure

A "CubeSphere object" is simply an xarray DataSet with a specific format:

  • Data variables must contain dimensions (tile, y, x), to represent 6 tiles of the cubed-sphere. There's no restriction on additional dimensions.
  • Those coordinate variables are required for any visualizations:
    • lon (tile, y, x)
    • lat (tile, y, x)
    • lon_b (tile, y+1, x+1)
    • lat_b (tile, y+1, x+1)
  • The area information is not required but strongly recommended for taking conservative binning:
    • area (tile, y, x)

Below is an example from the GFDL-FV3 output.

Loading output library...

Direct visualization without regridding to lat-lon

#Direct-visualization-without-regridding-to-lat-lon

Basic cubed-sphere plot

#Basic-cubed-sphere-plot

With coordinate information available, we can plot the data with one function, without regridding to lat-lon.

plotCS_quick( ) simply calls plt.colormesh( ) 6 times. It only works with the PlateCarree projection and does not show the cells near map boundaries. But it is very fast and can be used for rough checking.

To-do list:

  • A better-looking (but possibly slower) method that correctly shows all cells and works with other projections.
  • A cleaner wrapper to avoid passing ds twice (need to solve https://github.com/pydata/xarray/issues/1475).
  • Hook the plotting method to DataArray or to Axis.
Loading output library...
Loading output library...

Note: For the rest of this notebook we use the wrapper function plotCS( ) for convenience. Will need to decide which method should be default based on both appearance and performance.

Tunning other details

#Tunning-other-details

All details including colormap, colorbar and gridline can be tuned as usual. There's nothing special with the cubesphere plot.

Loading output library...

Binning over physical dimensions

#Binning-over-physical-dimensions

xarray's multi-dimensional groupby allows us to take zonal/meridonal average without regridding to lat-lon. This is much faster and more accurate than first regridding to lat-lon and then taking average.

If the "area" coordinate variable is present, the binning will be weighted by area; otherwise uniform weights will be used.

Loading output library...

Cartopy subplots

#Cartopy-subplots

We can set up subplots as usual -- nothing special with cubed-sphere. However, as Cartopy documentation is not very comprehensive (especially about subplots), we make some examples here.

Loading output library...
Loading output library...

subplots with separated colorbars

#subplots-with-separated-colorbars
Loading output library...

Subplots with common colorbars

#Subplots-with-common-colorbars
Loading output library...