Skip to content

Bug fixes#7

Open
hrajagers wants to merge 34 commits intomainfrom
qp/bugfix/UNST-9624_export_marker_field_to_shape_file
Open

Bug fixes#7
hrajagers wants to merge 34 commits intomainfrom
qp/bugfix/UNST-9624_export_marker_field_to_shape_file

Conversation

@hrajagers
Copy link
Member

@hrajagers hrajagers commented Feb 4, 2026

What was done

  • bug fix: marker field to Shape file (UNST-9624)
  • bug fix: error while creating contour plots (UNST-9634) ... detected by test case, but a runtime message doesn't fail the test case ... test bench checks only created files, but doesn't detect missing files (new issue: UNST-9635)
  • bug fix: QUICKPLOT doesn't start due to permission error while writing d3d_qp.version whereas the actually problem is that QUICKPLOT did not properly identify the folder in which QUICKPLOT executable is located (UNST-9678)
  • bug fix: "Extend Domain to Edge" does not work for D-Flow FM his-file (UNST-9654)
  • new feature: drag and drop support on Windows (UNST-7953)
  • new feature: export GIF and animated GIF (UNST-9589)

Evidence of the work done

  • Video/figures
    <add video/figures if applicable>
  • Clear from the issue description
  • Not applicable

Tests

  • Tests updated
    Pharos - box_classes: extended with Shape file export for 'markers' and 'values' (UNST-9624)
    Delft3D-FLOW - TRIM - s33: add animation test with png, jpg, tif, gif, animated gif output (UNST-9589)
    netCDF - D-Flow FM - his -3D: extend to edge test for history file (UNST-9654)
    various updates related to refactoring contours
  • Not applicable

Documentation

  • Documentation updated
    Mentions new features
  • Not applicable

Issue link

Closes UNST-7953
Closes UNST-9589
Closes UNST-9624
Closes UNST-9634
Closes UNST-9635
Closes UNST-9654
Closes UNST-9678

…e. Bug introduced in May 2020 when adding support for multi-domain export to Shape file.
@hrajagers hrajagers requested a review from a team February 4, 2026 16:09
…r ... not all may be errors, but let's first identify them.
* update tricontourf yet again ... comments in qp_scalarfield refer to previous tricontourf implementation ... not yet sure that the new implementation works well in all cases ...
… behaviour less consistent (see test case "Pharos - box_classes/boxclass.qplog" results). Therefore, reverted the latest change. Passing PlotClass flag to tricontourf from qp_scalarfield avoids fragile knowledge. Update the compthresholds logic to allow for "colourlimit" values set to +/- infinite. Make sure that the min/max data values are always computed in "qp_plot", and make sure that the clim range is always finite (otherwise qp_colorbar fails).
…ecified. The basic idea is to extend the range to -inf and +inf. Extending the data range to minmax_data has a similar effect with the added "benefit" that the min/max value is explicitly listed in the colour bar. Therefore, we choose to always extend ... to the min/max value if not within the existing threshold range such that the min/max value shows up in the colour bar ... to -inf/+inf otherwise (if that value is not already a threshold).
…D-Flow FM 3D history file

