In my app a user is allowed to upload a .gef file. Upon uploading, a GEFFile object is created and parsed and the resulting GEFData is used to create a SoilLayout object by classifying the GEFData. Before creating a parametrization (Using
@ParamsFromFile(file_types=[".gef"])) of the SoilLayout, it is filtered with a set thickness of 0.2 m to get rid of very thin layers. The situation has now occurred where a user is able to upload one gef without problems whereas another gef cannot be uploaded. The error message that is given is:
NotImplementedError: Cannot merge layers: values of property ‘qc_norm_measured’ are of type ‘<class ‘NoneType’>’, which is not supported.
I tried to investigate this error but noted that for both SoilLayouts, the qc_norm_measured of the first layer was None and was a positive, nonzero float for each other layer. This left me at a loss so I am hoping someone can help me find out what is causing this error message. I have attached the SoilLayouts that can and cannot be filtered to this ticket. The line of code that crashes is the following:
where soil_layout_user is the SoilLayout object added to this ticket.
soil_layout_error.txt (63.6 KB)
soil_layout_succes.txt (43.2 KB)
Looks like that in the ‘error’ file, the top (None) layer is 0.2. For the succes file, the layer > 0.2. So it looks like that the merge of the first layer is failing (end for the succes file, the first layer does not need to be merged). The gef probably has some failed measurements at the top of the gef. I would advice to first filter those out by looping over the measurements before classification.
Second option is to first throw out the top layer when it is a None layer.
Thanks for you reply, I discussed it with the end user and came to the conclusion that we would prefer to not filter or discard any layers. Therefore we decided to check if qc_norm_measured is None and if it is None set it to qc_measured. Our reasoning is that when filtering a SoilLayout, the only two parameters that are of influence are the top_of_layer and soil_name parameters. We do not see why the qc_norm_measured is used in the filtering process since it is a parameter that’s only used upon GEFData classification.
Having set the qc_norm_measured to qc_measured the error is now resolved. I was just wondering if you can give your opinion regarding our solution since we might be overlooking why the qc_norm_measured is or isn’t used in the filtering of the SoilLayout.