Skip to content

Add grid.copy

Sebastian Müller requested to merge add_grid_copy into main

Since the data location is tied to the grid and not the data (as done for example in esmf), we need a mechanism to use the same grid for data on points and cells.

A simple approach is to copy the grid and set another data location.

This MR enables exactly this:

  • added copy method to grids with optional argument deep (False by default) to create a copy of a grid
  • added setter for data_location in order to set a new data location (e.g. after copying a grid)
  • added class attribute valid_locations in order to check the set data location (esri-grid only supports cells, unstructured-points only support points)
  • added missing casting methods to convert esri to uniform and uniform to rectilinear (when you want to use point data on an esri-grid, you can cast it to uniform first)
  • added axes_attributes also to unstructured grids
Edited by Sebastian Müller

Merge request reports