-
Notifications
You must be signed in to change notification settings - Fork 58
Generic derived variables #839
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
Conversation
@buchmann-dhi we are trying to work out a simple syntax for creating derived items with the ambition of being flexible but still a terse and readable syntax. Any suggestions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like an easy to use syntax, nice documentation, and great typing. My only comment is in regards to whether files with many timesteps are performant. That could also be an improvement later on (if it's an issue)...
|
||
n_time_steps = dfs_i.FileInfo.TimeAxis.NumberOfTimeSteps | ||
|
||
for timestep in range(n_time_steps): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you checked performance on files with many time steps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. But this is the same type of loop we have for all dfs files except dfs0. I.e. I would not use use this function to transform dfs0 files, which generally fits in memory.
This PR adds the possibility to create derived variables without reading the entire file into memory.
The proposed
transform
function operates on data from a single timestep.The default is to append derived items to the list of existing items, controlled by the
keep_existing_items
flag.