Skip to content

Commit

Permalink
Check for xcoord in updated_ds not ds
Browse files Browse the repository at this point in the history
The result to be returned is updated_ds, checking ds meant always adding
a new xcoord to updated_ds, even if it was already added by
add_geometry_coords().
  • Loading branch information
johnomotani committed Jul 29, 2020
1 parent b642545 commit f313bc1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xbout/geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def apply_geometry(ds, geometry_name, *, coordinates=None, grid=None):
updated_ds = updated_ds.rename({'t_array': tcoord})
updated_ds = updated_ds.set_coords(tcoord)

if xcoord not in ds.coords:
if xcoord not in updated_ds.coords:
# Make index 'x' a coordinate, useful for handling global indexing
# Note we have to use the index value, not the value calculated from 'dx' because
# 'dx' may not be consistent between different regions (e.g. core and PFR).
Expand Down

0 comments on commit f313bc1

Please sign in to comment.