as well as some extra changes to the contour patches plotting (need to include pathes for classes without data ... they still influence the colour limits ... but exclude classes that shouldn't be plotted ... make sure to exclude those also when generating the class bar) ... for shipma, the -inf and +inf need to be included to avoid the lowest and highest data value being plotted

as well as minor improvement for the ref/work/diff table for images ... the file names could make the table too wide for the page.
…umber cannot be derived from the domain number of the neighbouring face since those don't exist ... such edges are assigned to the first domain containing them
Add option to record animation action when triggered from "plot manager".
Add options to write "gif files" and "animated gif file"
* include jpg in validation document, but gif/tif can't be visualized (yet)
…n window ... this will trigger file open (for all the selected files individually) ... dragging a folder open the file open dialog for that folder.
…qp.exe is not always located in the first folder on the PATH.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates MATLAB QuickPlot to address contour/threshold plotting issues and improve validation robustness, while also extending animation/output and UI capabilities.

Changes:

  • Fixes/adjustments in contour patch plotting, threshold computation, and color-limit handling across plotting pipeline.
  • Enhances qp_validate to detect changed runtime messages and missing expected outputs during validation runs.
  • Adds drag-and-drop file opening support on Windows and extends animation/output support (including animated GIF).

Reviewed changes

Copilot reviewed 35 out of 36 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/tools_lgpl/matlab/quickplot/progsrc/tricontourf.m Adjusts patch creation/CData handling for contour patch classes.
src/tools_lgpl/matlab/quickplot/progsrc/qp_validate.m Improves validation bookkeeping (reference files, message diffs, missing outputs, LaTeX diff figures).
src/tools_lgpl/matlab/quickplot/progsrc/qp_session.m Refines how saved sessions restore color-limit/clim clipping settings.
src/tools_lgpl/matlab/quickplot/progsrc/qck_anim.m Refactors animation entrypoint, adds reproducible command args, expands output options (incl. animated GIF).
src/tools_lgpl/matlab/quickplot/progsrc/private/shipmafil.m Updates thresholds/clim settings for contour patches in shipma plotting.
src/tools_lgpl/matlab/quickplot/progsrc/private/series_init.m Adds GIF support to image series type parsing.
src/tools_lgpl/matlab/quickplot/progsrc/private/series_frame.m Implements GIF frame writing (indexed image) for series export.
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_scalarfield.m Passes PlotClass into tricontourf directly (avoids post-hoc visibility loop).
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_plotmanager.m Enables/disables the Animate toolbar button based on figure availability.
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_plot_ugrid.m Fixes handle indexing when updating UGRID plot marker data.
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_plot.m Improves scalar checks, threshold/clim computation flow, and classbar labeling/ranges.
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_interface.m Initializes/activates drag-and-drop integration and adds Animate toolbar button.
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_export.m Fixes CV concatenation logic when exporting.
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_drag_and_drop.m New Windows-only wrapper enabling file drag-and-drop (via uiFileDnD).
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_colormap.m Switches colormap root lookup to executable-based install path.
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_cmdstr.m Handles fully-empty unquoted command arguments more safely.
src/tools_lgpl/matlab/quickplot/progsrc/private/qp_basedir.m Updates defaults/docs, improves Windows executable-path detection, and fixes PC check in mkdir helper.
src/tools_lgpl/matlab/quickplot/progsrc/private/process_polygons.m Refactors triangle-to-polygon conversion, adds empty-part handling.
src/tools_lgpl/matlab/quickplot/progsrc/private/netcdffil.m Tightens DataRead condition and improves D-Flow FM vertical coordinate handling; filters invalid faces.
src/tools_lgpl/matlab/quickplot/progsrc/private/nc_interpret.m Avoids errors for empty partition face lists; improves edge-domain assignment and drops 1D edges without faces.
src/tools_lgpl/matlab/quickplot/progsrc/private/md_print.m Suppresses additional MATLAB future deprecation warnings during print.
src/tools_lgpl/matlab/quickplot/progsrc/private/init_netcdf_settings.m Simplifies third-party netcdf setup using add_third_party.
src/tools_lgpl/matlab/quickplot/progsrc/private/contourfcorr.m Normalizes NaN coordinates to prevent contour correction failures.
src/tools_lgpl/matlab/quickplot/progsrc/private/compthresholds.m Reworks threshold derivation with better handling of colourlimits/symmetric limits and finite checks.
src/tools_lgpl/matlab/quickplot/progsrc/private/add_third_party.m New helper to locate/add bundled third-party folders and jars.
src/tools_lgpl/matlab/quickplot/progsrc/md_colormap.m Uses executable-based install path for saving/loading colormaps.
src/tools_lgpl/matlab/quickplot/progsrc/d3d_qp.m Bumps version, improves animation command logging, adds openfiles command, adds JavaFrame suppression tags.
src/tools_lgpl/matlab/quickplot/make_sim2ugrid.m Ensures uiFileDnD is on path in build script.
src/tools_lgpl/matlab/quickplot/make_quickplot.m Ensures uiFileDnD is on path in build script.
src/tools_lgpl/matlab/quickplot/make_ecoplot.m Ensures uiFileDnD is on path in build script.
src/tools_lgpl/matlab/quickplot/make_delwaq2raster.m Ensures uiFileDnD is on path in build script.
src/third_party_open/uiFileDnD/uiFileDnD.m New third-party drag-and-drop implementation (MIT).
src/third_party_open/uiFileDnD/java_dnd.m New third-party Java-based fallback for older MATLAB figure drag-and-drop.
src/third_party_open/uiFileDnD/README.md Third-party documentation for uiFileDnD.
src/third_party_open/uiFileDnD/MLDropTarget.class Third-party Java class used by drag-and-drop fallback.
src/third_party_open/uiFileDnD/LICENSE MIT license for uiFileDnD.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +650 to +654
cdata = [];
end
NewH = patch('Vertices',Coord(:,1:3), ...
'Faces',TRI, ...
'facevertexcdata',clevel*ones(size(TRI,1),1), ...
'facevertexcdata',cdata, ...
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When plotThisClass is false or clevel is non-finite, cdata is set to [] but still passed as FaceVertexCData to patch(). For non-empty TRI this can trigger a size/validation error in patch (FaceVertexCData must match number of faces/vertices), preventing creation of the placeholder handle. Consider always passing correctly-sized (e.g., NaN(size(TRI,1),1)) CData even when the patch is invisible, or skipping patch creation in that branch if a handle isn’t required.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[] works fine as long as the item is not visible, if visible the messageError in value of property [FaceVertexCData] Number of colors must equal number of vertices or faces. appears.
A scalar, finite clevel works fine, but influences the colour range.
A scalar NaN works fine as long as the item is not visible, if visible the message Error in state of SceneNode. Invalid mask size appears.
The NaN(size(TRI,1),1) solution proposed does indeed work fine ... although it adds some memory overhead for something that's not shown.
Not creating a patch handle for such levels isn't an option ... because of remote dependencies on the resulting vector length. We might get away with creating a dummy empty patch object (no vertices, no patches) but we'll leave that for the future.

Code adjusted.

Copy link
Member Author

@hrajagers hrajagers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +650 to +654
cdata = [];
end
NewH = patch('Vertices',Coord(:,1:3), ...
'Faces',TRI, ...
'facevertexcdata',clevel*ones(size(TRI,1),1), ...
'facevertexcdata',cdata, ...
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[] works fine as long as the item is not visible, if visible the messageError in value of property [FaceVertexCData] Number of colors must equal number of vertices or faces. appears.
A scalar, finite clevel works fine, but influences the colour range.
A scalar NaN works fine as long as the item is not visible, if visible the message Error in state of SceneNode. Invalid mask size appears.
The NaN(size(TRI,1),1) solution proposed does indeed work fine ... although it adds some memory overhead for something that's not shown.
Not creating a patch handle for such levels isn't an option ... because of remote dependencies on the resulting vector length. We might get away with creating a dummy empty patch object (no vertices, no patches) but we'll leave that for the future.

Code adjusted.

elseif edges(l2,2)==n2
n3 = edges(l2,1);
break
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If data is incorrect, you may finish this loop without n3 existing. Consider a smooth error in this case.

% continue the search from the latest node
n2 = n3;
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If data is incorrect, you may be in the while 1 for ever. Maybe good to add a check on the number of iterations.

if c(1:2) == 'PC'
s=dos(['mkdir "',thisdir,'"']);
if strcmp(c(1:2),'PC')
status = dos(['mkdir "',thisdir,'"']); %#ok<NASGU>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not inbuilt Matlab mkdir?

* sqm added as supported unit (m^2) as well as cumecs and cusecs
…ssages

* drag-and-drop causes "Conversion to matlab.ui.control.UIControl from javahandle_withcallbacks.MLDropTarget" error in "setdiff(UD.Options.Handles,gcbo)" ... check class to avoid conversion attempt
* stats renamed to stationNames for clarity.
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

Successfully merging this pull request may close these issues.

3 participants