6161def dict_to_dataset_drop_incompatible_coords (vars_dict , * args , dims , coords , ** kwargs ):
6262 safe_coords = coords
6363
64- if not RAISE_ON_INCOMPATIBLE_COORD_LENGTHS :
64+ if dims and not RAISE_ON_INCOMPATIBLE_COORD_LENGTHS :
6565 coords_lengths = {k : len (v ) for k , v in coords .items ()}
6666 for var_name , var in vars_dict .items ():
6767 # Iterate in reversed because of chain/draw batch dimensions
@@ -70,9 +70,8 @@ def dict_to_dataset_drop_incompatible_coords(vars_dict, *args, dims, coords, **k
7070 if (coord_length is not None ) and (coord_length != dim_length ):
7171 warnings .warn (
7272 f"Incompatible coordinate length of { coord_length } for dimension '{ dim } ' of variable '{ var_name } '.\n "
73- "This usually happens when a sliced or concatenated variable is wrapped as a `pymc.dims.Deterministic`."
74- "The originate coordinates for this dim will not be included in the returned dataset for any of the variables. "
75- "Instead they will default to `np.arange(var_length)` and the shorter variables will be right-padded with nan.\n "
73+ "The original coordinates for this dim will not be included in the returned dataset for any of the variables. "
74+ "Instead they will default to `np.arange`, possibly right-padded with nan.\n "
7675 "To make this warning into an error set `pymc.backends.arviz.RAISE_ON_INCOMPATIBLE_COORD_LENGTHS` to `True`" ,
7776 UserWarning ,
7877 )
@@ -303,14 +302,14 @@ def posterior_to_xarray(self):
303302 self .posterior_trace .get_values (var_name , combine = False , squeeze = False )
304303 )
305304 return (
306- dict_to_dataset (
305+ dict_to_dataset_drop_incompatible_coords (
307306 data ,
308307 library = pymc ,
309308 coords = self .coords ,
310309 dims = self .dims ,
311310 attrs = self .attrs ,
312311 ),
313- dict_to_dataset (
312+ dict_to_dataset_drop_incompatible_coords (
314313 data_warmup ,
315314 library = pymc ,
316315 coords = self .coords ,
@@ -345,14 +344,14 @@ def sample_stats_to_xarray(self):
345344 )
346345
347346 return (
348- dict_to_dataset (
347+ dict_to_dataset_drop_incompatible_coords (
349348 data ,
350349 library = pymc ,
351350 dims = None ,
352351 coords = self .coords ,
353352 attrs = self .attrs ,
354353 ),
355- dict_to_dataset (
354+ dict_to_dataset_drop_incompatible_coords (
356355 data_warmup ,
357356 library = pymc ,
358357 dims = None ,
@@ -366,7 +365,7 @@ def posterior_predictive_to_xarray(self):
366365 """Convert posterior_predictive samples to xarray."""
367366 data = self .posterior_predictive
368367 dims = {var_name : self .sample_dims + self .dims .get (var_name , []) for var_name in data }
369- return dict_to_dataset (
368+ return dict_to_dataset_drop_incompatible_coords (
370369 data , library = pymc , coords = self .coords , dims = dims , default_dims = self .sample_dims
371370 )
372371
@@ -375,7 +374,7 @@ def predictions_to_xarray(self):
375374 """Convert predictions (out of sample predictions) to xarray."""
376375 data = self .predictions
377376 dims = {var_name : self .sample_dims + self .dims .get (var_name , []) for var_name in data }
378- return dict_to_dataset (
377+ return dict_to_dataset_drop_incompatible_coords (
379378 data , library = pymc , coords = self .coords , dims = dims , default_dims = self .sample_dims
380379 )
381380
@@ -412,7 +411,7 @@ def observed_data_to_xarray(self):
412411 """Convert observed data to xarray."""
413412 if self .predictions :
414413 return None
415- return dict_to_dataset (
414+ return dict_to_dataset_drop_incompatible_coords (
416415 self .observations ,
417416 library = pymc ,
418417 coords = self .coords ,
@@ -427,7 +426,7 @@ def constant_data_to_xarray(self):
427426 if not constant_data :
428427 return None
429428
430- xarray_dataset = dict_to_dataset (
429+ xarray_dataset = dict_to_dataset_drop_incompatible_coords (
431430 constant_data ,
432431 library = pymc ,
433432 coords = self .coords ,
@@ -705,7 +704,7 @@ def apply_function_over_dataset(
705704 )
706705 )
707706
708- return dict_to_dataset (
707+ return dict_to_dataset_drop_incompatible_coords (
709708 out_trace ,
710709 library = pymc ,
711710 dims = dims ,
0 commit comments