File tree Expand file tree Collapse file tree 5 files changed +18
-3
lines changed Expand file tree Collapse file tree 5 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
26
- Bug when generating a grid with snapping points near the simulation boundaries.
27
27
- Fixed field colocation in ` EMEModeSolverMonitor ` .
28
28
- Solver error for EME simulations with bends, introduced when support for 2D EME simulations was added.
29
+ - Internal interpolation errors with some versions of ` xarray ` and ` numpy ` .
29
30
30
31
### Changed
31
32
- Relaxed bounds checking of path integrals during ` WavePort ` validation.
Original file line number Diff line number Diff line change @@ -1146,6 +1146,13 @@ def to_zbf(
1146
1146
"'freq' was not specified for 'FieldData.to_zbf()'. Defaulting to the mean frequency of the dataset."
1147
1147
)
1148
1148
freq = np .mean (e_x .coords ["f" ].values )
1149
+ else :
1150
+ freq = np .array (freq )
1151
+
1152
+ if freq .size > 1 :
1153
+ raise ValueError ("'freq' must be a single value, not an array." )
1154
+ else :
1155
+ freq = freq .item ()
1149
1156
1150
1157
mode_area = mode_area .interp (f = freq )
1151
1158
e_x = e_x .interp (f = freq )
Original file line number Diff line number Diff line change @@ -583,17 +583,20 @@ def plot_field_monitor_data(
583
583
584
584
# select the extra coordinates out of the data from user-specified kwargs
585
585
for coord_name , coord_val in sel_kwargs .items ():
586
+ interp_val = np .array (coord_val )
587
+ if interp_val .size == 1 :
588
+ interp_val = interp_val .item ()
586
589
if (
587
590
field_data .coords [coord_name ].size <= 1
588
591
or coord_name == "eme_port_index"
589
592
or coord_name == "eme_cell_index"
590
593
or coord_name == "sweep_index"
591
594
or coord_name == "mode_index"
592
595
):
593
- field_data = field_data .sel (** {coord_name : coord_val }, method = None )
596
+ field_data = field_data .sel (** {coord_name : interp_val }, method = None )
594
597
else :
595
598
field_data = field_data .interp (
596
- ** {coord_name : coord_val }, kwargs = {"bounds_error" : True }
599
+ ** {coord_name : interp_val }, kwargs = {"bounds_error" : True }
597
600
)
598
601
599
602
# before dropping coordinates, check if a frequency can be derived from the data that can
Original file line number Diff line number Diff line change @@ -1699,7 +1699,7 @@ def _grid_correction(
1699
1699
Copy of the data with renormalized fields.
1700
1700
"""
1701
1701
normal_axis = plane .size .index (0.0 )
1702
- normal_pos = plane .center [normal_axis ]
1702
+ normal_pos = float ( plane .center [normal_axis ])
1703
1703
normal_dim = "xyz" [normal_axis ]
1704
1704
1705
1705
# Primal and dual grid along the normal direction,
Original file line number Diff line number Diff line change @@ -942,6 +942,10 @@ def sample(
942
942
if isinstance (h_vals , UnstructuredGridDataset ):
943
943
h_vals = h_vals .values
944
944
945
+ # Needed to avoid error in some xarray / numpy versions
946
+ e_vals = e_vals .item () if e_vals .size == 1 else e_vals
947
+ h_vals = h_vals .item () if h_vals .size == 1 else h_vals
948
+
945
949
# note that the dimensionality of this operation differs depending on whether xarrays
946
950
# or simple unlabeled arrays are provided:
947
951
# - for unlabeled arrays, values are broadcasted
You can’t perform that action at this time.
0 commit comments