FLO-2DSoftware / qgis-flo-2d-plugin

A plugin for pre-processing/post-processing FLO-2D models
5 stars 7 forks source link

Storm Drain Issue #1295

Closed FLO-2DKaren closed 2 months ago

FLO-2DKaren commented 2 months ago

Drop Box Area Errors

https://github.com/FLO-2DSoftware/qgis-flo-2d-plugin/assets/20424460/dfca4a12-ac08-4d30-ace8-a4ed3cc79c20

  1. See video for first error

ERROR 070618.0451: creation of Storm Drain Nodes (Inlets) layer failed after reading 0 inlets!


Error: KeyError: 'drboxarea'

In file: C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\dlg_stormdrain_shapefile.py

In function: load_inlets_from_shapefile

On line 1151: feat.setAttribute("drboxarea",drboxarea)

  1. Drop boxes cannot be assigned to junctions.
  2. Set the UI default tab to Inlets/Junctions
FLO-2DJJ commented 2 months ago

Hi @FLO-2DKaren, Just to eliminate a possible cause of first error 1.: Did you create a new FLO-2D Project? It is needed because the dropbox area is a new field in the Storm Drain Nodes table:

imagen

FLO-2DKaren commented 2 months ago

@FLO-2DJJ @rpachaly

OK let's get some help from Robson then because maybe we can add this to the auto port or maybe add it as an afterthought with a trigger.

Hi Robson,

Can we explore updating the GeoPackage for the Drop Box? There may be additional things too. I'm not sure what the structure check is for the Auto Port to kick in. I think you are also working with some other GeoPackage tables that may also need auto port from v1.0.0.

rpachaly commented 2 months ago

Hi all,

I'm going to add it to the autoport code. Is there any other field or layer that was added?

rpachaly commented 2 months ago

The autoport code works like this:

  1. It identifies if the gpkg is outdated
  2. Creates a new blank geopackage
  3. Copies the outdated geopackage data to the new geopackage

If a layer of a table was updated on the db_structure, it should be ported with the default value and work fine. I just tested here and the dropboxarea field is ported correctly and I did not get any errors.

image

Karen, your project was ported before or after the dropboxarea field was added to the code? If it was ported before, it will show an error. Can you check this?

FLO-2DJJ commented 2 months ago

Hi @rpachaly,

rpachaly commented 2 months ago

Field drboxarea is the only field added to the user_swmm_nodes table.

It works on the autoport.

Consider that file SWMMFLODROPBOX.DAT is imported/exported to/from user_swmm_nodes.

I saw that it is exported when I was working on exporting the sd data to hdf5. I did not test the import though. Probably I will do it when coding the import from hdf5.

Also, there is a new table user_swmm_storage_units.

Just checked here and it is ported correctly.

FLO-2DKaren commented 2 months ago

Hi Robson,

It wasn't ported. It was started from version 1.0.0. Is that something I can fix?

rpachaly commented 2 months ago

Hi Robson,

It wasn't ported. It was started from version 1.0.0. Is that something I can fix?

Did you start before the dropboxarea was added? The dropboxarea is not something that is used to evaluate if a gpkg is outdated.

The gpkg port should be done after the dropboxarea is added.

FLO-2DKaren commented 2 months ago

I'm going to close this issue but just in case someone else sees this who isn't with us, I want to note that I did an midline fix for this by adding drboxarea field real to the SD Inlets layer in the User Layer Group.

FLO-2DJJ commented 2 months ago

There remains a sub-task that needs to be investigated:

2. Drop boxes cannot be assigned to junctions.

I'll do it in a separate issue #1296.

FLO-2DKaren commented 2 months ago

Oh right!!! Thanks JJ