Skip to content

Grid specifications

Sebastian Müller requested to merge grid_spec into main

Implement grid specifications for structured and unstructured grids.

Abstract classes and their attributes:

  • Grid: general grid class
    • dim: int: Dimension of the grid
    • crs: The coordinate reference system
    • point_count: Number of grid points
    • cell_count: Number of grid cells
    • points: Grid points
    • cells: Cell nodes in ESMF/VTK order
    • cell_types: int encoding cell types defined in CellType(Enum)
    • cell_centers: Grid cell centers
    • cell_node_counts: node count for each cell
    • mesh_dim: maximal cell dimension
    • data_location: Location of the associated data (either Location.CELLS or Location.POINTS)
    • data_points: Points of the associated data (either cell_centers or points)
    • data_shape: Shape of the associated data
  • StructuredGrid(Grid): subclass of Grid for structured data
    • dims: Axes lengths (xyz order) (PyVista naming scheme)
    • axes: list of np.ndarray: Axes of the structured grid in standard xyz order
    • axes_reversed: bool: Indicate reversed axes order for the associated data (zyx order)
      • esri grids and most netcdf files are given in inverse axes order (lat, lon)
    • axes_increase: list of bool: False to indicate a bottom up axis (xyz order)
      • esri grids and some netcdf are given bottom up (northing/lat inverted)
    • axes_attributes: list of dict: Axes attributes following the CF convention (xyz order)
      • should be used for xarray later on
    • axes_names: list of str: Axes names (xyz order)
      • should be used for xarray later on
    • order: str: Point, cell and data order (C- ("C") or Fortran-like ("F"))
      • vtk files use Fortran-like data ordering for structured grids
    • cell_axes: list of np.ndarray: Axes of the cell centers (xyz order)
    • data_axes: list of np.ndarray: Axes as used for the data

Implemented grids so far:

  • NoGrid: Indicator for data with no spatial grid
  • EsriGrid: representing grids from ascii files
  • UniformGrid: representing uniform grids following VTK standard
  • RectilinearGrid: representing rectilinear grids following VTK standard
  • UnstructuredGrid: representing unstructured grids following VTK standard
  • UnstructuredPoints: representing unstructured points without cells
Edited by Sebastian Müller

Merge request reports