Commit 07db63c8 authored by Sergio Bruni's avatar Sergio Bruni
Browse files

a

parent 64b201c1
......@@ -916,30 +916,60 @@ order by s.marker
#### data ogni coppia di rinex duplicati esegue la differenza tra le posizioni x,y,z
```
select name,
current_x_crd_a,
prev_x_crda,
current_x_crd_a - prev_x_crda as diff
from (
select
name,
x_crd_a as current_x_crd_a,
lag(x_crd_a) over (partition by name order by name) as prev_x_crda,
row_number() over (partition by name order by name desc) as rn
from
(
select * from rinex_file where name in
select
max(diff_x) as max_diff_x, min(diff_x) as min_diff_x, round(avg(diff_x),1) AVG_diff_x,
max(diff_y) as max_diff_y, min(diff_y) as min_diff_y, round(avg(diff_y), 1) AVG_diff_y,
max(diff_z) as max_diff_z, min(diff_z) as min_diff_z, round(avg(diff_z),1) AVG_diff_z
from (
select name,
current_x_crd_a,
current_y_crd_a,
current_z_crd_a,
prev_x_crda,
prev_y_crda,
prev_z_crda,
round(current_x_crd_a - prev_x_crda, 1) as diff_x,
round(current_y_crd_a - prev_y_crda, 1) as diff_y,
round(current_z_crd_a - prev_z_crda, 1) as diff_z
from (
select
name,
x_crd_a as current_x_crd_a,
lag(x_crd_a) over (partition by name order by name) as prev_x_crda,
y_crd_a as current_y_crd_a,
lag(y_crd_a) over (partition by name order by name) as prev_y_crda,
z_crd_a as current_z_crd_a,
lag(z_crd_a) over (partition by name order by name) as prev_z_crda,
row_number() over (partition by name order by name desc) as rn
from
(
select name
from rinex_file r
where id_station=(select id from station where marker='PIOB')
group by name
having count(*) = 2
)
) a
) t
where current_x_crd_a is not null and prev_x_crda is not null
order by current_x_crd_a - prev_x_crda desc
select r.name, x_crd_a, y_crd_a, z_crd_a from rinex_file r
join rinex_file_network rn ON rn.id_rinex_file=r.id
and r.name in
(
select name
from rinex_file r
where id_station=(select id from station where marker='RIET')
group by name
having count(*) = 2
)
join network n ON n.id=rn.id_network
and n.name in ('ITALPOS', 'SOGEI')
order by name, rn.id_network desc
) a
) t
where
current_x_crd_a is not null and prev_x_crda is not null
and current_x_crd_a <> 0 and prev_x_crda <> 0
and current_y_crd_a is not null and prev_y_crda is not null
and current_y_crd_a <> 0 and prev_y_crda <> 0
and current_z_crd_a is not null and prev_z_crda is not null
and current_z_crd_a <> 0 and prev_z_crda <> 0
-- order by current_x_crd_a - prev_x_crda desc,
-- current_y_crd_a - prev_y_crda desc,
-- current_z_crd_a - prev_z_crda desc
) t1
```
......@@ -995,3 +1025,57 @@ left JOIN network n on n.id=rn.id_network
ORDER BY t1.md5uncompressed
```
#### Evidenzia le stazioni recuperate da più reti con posizione media diversa. Quando le reti sono più di due non confronta tutte le possibili coppie ma solo ciascuna rete con la precedente in ordine di nome.
Esempio per reti A, B, C mostra B con A e C con B. In modo completo dovrebbe confrontare anche A con C
```
select *
FROM (
select
station,
network network1,
prev_network network2,
count_rinex,
x - prev_x diff_x,
y - prev_y diff_y,
z - prev_z diff_z
FROM (
select
station,
network,
count_rinex,
x, y, z,
lag(network) over (partition by station order by station, network) as prev_network,
lag(x) over (partition by station order by station, network) as prev_x,
lag(y) over (partition by station order by station, network) as prev_y,
lag(z) over (partition by station order by station, network) as prev_z
FROM (
select
s.marker station,
n.name network,
count(*) count_rinex,
round(avg(x_crd_a), 3) x,
round(avg(y_crd_a), 3) y,
round(avg(z_crd_a), 3) z
from rinex_file r
join station s on s.id=r.id_station
JOIN rinex_file_network rn ON rn.id_rinex_file=r.id
JOIN network n ON n.id=rn.id_network
-- where s.marker = 'TERM'
and x_crd_a <> 0 AND x_crd_a IS NOT NULL
and y_crd_a <> 0 AND y_crd_a IS NOT NULL
and z_crd_a <> 0 AND z_crd_a IS NOT NULL
GROUP BY s.marker, n.name
ORDER BY s.marker, n.name
) t
) t1
WHERE prev_x IS NOT NULL
) t2
WHERE diff_x > 10
OR diff_y > 10
OR diff_z > 10
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment