oocgcm.core.grids.generic_2d_grid.__getitem__¶
- generic_2d_grid.__getitem__(item)¶
- The behavior of this function depends on the type of item.
- if item is a string, return the array self._arrays[item]
- if item is a slice, a grid object restricted to a subdomain.
Use slicing with caution, this functionnality depends on the order of the dimensions in the netcdf files.
Parameters: item : slice or str
item can be a string identifying a key in self._arrays item can be a slice for restricting the grid to a subdomain.
Returns: out : xarray.DataArray or generic_2d_grid
either a dataarray corresponding to self._arrays[item] or a new grid object corresponding to the restructed region.