Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear error message on incorrect SoilPropertyPath #35

Open
BSchilperoort opened this issue Aug 19, 2022 · 0 comments
Open

Unclear error message on incorrect SoilPropertyPath #35

BSchilperoort opened this issue Aug 19, 2022 · 0 comments

Comments

@BSchilperoort
Copy link
Contributor

With an incorrect path to the soil property data, the following error will be raised. This is not very informative to the user.
Perhaps we should check for the validity of the provided paths? (e.g. if expected files exist).

Error message
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~/venv/ecoextreml/lib/python3.8/site-packages/xarray/core/dataset.py:1317, in Dataset._construct_dataarray(self, name)
   1316 try:
-> 1317     variable = self._variables[name]
   1318 except KeyError:

KeyError: 'depth'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
/home/bart/STEMMUS_SCOPE_Processing/notebooks/run_model_in_notebook_bart.ipynb Cell 10 in <cell line: 2>()
      [1](vscode-notebook-cell://wsl%2Bubuntu/home/bart/STEMMUS_SCOPE_Processing/notebooks/run_model_in_notebook_bart.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0) # setup the model
----> [2](vscode-notebook-cell://wsl%2Bubuntu/home/bart/STEMMUS_SCOPE_Processing/notebooks/run_model_in_notebook_bart.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1) config_path = model.setup(
      [3](vscode-notebook-cell://wsl%2Bubuntu/home/bart/STEMMUS_SCOPE_Processing/notebooks/run_model_in_notebook_bart.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2)     ForcingFileName="ZA-Kru_2000-2002_FLUXNET2015_Met.nc",
      [4](vscode-notebook-cell://wsl%2Bubuntu/home/bart/STEMMUS_SCOPE_Processing/notebooks/run_model_in_notebook_bart.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3)     NumberOfTimeSteps="10",
      [5](vscode-notebook-cell://wsl%2Bubuntu/home/bart/STEMMUS_SCOPE_Processing/notebooks/run_model_in_notebook_bart.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4) )
      [6](vscode-notebook-cell://wsl%2Bubuntu/home/bart/STEMMUS_SCOPE_Processing/notebooks/run_model_in_notebook_bart.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=5) print(config_path)

File ~/STEMMUS_SCOPE_Processing/PyStemmusScope/stemmus_scope.py:84, in StemmusScope.setup(self, WorkDir, ForcingFileName, NumberOfTimeSteps)
     81 forcing_io.prepare_forcing(self._configs)
     83 # prepare soil data
---> 84 soil_io.prepare_soil_data(self._configs)
     86 # set matlab log dir
...
--> 175     raise KeyError(key)
    177 ref_name, var_name = split_key
    178 ref_var = variables[ref_name]

KeyError: 'depth'
@BSchilperoort BSchilperoort changed the title Unclear error message on incorrect soil_path Unclear error message on incorrect SoilPropertyPath Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant