-
Notifications
You must be signed in to change notification settings - Fork 12
Basic building reconstruction #127
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
Basic building reconstruction #127
Conversation
HenryGeorgist
left a comment
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.
i think i misled you when i said make a unit test. what i meant was make a unit test where we create a simple slice of hazards, a structure, and an occupancy type with a reconstruction component and write the logic for what we want the code to do in the unit test to review the behavior before we modify all of the code. we will learn from the unit test implementation before we force ourselves down a path.
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.
lets not checkin this draw io yet. lets make sure we know what we are doing first.
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.
lets not checkin this draw io yet lets make sure we know what we are doing
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.
we should not be working at this high level yet. please revert this change.
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.
lets not start with the high level workflow - this forces us down a path by making alot more changes required before we even start. lets save those for when we know what we want to do works.
| }) | ||
| //compute consequences. | ||
| StreamAbstract(dfr, nsp, w) | ||
| StreamAbstractReconstruction(dfr, nsp, w) |
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.
lets not start with this, lets do that later. we will start with a single structure unit test not a full inventory unit test.
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.
lets not check in a binary file into the code. worst case lets use a csv
| "math/rand" | ||
| "strings" | ||
|
|
||
| "github.com/HydrologicEngineeringCenter/go-statistics/paireddata" |
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.
i think we dont have to use a direct reference to the paired data object, we didnt with damage functions, so lets look into why this seems necessary before we include it. maybe we have another interface we need to create or one we need to modify.
| rDamFun, rderr := s.OccType.GetComponentDamageFunctionForHazard("reconstruction", e) | ||
| if rderr != nil { | ||
| // this default reconstruction function will return -901 days for all input values of sdampercent | ||
| rDamFun = DamageFunction{Source: "DefaultNull", DamageDriver: hazards.Depth, DamageFunction: paireddata.PairedData{Xvals: []float64{0.0, 1.0}, Yvals: []float64{-901.0, -901.0}}} |
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.
ah. this is where the paired data comes from! cool. we may consider a different approach here somehow.
| sdampercent = sDamFun.DamageFunction.SampleValue(depthAboveFFE) / 100 //assumes what type the damage array is in | ||
| cdampercent = cDamFun.DamageFunction.SampleValue(depthAboveFFE) / 100 | ||
| duration := math.Max(0.0, e.Duration()) // if no duration, value is -901 | ||
| reconstruction_days = rDamFun.DamageFunction.SampleValue(sdampercent) + duration |
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.
im not sure its a great idea that we add reconstruction days to the standard compute, it shouldnt really matter that much, but it is another dependency. we can avoid this with some changes in how we implement the higher level stuff, for now though lets remove this and focus on a simpler implementation that focuses on a separate path from the main path until we know our stuff works well.
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.
lets not add python dependencies into our dev environment. i like what you have done generally, but lets do that in a go file (there should be an example in occtype_test.go
|
it might be worthwhile to set up a time to actually write out a unit test together so we can co-code the idea you have in its simplest way before we change the entire code base. I suspect the changes you made are close to right, but lets start smaller and verify each component part first. |
This PR adds basic reconstruction time to 'Compute' for structures.
occtypes.jsonsdampercent)occtypes.jsonQuestions
computeConsequencesWithReconstructionfunction?Computemethod for receptors.