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

Improved handling of identically-named formula parameters. #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Improved handling of identically-named formula parameters. #35

wants to merge 1 commit into from

Conversation

jon4than
Copy link
Contributor

@jon4than jon4than commented Jun 4, 2013

Hi everyone,

@mhiley pointed out to me that if a parameter name is shared by more than one formula, the user input written out to operandcache.xml will be associated with every parameter using that name.

This is due to the way the operand cache key is constructed. Currently, it uses the following:

cache[(parameter_name, parameter_type)] = <VALUE>

The attached code simply changes the key to this:

cache[(formula_description, parameter_name, parameter_type)] = <VALUE>

This was a little problematic in that a DataOperand had no way of knowing which formula it is associated with, so I ended up having to modify both DataOperand and DerivedDataChoice. While all of that should be obvious from the diffs, I wanted to explicitly mention it because I feel like it is a little too fragile…though it has worked fine in my testing.

@donmurray
Copy link
Collaborator

Is this really a problem? In what scenarios does this cause problems for the user? Just trying to figure out if this is an annoyance or a bug. Mucking with DataOperand and DerivedDataChoice always makes me nervous, so this would need some serious testing in the real world. Also, for things like lat/lon, if they are used in different formulas, I think I'd want the same defaults I had last time, especially if I was running different formulas to compute values over the same region. What happens if a user changes the description of a formula? Do their last preferences get lost (they didn't before)? Inquiring minds want to know.

@jon4than
Copy link
Contributor Author

jon4than commented Jun 5, 2013

Yeah, I agree about changes to DataOperand and DerivedDataChoice being kinda scary, and you raise a very good point about the description possibly changing. I'll have to chew on that a bit.

Anyway, I think this is more of an annoyance…but the current behavior can be confusing, especially when you combine identical parameter names that have different default values. That said, I can see the utility in your lat/lon example.

Maybe if the input field was a drop down containing all previous user input?

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

Successfully merging this pull request may close these issues.

2 participants