File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -273,6 +273,16 @@ def as_dataarray(
273273 -------
274274 DataArray:
275275 The converted DataArray.
276+
277+ Raises
278+ ------
279+ ValueError
280+ If arr is a DataArray and coords is provided: raised when
281+ coordinates for shared dimensions do not match, or when the
282+ DataArray has dimensions not covered by coords (unless
283+ allow_extra_dims is True). The DataArray's dimensions may be
284+ a subset of coords — missing dimensions are added via
285+ expand_dims.
276286 """
277287 if isinstance (arr , pd .Series | pd .DataFrame ):
278288 arr = pandas_to_dataarray (arr , coords = coords , dims = dims , ** kwargs )
Original file line number Diff line number Diff line change @@ -449,10 +449,12 @@ def add_variables(
449449 Upper bound of the variable(s). Ignored if `binary` is True.
450450 The default is inf.
451451 coords : list/xarray.Coordinates, optional
452- The coords of the variable array.
453- These are directly passed to the DataArray creation of
454- `lower` and `upper`. For every single combination of
455- coordinates a optimization variable is added to the model.
452+ The coords of the variable array. For every single
453+ combination of coordinates an optimization variable is
454+ added to the model. Data for `lower`, `upper` and `mask`
455+ is fitted to these coords: shared dimensions must have
456+ matching coordinates, and missing dimensions are broadcast.
457+ A ValueError is raised if the data is not compatible.
456458 The default is None.
457459 name : str, optional
458460 Reference name of the added variables. The default None results in
@@ -474,7 +476,9 @@ def add_variables(
474476 ------
475477 ValueError
476478 If neither lower bound and upper bound have coordinates, nor
477- `coords` are directly given.
479+ `coords` are directly given. Also raised if `lower` or
480+ `upper` are DataArrays whose coordinates do not match the
481+ provided `coords`.
478482
479483 Returns
480484 -------
You can’t perform that action at this time.
0 commit comments