Skip to content

Commit 71a0e62

Browse files
Nwm client model configuration get fix (#301)
* Updated model configuration setting logic to handle missing attributes * Bumped the version number
1 parent 88812d4 commit 71a0e62

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

python/nwm_client/src/hydrotools/nwm_client/NWMFileClient.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def get_files(
144144
downloader.get(zip(urls,filenames))
145145

146146
# Return nested list of files
147-
files = sorted(list(subdirectory.glob("*.nc")))
148-
num_groups = len(files) // group_size + 1
147+
files: list[Path] = sorted(list(subdirectory.glob("*.nc")))
148+
num_groups: int = len(files) // group_size + 1
149149
file_groups = np.array_split(files, num_groups)
150150
return {f"group_{idx}": fg for idx, fg in enumerate(file_groups)}
151151

@@ -249,11 +249,13 @@ def get(
249249
# Add required columns
250250
df["measurement_unit"] = ds[var].attrs["units"]
251251
df["variable_name"] = var
252-
df["configuration"] = ds.attrs["model_configuration"]
253252

254-
# Address ambigious "No-DA" cycle names
255-
if cfg.endswith("no_da"):
256-
df["configuration"] = df["configuration"] + "_no_da"
253+
model_configuration: str = ds.attrs.get("model_configuration", cfg).lower()
254+
255+
if cfg.endswith("no_da") and not model_configuration.endswith("no_da"):
256+
model_configuration += "_no_da"
257+
258+
df["configuration"] = model_configuration
257259

258260
# Map crosswalk
259261
for col in self.crosswalk:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "9.2.0"
1+
__version__ = "9.2.1"

0 commit comments

Comments
 (0)