Commit e067a6c 1 parent 27396e5 commit e067a6c Copy full SHA for e067a6c
File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -238,11 +238,24 @@ def _build_dataset(
238
238
output_coords : dict [str , xr .DataArray ] = {}
239
239
output_data_vars : dict [str , xr .DataArray ] = {}
240
240
241
- dims = list (input_data_var .dims )
241
+ for dim in input_data_var .dims :
242
+ dim = str (dim )
243
+
244
+ try :
245
+ axis_name = [x for x , y in ds .cf .axes .items () if dim in y ][0 ]
246
+ except Exception :
247
+ raise ValueError (
248
+ f"Could not determine axis name for dimension { dim } "
249
+ ) from None
250
+
251
+ if axis_name in ["X" , "Y" ]:
252
+ output_coords [dim ] = output_grid .cf [axis_name ]
253
+ else :
254
+ output_coords [dim ] = input_data_var .cf [axis_name ]
242
255
243
256
output_da = xr .DataArray (
244
257
output_data ,
245
- dims = dims ,
258
+ dims = input_data_var . dims ,
246
259
coords = output_coords ,
247
260
attrs = ds [data_var ].attrs .copy (),
248
261
name = data_var ,
You can’t perform that action at this time.
0 commit comments