Skip to content

Commit

Permalink
Fix dataset-to-monet for da
Browse files Browse the repository at this point in the history
  • Loading branch information
zmoon committed Nov 18, 2024
1 parent 9404e3f commit 1dc5a8b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion monet/monet_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def _dataset_to_monet(

# Rename lat/lon coordinates to 'latitude'/'longitude'
dset = _rename_to_monet_latlon(dset) # common cases
if not {"latitude", "longitude"} <= set(dset.variables):
if (isinstance(dset, xr.Dataset) and not {"latitude", "longitude"} <= set(dset.variables)) or (
isinstance(dset, xr.DataArray) and not {"latitude", "longitude"} <= set(dset.coords)
):
dset = dset.rename({lat_name: "latitude", lon_name: "longitude"})

# Maybe wrap longitudes
Expand Down

0 comments on commit 1dc5a8b

Please sign in to comment.