YukonWRB / AquaCache

Package to create and update a postgres database holding water and climate related data
GNU Affero General Public License v3.0
3 stars 0 forks source link

Create means of applying corrections to data and creating compound timeseries #140

Open gdelaplante opened 2 months ago

gdelaplante commented 2 months ago

AquaCache is not currently set up to accept or apply corrections to data. In the even that this is needed/desired, a process similar to that used by Aquarius can be considered. A table structure has been created to hold this information and is in the dev/data_corrections.R file.

Missing is a views table that mirrors measurements_xxxx tables but applies corrections to the data passed through. Notes to this effect are included in the file.

gdelaplante commented 1 month ago

Table structure and SQL operations created: public.corrections holds the corrections and their periods of applicability public.correction_types holds information regarding the corrections, their priority of application, etc. function apply_corrections contains the logic for applying corrections view public.measurements_continuous_corrected and public.measurements_discrete_corrected apply this function to output corrected timeseries

Still missing:

  1. Determining what to do with the calculated_daily table. Currently this takes values from table measurements_continuous, but should this be switched to the corrected table at the expense of a bit of speed?
  2. Creating a GUI means of applying corrections.

An additional useful functionality is creating calculated (such as specific conductivity), compound (such as multiple climate stations), or derived timeseries. A draft workflow is in file dev/calculated_derived_tsids.R. Implementing this would require: