From 5e50d124373e8a9f9480182e0a4818690796108c Mon Sep 17 00:00:00 2001 From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu> Date: Mon, 25 Oct 2021 10:40:09 +0200 Subject: [PATCH] Improve state file naming convention. --- climax/core/dataset.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/climax/core/dataset.py b/climax/core/dataset.py index c18df02..fce18fe 100644 --- a/climax/core/dataset.py +++ b/climax/core/dataset.py @@ -122,8 +122,17 @@ class EoDataset(torch.utils.data.Dataset): Spredictors = ''.join([ERA5_S_VARIABLE_NAME[p] for p in predictors if p in ERA5_S_VARIABLE_NAME]) plevels = [str(p) for p in plevels] - state_file = '_'.join([model.__name__, str(predictand), Ppredictors, - *plevels, Spredictors]) + state_file = '_'.join([model.__name__, str(predictand)]) + + # check if predictors on pressure levels are used + state_file = ('_'.join([state_file, Ppredictors, *plevels]) if + any([p in ERA5_P_VARIABLE_NAME for p in predictors]) else + state_file) + + # check if predictors on surface are used + state_file = ('_'.join([state_file, Spredictors]) if + any([p in ERA5_S_VARIABLE_NAME for p in predictors]) else + state_file) # check whether digital elevation model, slope and aspect, and the day # of year were used -- GitLab