Skip to content

Commit

Permalink
revert simulation dim names
Browse files Browse the repository at this point in the history
  • Loading branch information
colonesej committed Mar 26, 2024
1 parent a8b28d8 commit 763ccb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hat/extract_simulation_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def extract_timeseries(
config = valid_custom_config(config)

# infer coordinates for all grids from first the grid
coords = latlon_coords(simulations_da, names=config.get("station_coordinates", []))
coords = latlon_coords(simulations_da)

# numpy array of station locations
station_mask = geopoints_to_array(stations, coords)
Expand Down
8 changes: 2 additions & 6 deletions hat/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,10 @@ def get_latlon_keys(ds):
return lat_key, lon_key


def latlon_coords(ds, names: list = []):
def latlon_coords(ds):
"""Latitude and longitude coordinates of an xarray"""

if not names:
lat_key, lon_key = get_latlon_keys(ds)
else:
assert len(names) == 2, "Must provide two names for lat and lon"
lat_key, lon_key = names
lat_key, lon_key = get_latlon_keys(ds)
lat_coords = ds.coords.get(lat_key).data
lon_coords = ds.coords.get(lon_key).data
coords = {"x": lon_coords, "y": lat_coords}
Expand Down

0 comments on commit 763ccb4

Please sign in to comment.