Closed GoogleCodeExporter closed 9 years ago
SQL for unconstrained query described above from test load database:
\c stoqs
SELECT DISTINCT stoqs_measurement.depth,
mp_x.datavalue AS x,
mp_y.datavalue AS y
FROM stoqs_activity
INNER JOIN stoqs_platform ON stoqs_platform.id = stoqs_activity.platform_id
INNER JOIN stoqs_instantpoint ON stoqs_instantpoint.activity_id =
stoqs_activity.id
INNER JOIN stoqs_measurement ON stoqs_measurement.instantpoint_id =
stoqs_instantpoint.id
INNER JOIN stoqs_measurement m_y ON m_y.instantpoint_id = stoqs_instantpoint.id
INNER JOIN stoqs_measuredparameter mp_y ON mp_y.measurement_id = m_y.id
INNER JOIN stoqs_parameter p_y ON mp_y.parameter_id = p_y.id
INNER JOIN stoqs_measurement m_x ON m_x.instantpoint_id = stoqs_instantpoint.id
INNER JOIN stoqs_measuredparameter mp_x ON mp_x.measurement_id = m_x.id
INNER JOIN stoqs_parameter p_x ON mp_x.parameter_id = p_x.id
WHERE (p_y.id = 8)
AND (p_x.id = 6)
# Returns 49 row
Modified to return just depth, x, y points for places where there are samples
(new SQL is all lower case):
SELECT DISTINCT stoqs_measurement.depth,
mp_x.datavalue AS x,
mp_y.datavalue AS y
FROM stoqs_activity
INNER JOIN stoqs_platform ON stoqs_platform.id = stoqs_activity.platform_id
INNER JOIN stoqs_instantpoint ON stoqs_instantpoint.activity_id =
stoqs_activity.id
INNER JOIN stoqs_measurement ON stoqs_measurement.instantpoint_id =
stoqs_instantpoint.id
INNER JOIN stoqs_measurement m_y ON m_y.instantpoint_id = stoqs_instantpoint.id
INNER JOIN stoqs_measuredparameter mp_y ON mp_y.measurement_id = m_y.id
INNER JOIN stoqs_parameter p_y ON mp_y.parameter_id = p_y.id
INNER JOIN stoqs_measurement m_x ON m_x.instantpoint_id = stoqs_instantpoint.id
INNER JOIN stoqs_measuredparameter mp_x ON mp_x.measurement_id = m_x.id
INNER JOIN stoqs_parameter p_x ON mp_x.parameter_id = p_x.id
inner join stoqs_sample on stoqs_sample.instantpoint_id = stoqs_instantpoint.id
WHERE (p_y.id = 8)
AND (p_x.id = 6)
and stoqs_sample.id is not null;
depth | x | y
-------------------+---------------------+----------------------
-0.85070807630861 | 0.0150373139209564 | 0.000853291921996732
20.8333460743087 | 0.00611123921903796 | 0.000356326309018604
47.0254516097659 | 0.0166342378584501 | 0.000125864557424297
41.0084011951115 | 0.0106893958691858 | 0.000111319997500448
20.7215864415311 | 0.0027162356341817 | 0.00029715946267329
9.18344644259678 | 0.00478679339998439 | 0.000845079474062416
(6 rows)
This looks like what we want.
The ParameterParameter class in utils/Viz/__init__.py can be modified to
perform this additional query and add circles to the plot.
Original comment by MBARIm...@gmail.com
on 24 Jan 2014 at 5:58
A support method (say 'addSampleConstraint()') needs to be added to the PQuery
class in utils/PQuery.py to return SQL modified with the above changes to get
just the x, y points where there are Samples. The ParameterParameter class in
utils/Viz/__init__.py would then use it to get the coordinates for plotting.
Original comment by MBARIm...@gmail.com
on 24 Jan 2014 at 6:13
This issue was closed by revision
https://code.google.com/p/stoqs/source/detail?r=d8a55341682d9b58ad2bd1ca2065e0b7
171e0a56
Original comment by MBARIm...@gmail.com
on 1 May 2014 at 10:41
Original issue reported on code.google.com by
MBARIm...@gmail.com
on 24 Jan 2014 at 5:50