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

Improve error message if as_line not checked and no "top" and "bottom" present in dataset. #65

Open
JoerivanEngelen opened this issue Jan 15, 2024 · 5 comments

Comments

@JoerivanEngelen
Copy link
Contributor

QGIS-Tim outputs datasets without a top and bottom variable. For analytic element models, it is easier to output this data as lines, for which the "as line" checkbox has to be checked. QGIS-Tim users are usually unaware of all the specifics required to plot PColorMeshItem, and forgetting to check the "as line" box causes this message:

ValueError: Missing "top" and "bottom" variables in dataset

iMOD Python's users have got more info about the plugin's requirements for CrossSectionData through iMOD Python's API docstrings.

To help QGIS-Tim users we could either do:

  • Check "as line" by default
  • Improve error message with some guidance to the existence of the checkbox.
@rubencalje
Copy link
Contributor

Hi @JoerivanEngelen,

The imod plugin performs really well, especially the Time Series and Cross Section widgets, and integrates well in QGIS. I have managed to get my data into the plugin, below is a screenshot of my project. I do have variables named 'top_layer_{x}" and "bottom_layer_{x}" for x from 1 to 28, and all layered variables are shown by a single checkbox in the variable selection list. However, I cannot uncheck the "As line(s)" checkbox, as it is disabled. Does this have anything to do with this issue?

Another minor issue I have: the documentation states

For time dependent data, when the Temporal Controller Panel is turned on, the cross-section plot is automatically updated when a different moment in time is selected.

This is not my experience. The cross-section plot only updates to a new selected time when I draw another cross-section line using the "Select location"-button. The main map does update when I select a different moment in time. Is this a known issue, or am I doing something wrong?

image

@rubencalje
Copy link
Contributor

rubencalje commented Mar 11, 2024

I think the plugin checks if the first variable in the variable-list has a layer dimension. If there is no layer dimension, it disables the "As line(s)" button, and it is never enabled again.

If I remove the first variables without a layer dimension from the netcdf-file, I can deselect the "As line(s)" button, until I select a variable without a layer dimension, and the "As line(s)" button is selected and disabled again. I can then enable the "As line(s)" button again by selecting the netcdf-file again (the most left selection button).

@rubencalje
Copy link
Contributor

Sorry for all the messages (this will be my last). I think my (first) issue is relatively easy to solve, by changing the following lines in the method set_variable_layernumbers in cross_section_widget.py:

        if layers == NO_LAYERS:
            self.as_line_checkbox.setChecked(True)
            self.as_line_checkbox.setEnabled(False)

to

        if layers == NO_LAYERS:
            self.as_line_checkbox.setChecked(True)
            self.as_line_checkbox.setEnabled(False)
        else:
            self.as_line_checkbox.setChecked(False)
            self.as_line_checkbox.setEnabled(True)

If you want, I can make a pull request. If so, please let me know to which branch do I need to create this request.

@JoerivanEngelen
Copy link
Contributor Author

JoerivanEngelen commented Mar 12, 2024

Hi @rubencalje, thanks for reporting the issue you found and coming up with a fix!

I think your first issue you run into is different than this issue (#65): It's a bug in the behavior of the "as line" checkbox, whereas issue #65 is to change default behavior of the check box.

The bug you describe seems very annoying, so good if we can get this fixed soon, so I'm glad if you can make a PR. I'll open up a new issue for the bug you run into, and I'll write instructions on the branch name to push to there.

@JoerivanEngelen
Copy link
Contributor Author

Regarding your second issue: that's not the intended behavior, so I expect this to be a bug and not faulty use on your end. I'll create a separate issue for it.

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

2 participants