-
Notifications
You must be signed in to change notification settings - Fork 1
Description
ValueError Traceback (most recent call last)
Cell In[8], line 2
1 # Combine collar and survey into a BoreholeSet
----> 2 borehole_set = BoreholeSet(
3 collars=collars,
4 survey=survey,
5 # merge_option = MergeOptions.INTERSECT
6 merge_option = MergeOptions.INTERSECT
7 )
8 borehole_set
10 # Visualize boreholes with pyvista
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\subsurface\core\geological_formats\boreholes\boreholes.py:75, in BoreholeSet.init(self, collars, survey, merge_option, slice_)
71 combined_df_cells.append(df_cells_well) # Append the DataFrame to the combined_df_cells DataFrame
73 combined_df_cells = pd.concat(combined_df_cells, ignore_index=True)
---> 75 combined_trajectory_unstruct = UnstructuredData.from_array(
76 vertex=combined_df_vertex[['X_survey', 'Y_survey', 'Z_survey']].values,
77 cells=combined_df_cells[['cell1', 'cell2']].values,
78 vertex_attr=survey.survey_trajectory.data.points_attributes,
79 cells_attr=survey.survey_trajectory.data.cell_attributes
80 )
82 self.combined_trajectory = LineSet(data=combined_trajectory_unstruct, radius=500)
83 self.survey = survey
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\subsurface\core\structs\base_structures\unstructured_data.py:109, in UnstructuredData.from_array(cls, vertex, cells, cells_attr, vertex_attr, coords, xarray_attributes, default_cells_attr_name, default_points_attr_name, attributes)
95 cells_attributes_xarray_dict: dict[str, xr.DataArray] = raw_attributes_to_dict_data_arrays(
96 default_attributes_name=default_cells_attr_name,
97 n_items=n_cells,
98 dims=["cell", "cell_attr"],
99 raw_attributes=cells_attr
100 )
102 xarray_dict = {
103 "vertex": vertex_data_array,
104 "cells" : cells_data_array,
105 **cells_attributes_xarray_dict,
106 **points_attributes_xarray_dict
107 }
--> 109 return cls.from_data_arrays_dict(
110 xarray_dict=xarray_dict,
111 coords=coords,
112 xarray_attributes=xarray_attributes,
113 default_cells_attributes_name=default_cells_attr_name,
114 default_points_attributes_name=default_points_attr_name
115 )
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\subsurface\core\structs\base_structures\unstructured_data.py:127, in UnstructuredData.from_data_arrays_dict(cls, xarray_dict, coords, xarray_attributes, default_cells_attributes_name, default_points_attributes_name)
117 @classmethod
118 def from_data_arrays_dict(
119 cls,
(...)
125 ):
126 # TODO: xr.Dataset seems to have been changed with 2022.06. needs to be adapted for indexing
--> 127 ds = xr.Dataset(xarray_dict, coords=coords, attrs=xarray_attributes)
129 # Try to unstack pandas dataframe if exist
130 # TODO: This is an issue in wells. If it is only there maybe we should move it there
131 try:
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\xarray\core\dataset.py:713, in Dataset.init(self, data_vars, coords, attrs)
710 if isinstance(coords, Dataset):
711 coords = coords._variables
--> 713 variables, coord_names, dims, indexes, _ = merge_data_and_coords(
714 data_vars, coords
715 )
717 self._attrs = dict(attrs) if attrs else None
718 self._close = None
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\xarray\core\dataset.py:427, in merge_data_and_coords(data_vars, coords)
423 coords = create_coords_with_default_indexes(coords, data_vars)
425 # exclude coords from alignment (all variables in a Coordinates object should
426 # already be aligned together) and use coordinates' indexes to align data_vars
--> 427 return merge_core(
428 [data_vars, coords],
429 compat="broadcast_equals",
430 join="outer",
431 explicit_coords=tuple(coords),
432 indexes=coords.xindexes,
433 priority_arg=1,
434 skip_align_args=[1],
435 )
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\xarray\core\merge.py:692, in merge_core(objects, compat, join, combine_attrs, priority_arg, explicit_coords, indexes, fill_value, skip_align_args)
689 skip_align_objs = [(pos, objects.pop(pos)) for pos in skip_align_args]
691 coerced = coerce_pandas_values(objects)
--> 692 aligned = deep_align(
693 coerced, join=join, copy=False, indexes=indexes, fill_value=fill_value
694 )
696 for pos, obj in skip_align_objs:
697 aligned.insert(pos, obj)
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\xarray\core\alignment.py:946, in deep_align(objects, join, copy, indexes, exclude, raise_on_invalid, fill_value)
943 else:
944 out.append(variables)
--> 946 aligned = align(
947 *targets,
948 join=join,
949 copy=copy,
950 indexes=indexes,
951 exclude=exclude,
952 fill_value=fill_value,
953 )
955 for position, key, aligned_obj in zip(positions, keys, aligned):
956 if key is no_key:
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\xarray\core\alignment.py:882, in align(join, copy, indexes, exclude, fill_value, *objects)
686 """
687 Given any number of Dataset and/or DataArray objects, returns new
688 objects with aligned indexes and dimension sizes.
(...)
872
873 """
874 aligner = Aligner(
875 objects,
876 join=join,
(...)
880 fill_value=fill_value,
881 )
--> 882 aligner.align()
883 return aligner.results
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\xarray\core\alignment.py:575, in Aligner.align(self)
573 self.assert_no_index_conflict()
574 self.align_indexes()
--> 575 self.assert_unindexed_dim_sizes_equal()
577 if self.join == "override":
578 self.override_indexes()
File D:\software\anaconda\envs\3DGeoModeling\Lib\site-packages\xarray\core\alignment.py:476, in Aligner.assert_unindexed_dim_sizes_equal(self)
474 add_err_msg = ""
475 if len(sizes) > 1:
--> 476 raise ValueError(
477 f"cannot reindex or align along dimension {dim!r} "
478 f"because of conflicting dimension sizes: {sizes!r}" + add_err_msg
479 )
ValueError: cannot reindex or align along dimension 'points' because of conflicting dimension sizes: {21123, 767} (note: an index is found along that dimension with size=767)