Skip to content

Commit

Permalink
Add "lat" and "lon" vars for subsetting
Browse files Browse the repository at this point in the history
- lat and lon can be single point data vars instead of coords in a dataset (e.g., arm_diags)
  • Loading branch information
tomvothecoder committed Oct 21, 2024
1 parent 77a57c5 commit 80b62a0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion e3sm_diags/driver/utils/dataset_xr.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@

# Additional variables to keep when subsetting.
HYBRID_VAR_KEYS = set(list(sum(HYBRID_SIGMA_KEYS.values(), ())))
MISC_VARS = ["area", "areatotal2"]

# In some cases, lat and lon are stored as single point data variables rather
# than coordinates. These variables are kept when subsetting for downstream
# operations (e.g., arm_diags).
MISC_VARS = ["area", "areatotal2", "lat", "lon"]


def squeeze_time_dim(ds: xr.Dataset) -> xr.Dataset:
Expand Down Expand Up @@ -365,10 +369,12 @@ def get_climo_dataset(self, var: str, season: ClimoFreq) -> xr.Dataset:

if self.is_climo:
ds = self._get_climo_dataset(season)

return ds
elif self.is_time_series:
ds = self.get_time_series_dataset(var)
ds_climo = climo(ds, self.var, season).to_dataset()

return ds_climo
else:
raise RuntimeError(
Expand Down

0 comments on commit 80b62a0

Please sign in to comment.