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

NivelFuncionTabla and nivelfunctiontabla #42

Open
dandavies99 opened this issue May 25, 2022 · 2 comments
Open

NivelFuncionTabla and nivelfunctiontabla #42

dandavies99 opened this issue May 25, 2022 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@dandavies99
Copy link
Contributor

@pxjacomex - What do these do? Should the model be defined in models.py? It's hard for us to understand because the function is basically pure SQL.

@dandavies99 dandavies99 added help wanted Extra attention is needed question Further information is requested labels May 25, 2022
@pxjacomex
Copy link
Collaborator

@dandavies99 There are two models associated with the function for converting water level to flow: CurvaDescarga, and NivelFuncion.

NivelFuncion: Stores the conversion function in a string field using postgres arithmetic syntax, for example: 0.35*(H^2.19) + 1.76*H , where H is the water level in centimeters.
This function is multi-level for a single station, so you can have something like this:

curvadescarga_id      level       function
1                     30          2.14*H                        # applies from  0 to 30 cm
1                    120          0.35*(H^2.19) + 1.76*H        # applies from 30 to 120 cm

CurvaDescarga model associates the group of functions to a station in a given date (start date)

All the postgres code about CurvaDescarga/NivelFuncion you see in the project is to convert water level to flow trying to speeding up the calculations when massive amounts, and because there was also required that some of them applies automatically, triggers were made when:

  • a conversion function change
  • for previewing flow data even when not validated
  • after validating water level

If you would like to try the code for converting water level to flow using this multilevel approach I recommend removing the triggers and implementing it manually and see if its convenient for you.

Please let me know if you need further explanation.

@dandavies99
Copy link
Contributor Author

Thanks @pxjacomex, I understand what these mean now. I'll leave this issue open so we can return to it when we want to implement this part.

@dandavies99 dandavies99 added documentation Improvements or additions to documentation enhancement New feature or request and removed help wanted Extra attention is needed question Further information is requested labels May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants