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

correct number of qlat dataframe columns #593

Open
kumdonoaa opened this issue Nov 4, 2022 · 3 comments
Open

correct number of qlat dataframe columns #593

kumdonoaa opened this issue Nov 4, 2022 · 3 comments

Comments

@kumdonoaa
Copy link
Contributor

kumdonoaa commented Nov 4, 2022

In mc_reach.pyx, the required number of qlat dataframe column, qlat_values.shape[1], should be equal to or larger than total simulation time divided by qlat column interval in time. But, nsteps in that line merely counts simulation time steps. So, instead of nsteps, math.ceil(dt*nsteps/dt_qlat), where dt=simulation time interval [sec] and dt_qlat=lateral flow record time interval [sec], need to be used.

Also, including qts_subdivisions may make passing correct qlat column values complicated. For example, with 1hr lateral flow data and dt=300 sec, qts_subdivision should be 12 while 6 when dt=600 sec because qts_subdivisions = dt_qlat/dt in this case. Instead of changing qts_subdivision according to different values of dt or dt_qlats, replacing <int>((timestep-1)/qts_subdivisions) by int ((timestep-1)*dt/dt_qlat) makes the indexing work exactly the same. Even better, we don't have to change the value of qts_subdivisions when dt or dt_qlat changes.

Current behavior

Expected behavior

Steps to replicate behavior (include URLs)

Screenshots

image

image

image

@hellkite500
Copy link
Member

hellkite500 commented Nov 4, 2022

I pushed a fix for this in #592. The logic is in fe6f8ff, does that look more approriate?

@hellkite500
Copy link
Member

@groutr @jameshalgren there has been some discussion recently around qts_subdivisions and what its intended use is and whether it is strictly required or if it can/should be essentially inferred from the input series. Would either of you have any comments about this off the top of your head? It is relevant here, but we can also move that to its own issue if we want, but this made me think of the disscussion.

@jameshalgren
Copy link
Contributor

jameshalgren commented Nov 4, 2022

Good question. We had the parameter there for early testing with un-registered input time series with no time metadata from which to infer the relationship to the simulation timesteps.

A related question that we wrestled with early on was whether to feed the array of qlateral values to the compute kernel already expanded out for all of the intermediate time steps or to keep it in the original hourly form and do the expansion in the kernel. If we feed in the hourly values, we need either a qts_subdivisions or a qts_time_step to connect the qlaterals to the simulation timestep. (In other words, even if we infer the value, we would still need to pass it to the kernel.)

Maybe a separate issue on the deeper question of kernel input marshalling would make sense.

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