nens / threedigrid

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

Make get_field_value apply filter by default #18

Open RichardB9 opened 6 years ago

RichardB9 commented 6 years ago

It can be confusing when accessing data from a specific structure, the filter is not applied by default. For example:

parser.lines.orifices.get_field_value('q') 
parser.lines.orifices.q

I expect the two above lines to return the same values, i.e. all 'q' values of orifices, however the first line returns all 'lines' instead of the subset orifices. Instead I have to call get_filtered_field_value('q') to get the same result. It seems counter-intuitive to not apply the orifices filter in the above example. This can be confusing for new users.

larsclaussen commented 6 years ago

I agree. To me this seems more like bug. I guess that calling get_field_value() directly bypasses the filter that is defined as a property on the lines object. Maybe the get_field_value() method should be private in the first place. I'll check how the mechanism works to see how we can make field retrievals explicit.

jpprins1 commented 6 years ago

Agree, probably the best to remove "get_field_value" and create a function to get a field value from the datasource behind the model.

The "get_filtered_field_value" should be hided, this makes the interface more clear.