Skip to content

Commit

Permalink
switched to swap_dims and skipped dataset conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
freemansw1 committed Dec 5, 2023
1 parent 752d285 commit d66c27b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tobac/utils/internal/xarray_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,8 @@ def add_coordinates_to_features(

# you can only rename dims alone when operating on datasets, so add our dataarray to a
# dataset
renamed_dim_ds = xr.Dataset({"var": variable_da}).rename_dims(dim_new_names)

interpolated_df = renamed_dim_ds["var"].interp(coords=dim_interp_coords)
renamed_dim_da = variable_da.swap_dims(dim_new_names)
interpolated_df = renamed_dim_da.interp(coords=dim_interp_coords)
interpolated_df = interpolated_df.drop([hdim1_name_new, hdim2_name_new])
if is_3d:
interpolated_df = interpolated_df.drop([vdim_name_new])
Expand Down

0 comments on commit d66c27b

Please sign in to comment.