nens / threedigrid

grid administration for 3Di models
Other
9 stars 0 forks source link

Add cross section table data to GeoJSON export #218

Closed leendertvanwolfswinkel closed 2 months ago

leendertvanwolfswinkel commented 4 months ago

For two features in 3Di Live, we need the data that describes the cross-sections of flowlines with tabulated cross-sections.

Proposal is to add three new fields to the geojson lines outputs:

leendertvanwolfswinkel commented 4 months ago

Frontend 1: https://app.zenhub.com/workspaces/frontends-62dfbf294a7dde0018f68e92/issues/gh/nens/nens-frontends/454 Frontend 2: Limit 1D flow viz width to max cross sectional width

daanvaningen commented 3 months ago

Added tabulated data to:

extra fields:

Example with tabulated data:

    "properties": {
        "id": 42144,
        "content_pk": 727,
        "code": "",
        "kcu": 2,
        "calculation_type": 102,
        "dist_calc_points": 10.0,
        "connection_node_start_pk": 2629,
        "connection_node_end_pk": 2300,
        "discharge_coefficient": 1.0,
        "model_type": "Channels",
        "cross_section_type_1": 6,
        "cross_section_table_1": [
            [
                1.0,
                1.0
            ],
            [
                0.0,
                0.5
            ]
        ],
        "cross_section_type_2": 6,
        "cross_section_table_2": [
            [
                1.0,
                1.0
            ],
            [
                0.0,
                0.5
            ]
        ],
        "cross_section_weight": 0.998636509093291
    }
    "properties": {
        "id": 42448,
        "content_pk": 13173,
        "display_name": "1546 - 1754",
        "code": "",
        "kcu": 4,
        "cross_section_shape": 1,
        "cross_section_width": 5.0,
        "cross_section_height": null,
        "crest_level": 134.06,
        "crest_type": 4,
        "sewerage": 0,
        "discharge_coefficient_positive": 0.8,
        "discharge_coefficient_negative": 0.8,
        "friction_value": null,
        "friction_type": -9999,
        "connection_node_start_pk": 1754,
        "connection_node_end_pk": 1546,
        "model_type": "Weirs",
        "cross_section_type_1": 1,
        "cross_section_table_1": [
            [],
            []
        ],
        "cross_section_type_2": 1,
        "cross_section_table_2": [
            [],
            []
        ],
        "cross_section_weight": 1.0
    }
leendertvanwolfswinkel commented 3 months ago

@daanvaningen ik heb een model op staging ge-regenerate en de channels geojson gedownload, maar daar vind ik die nieuwe velden niet in terug https://api.staging.3di.live/v3/threedimodels/16634/geojson/channels/download/

daanvaningen commented 3 months ago

staging is weer terug naar een vorige versie omdat de DB versie niet compatibel is met Django 4.2. Hadden we even kunnen laten weten sorry.

leendertvanwolfswinkel commented 2 months ago

Tested again, with a testbank model containing several cross-sections. All YZ, all the same. They look like this:

image.png

I do see the cross section tables in the geojson, so that's nice. But I don't think it's quite right:

"cross_section_table_2":[
               [
                  0.0,
                  1.0,
                  2.0,
                  4.0,
                  12.5,
                  15.0,
                  17.0,
                  19.0,
                  21.0,
                  22.0
               ],
               [
                  2.0,
                  6.25,
                  12.5,
                  15.381,
                  25.5,
                  33.556,
                  39.333,
                  68.667,
                  3.333,
                  100.0
               ]
            ]

See https://api.staging.3di.live/v3/threedimodels/16664/geojson/channels/download/

Second point: for visualization purposes it would be nice if we could show the original YZ profile, instead of the profile we see here that has been converted to Tabulated trapezium.

daanvaningen commented 2 months ago

The tabulated cross sections that are set in the gridadmin file do contain the 3.333 as width, if it's not right we'll need to look into that. I agree that it looks a bit weird but I have not heard any complaints about the transformation from yz to tabulated before, so I am bit hesitant to dive into it. Took a small glance but it looks a bit complex so didn't pursue it further. Let me know what you think.

I did change the output to YZ in case of YZ (heights, widths):

        "cross_section_table_1": [
            [
                19.0,
                17.0,
                12.5,
                2.0,
                1.0,
                0.0,
                0.0,
                4.0,
                15.0,
                21.0,
                22.0
            ],
            [
                0.0,
                28.0,
                38.0,
                40.0,
                45.0,
                48.0,
                50.0,
                55.0,
                66.0,
                70.0,
                100.0
            ]
        ],
leendertvanwolfswinkel commented 2 months ago

@daanvaningen I think it would be good to look into this, because the width value of 3.333 is obviously wrong, and it would affect the simulation results if this error occurs in a part of the cross section that is wet. In the current testbank test, this part of the cross-section does not become wet. I have asked @Overmeen to run a test with a higher water level to see if it actually affects simulation results

daanvaningen commented 2 months ago

I have found the issue regarding the 3.333 width. It is caused by the left height being lower than the right height. A way to fix this would be to extend the left side vertically until the max height is reached. But it is dependent on what you would expect as a user.

Would you expect the waterlevel to rise beyond the highest left most point until the highest pixel in the cell is reached? Or does the cell directly overflow after the waterlevel reaches the left most point?