Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter option in Res1D does not work? #96

Open
AL89 opened this issue Jun 10, 2024 · 1 comment
Open

Filter option in Res1D does not work? #96

AL89 opened this issue Jun 10, 2024 · 1 comment
Assignees

Comments

@AL89
Copy link

AL89 commented Jun 10, 2024

Hi there.

Is it just me or does the filter method for nodes and reaches not work when trying to load a Res1D file?

From your class Res1D in res1d.py file, line 90-98, there is written:

Examples
--------
An example of reading the res1d file only for nodes with
ID 'node1', 'node2' and reaches with ID 'reach1', 'reach2':

>>> nodes = ['node1', 'node2']
>>> reaches = ['reach1', 'reach2']
>>> res1d = Res1D('MyRes1D.res1d', nodes=nodes, reaches=reaches)
>>> res1d.read()

However, when I try to filter by nodes and reaches in my huge Res1D file, it still loads the entire dataset.

So, I got a variable selection which is a dict with keys as Node and Link, holding a list of names.

from mikeio1d import Res1D

file_path = 'my_model_result.res1d'
model_result = Res1D(file_path=file_path,nodes=selection['Node'],reaches=selection['Link'])

The Node and Link attributes holds a list with 3053 and 3080 name values, respectively. However, when the result is loaded, and I type out model_result.nodes or model_result.reaches, it will make a count of 20663 and 20756 records, respectively.

Is it not supposed to ONLY load the filtered name values? Or am I missing something here?

Thanks in advance!

@gedaskir
Copy link
Collaborator

Hi, the are two kinds of data in a res1d file: static (information about a network, etc.) and dynamic (time series). The filter option filters out the loading of dynamic data, but creates all the information related to the static data. So you get all the attributes for nodes and links, like its geometric information. But the time time series is loaded only for filtered nodes and link.

For Python auto-completion we could consider to also assign only filtered information. In either case I can see that we can improve the comments of this functionality.

@ryan-kipawa ryan-kipawa self-assigned this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants