gridmarthe.assign_coords
- gridmarthe.assign_coords(ds, add_lay=True, coords=['x', 'y', 'z'], keep_zone=False, zone_label='zone')[source]
Assign coordinates from variables to dimensions
This function transform a 1D or 2D (time, zone dimensions) array to 3D or 4D with time, x,y [,z] as dimensions.
Useful for plot functions/methods.
- Parameters:
ds (xr.Dataset) – dataset of Marthe variable(s)
add_lay (bool, optional) – Boolean to treat z (layer) as a dimension (True) or a variable (False)
coords (list, optional) – list of coordinates to add as dimensions. Default is [‘x’, ‘y’, ‘z’]
keep_zone (bool, optional) – keep zone as dimension (will make multiindex). Default is False.
zone_label (str, optional) – label of current index. Default is zone as read by
gridmarthe.load_marthe_grid()
- Returns:
xr.Dataset – Dataset with coordinates as dimension.