Closed edwardmak closed 1 week ago
Hello,
I haven't had the chance to test QGIS version 3.38 yet. The developments are currently being done on the LTR version 3.34, you should test with this version. Regarding the display issue, did restarting QGIS change anything? Perhaps you could check if the geometries have been correctly stored in the "geom" field of the "branchs" table. Have you also tried modifying the layer style to see if that allows them to be displayed?
I will check if I encounter the same errors with version 3.38.
Best regards,
Hello,
I did try changing the branch style and they still were not shown. Could you please precise how can I check the "geom" field? Because I didn't see a column called this in the "branchs" table.
I also found that if I use the default coordinates system (4326), the extremity or branch cannot be seen. If I use a Cartesian system (such as 32651), the extremity can be displayed, and the branch can be seen under edition mode, but still invisible after exiting edition mode and being saved.
Plus, I used QGIS 3.34 on Windows with plugin of version 5.0.8, these elements did be correctly shown. (However, I still encountered problem when interpolating profile between amont and aval profiles, with error message reads TypeError: 'MultiLineString' object is not iterable...)
Best regards,
Hello,
You should to consult the PostgreSQL database, where you’ll find a schema of the model, as well as the branches table. To access the database, you can use the pgAdmin tool, which comes with the database installation.
It’s important to note that you should use a metric (or Cartesian) projection for the model, as some features may not function correctly otherwise. Here are the recommended steps:
Regarding interpolation, I’m not sure I fully understand. Are you using interpolation between two profiles via the "Cross Section" menu, or are you using "Extract MNT for Profile"?
In the first case, there shouldn’t be any impact related to the line type. As for the second case, I don’t recall encountering a similar issue before. It’s possible that this problem is related to the projection being used.
If the projection isn't the issue, I'd be happy to review a specific example or test case to help resolve the bug.
Best regards,
Hello,
Thanks for the explanation! Now I can see the geom in the PostgreSQL database. Indeed, in a metric projection some features like abscissa of profile can be extracted correctly.
For the interpolation, what I was trying to do is:
I tried as the following figure:
Sometimes QGIS just freezes and stops, and sometimes I got error message like:
TypeError: 'MultiLineString' object is not iterable Traceback (most recent call last): File "/home/ed/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mascaret/Graphic/ClassProfInterpDialog.py", line 122, in accept_page cl_interp() File "/home/ed/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mascaret/Graphic/ClassProfInterp.py", line 513, in call self.calc_profil(pr_am_tmp, pr_av_tmp, id) File "/home/ed/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mascaret/Graphic/ClassProfInterp.py", line 133, in calc_profil prof_min, limx = self.interpol_fct_lg(pr_am_tmp, pr_av_tmp) File "/home/ed/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mascaret/Graphic/ClassProfInterp.py", line 228, in interpol_fct_lg am_g = self.discret_pr_lg(pr_am, File "/home/ed/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mascaret/Graphic/ClassProfInterp.py", line 385, in discret_pr_lg for j, ll in enumerate(geom): TypeError: 'MultiLineString' object is not iterable
Python version: 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0] QGIS version: 3.34.10-Prizren Prizren, 113de9e1134
Best regards,
Hello,
Alright, I understand better now.
I noticed that this issue has been fixed in the experimental version.
The corrections will be integrated into the next release.
In the meantime, you can manually modify the Python code to make it work.
According to your message, the Python file is located at :
/home/ed/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mascaret/Graphic/ClassProfInterp.py.
You need to modify the following: Line 385:
for j, ll in enumerate(geom):
should be changed to
for j, ll in enumerate(geom.geoms):
Line 392:
x, y = geom.[id_tmp].xy
should be changed to
x, y = geom.geoms[id_tmp].xy
After making the modification, you need to restart QGIS before testing again.
Best regards,
Hello,
Thank you for the instructions! Besides the above modifications, I also got the following warning in ClassProfInterpDialog.py, line 60, in init_gui:
self.sp_nbplan.setValue(nplan) TypeError: setValue(self, int): argument 1 has unexpected type 'numpy.float64'
Then I changed this line to solve it:
self.sp_nbplan.setValue(int(nplan))
But still the QGIS window froze and was forced to quit when clicking "OK" in the Interpolate Profile Dialog.
Best regards,
Hello,
Thank you for your feedback.
To add int(), it might be better to insert it directly into the get_nplan() function at line 1945 in the Graphic/GraphProfilDialog.py file, by replacing:
return nplan
with
return int(nplan)
However, even without this modification, I am unable to reproduce the error you mentioned. Could you provide me with a specific case where the error occurs, such as an example of a database from a test model? This would help me better understand the issue, as it might be caused by another factor.
Best regards,
Hello,
I followed your suggestion while the same problem appeared on my side.
I'd love to provide an example. I am not sure if I exported the right files:
Please tell me if other files are needed.
In addition, the same problem is encountered with similar case on Windows QGIS 3.34.1 and Ubuntu QGIS 3.34.10, with Mascaret plugin version 5.0.8.
Best regards,
To avoid further mistakes, I recommend using QGIS version 3.34 (LTR) instead of 3.38 (which hasn't been fully tested yet), as the latest version includes an update to the Python version. Based on your feedback, this might explain some of the issues you're encountering.
We will do our best to ensure everything works properly with version 3.38, but it might take a bit of time.
Best regards,
Sorry I might not have clearly described the case. The current test case was created using QGIS 3.34.
Best regards,
Regarding the QGIS version, that’s my fault—I read it a bit too quickly this morning.
I discovered a few bugs in the interpol_fct_lg function in the Python file Graphic/ClassProfInterp.py that hadn't been detected during testing.
Additionally, I figured out why the window was freezing; it was due to a pasz = 0 value in the "while" loop, likely caused by the specific configuration of your profile.
Here are the corrections to be made in the Graphic/ClassProfInterp.py file:
At line 227, replace:
return
with:
return None, None
At line 254, replace:
return None, None, None
with:
return None, None
At line 365, replace:
while z_level + pasz <= zmax:
with:
while z_level + pasz <= zmax and pasz != 0:
Unfortunately, the interpolation isn’t working very well in your case. To improve the results, I recommend modifying the minor bed areas of the upstream and downstream profiles. This should make the interpolation easier and yield a better match between the profiles. You can then select the elements that seem most suitable for your profile.
To better understand the interpolation process, I suggest checking out the following link. https://github.com/Artelia/Mascaret/wiki/Creation_model#426-Interpolation-du-profil
I hope these adjustments have resolved your issue this time.
All the modifications will, of course, be included in the next release, which is scheduled for early September.
Best regards,
Hello,
Thank you for your help! These modifications solve most of my problems and I will continue reading the user guide. Cannot wait to see the next release!
However, could you please also check on the boundary conditions? In this test case, these are two inlets, essentially two time series of flowrate Q(t), in the extremity "up" and "2", and 3 downstream water levels Z(t), respectively in the extremity "3", "4" and "5".
In the xcas file only the boundary condition of the extremity "up" was declared, and only up.loi was created, although each hydro law has been associated with an extremity.
Best regards,
Hello,
It seems that the issue stems from the fact that you've used only numbers for the endpoints. To avoid this, it's recommended to add at least one letter to these numbers so that they form text. Additionally, be mindful of profiles or the other singularities —it's important to avoid naming them with just a number.
To correctly rename the endpoints, follow these steps:
Edit the "extremites": Start by editing the table. Copy the relevant items, then rename the copy by adding a letter or meaningful text. After that, save your changes.
Modify the "branchs" table: Once the endpoints are renamed, go to the "branchs" table and update the extremites accordingly, using the new names.
Update the link for creating laws: Next, update the extremites link used for creating laws, ensuring it reflects the new extremites.
Clean up old data: Finally, return to the "extremites" table and delete the old extremites (the ones that were just numbers).
These steps should resolve the issue and ensure better clarity and consistency in managing the endpoints.
Best Regard,
Hello,
Thank you for your suggestions which have solved the problem.
I would like to propose a piece of advice. Besides initiating with a steady run or providing a .lig file generated from somewhere else, setting the initial conditions for example with cross sections might also be a good way.
Best regards,
Hello,
I'm glad to hear that everything is working well.
Thank you for your suggestions. You're right, it's currently only possible to create a custom .lig file, which can indeed lead to errors if the format isn't followed correctly. It's important to note that you don't need to include all the sections in the file, just the key sections (PK) that define the branches. The rest will be interpolated linearly which significantly reduces the size of the .lig file.
Best Regards,
I am currently using QGIS 3.38 on Ubuntu 22.04, with Python 3.10.12, and I did not succeed in installation any version of the Mascaret plugin newer than 5.0.8.
And on Mascaret 5.0.8., any created and saved extremity or branch is invisible.