kirenbahm / ENP_TOOLS

Scripts used to pre- and post-process data
0 stars 2 forks source link

Aggregate station data #31

Closed LAGO-Support closed 4 years ago

LAGO-Support commented 4 years ago

Reads in a text file for equations then create new stations in the database and adds aggregated data to them based on source equations.

LAGO-Support commented 4 years ago

If you could please review. If we need to add more actual data to some of the fields for the new Aggregated stations instead of null or empty values, let me know. We can discuss options for potential fillers.

kirenbahm commented 4 years ago

Overall this looks good. Thanks for cranking out this so quickly.

A few minor things to address:

  1. Change function name and filename to match
  2. Set StationEqFile in ANALYSIS_COMPARE as part of the INI variable
  3. Add description of function at top of script
  4. Please add more comments in the script describing what it's doing and what the variables stand for (double the amount of comments you have)
  5. Improve the formatting for what gets printed to Standard Output (Command Window)
  6. I have added some Bad stations to the aggregate_rules_file_example-AGG.txt andSTATIONS-test-short-AGG.txt lists (attached). Try the script with these, and fix any errors that come up.
kirenbahm commented 4 years ago

And here are the attachments... STATIONS-test-short-AGG.txt aggregate_rules_file_example-AGG.txt

LAGO-Support commented 4 years ago

Addressed previous comments. Please review and if more changes are desired let us know.

kirenbahm commented 4 years ago

Everything is complete here except "2. Set StationEqFile in ANALYSIS_COMPARE as part of the INI variable"

A couple of quick edits to ANALYSIS_COMPARE.m to declare and check for the INI.StationEqFile should do the trick.

kirenbahm commented 4 years ago

I tried adding two new equations to the list, and am getting unexpected results. The equations are:

L31Nin2 = S334_Q - S336_Q + S335_Q - S356_Q
L31N_lower_total = S331T_Q - S194_Q - S196_Q - S332T_Q - S174_Q - S176_Q

Here is the output:

----Parsing Equation
----L31Nin2 = S334_Q - S336_Q + S335_Q - S356_Q
----Assigning Aggregate Station ID: L31Nin2....Success.
----Checking Summand Station S334_Q...OK
----Checking Summand Station S336_Q...OK
----Checking Summand Station S335_Q...OK
----Checking Summand Station S356_Q...Not Flow
----Final Equation: L31Nin2 =  - S336_Q + S335_Q - S356_Q 

----Parsing Equation
----L31N_lower_total = S331T_Q - S194_Q - S196_Q - S332T_Q - S174_Q - S176_Q
----Assigning Aggregate Station ID: L31N_lower_total....Success.
----Checking Summand Station S331T_Q...OK
----Checking Summand Station S194_Q...OK
----Checking Summand Station S196_Q...OK
----Checking Summand Station S332T_Q...Not found
----Checking Summand Station S174_Q...Not Flow
----Checking Summand Station S176_Q...OK
----Final Equation: L31N_lower_total =  - S194_Q - S196_Q   - S174_Q - S176_Q 

So, for the first equation, the output says summand S334_Q is 'OK', yet it does not appear in the Final Equation. Summand S356 is 'Not Flow' but is used in the Final Equation.

Can you figure out what's going on here? Thanks!

LAGO-Support commented 4 years ago

S356_Q Error S174_Q Error

Fixed the issue you reported. The final equation for calculation was correct but the not flow station removed the first station rather than the correct station from print out of the final equation.

The two not flow stations are set as Elevation datatype in the database.

The not found station may be a misspelling. S332T_Q doesn't exist, but S332TOT_Q was a new aggregate from a previous equation. Was this what you were refering to?