Skip to content

Commit 80b62a0

Browse files
committed
Add "lat" and "lon" vars for subsetting
- lat and lon can be single point data vars instead of coords in a dataset (e.g., arm_diags)
1 parent 77a57c5 commit 80b62a0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

e3sm_diags/driver/utils/dataset_xr.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@
4646

4747
# Additional variables to keep when subsetting.
4848
HYBRID_VAR_KEYS = set(list(sum(HYBRID_SIGMA_KEYS.values(), ())))
49-
MISC_VARS = ["area", "areatotal2"]
49+
50+
# In some cases, lat and lon are stored as single point data variables rather
51+
# than coordinates. These variables are kept when subsetting for downstream
52+
# operations (e.g., arm_diags).
53+
MISC_VARS = ["area", "areatotal2", "lat", "lon"]
5054

5155

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

366370
if self.is_climo:
367371
ds = self._get_climo_dataset(season)
372+
368373
return ds
369374
elif self.is_time_series:
370375
ds = self.get_time_series_dataset(var)
371376
ds_climo = climo(ds, self.var, season).to_dataset()
377+
372378
return ds_climo
373379
else:
374380
raise RuntimeError(

0 commit comments

Comments
 (0)