xarray.Dataset.traj.make_grid#

Dataset.traj.make_grid(dx, dy=None, z=None, lonmin=None, lonmax=None, latmin=None, latmax=None)#

Make a grid that covers all elements of dataset, with given spatial resolution.

Parameters:
  • dx (float) – Horizontal pixel/grid/cell size in meters, along direction of x or longitude

  • dy (float) – Horizontal pixel/grid/cell size in meters, along direction of y or latitude If not provided, dy will be equal to dx (square pixels)

  • z (array-like) – The bounds of the grid in the vertical. The outout grid will contain the centerpoints between each “layer”, i.e. one element less

  • lonmin, lonmax, latmin, latmax (float) – If not provided, these values will be taken from the min/max og lon/lat of the dataset

Returns:

Dataset

A new Xarray Dataset with the following coordinates:
  • time (only if input dataset has a time dimension)

  • lon, lat (center of the cells)

  • lon_edges, lat_edges (edges of the cells, i.e. one element more than lon, lat)

  • z (vertical center of each layer, only if z if provided as input)

  • z_edges (vertical edges of each layer, i.e. one element more than z, and only if z if provided as input)

The dataset contains the following variables on the above coordinates/grid:
  • layer_thickness: Thickness of layers in meters, i.e. the diff of input z

  • cell_area: Area [m2] of each grid cell

  • cell_volume: Volume [m3] of each grid cell, i.e. the above cell_area multiplied by layer_thickness