--here's the magic: v_sourcedat
--matches source files to datums
create or replace view v_sourcedat as
select unit_id||well_num as well, datum_m, gw.sn, source
from v_loggerdat wd,
( SELECT tmp.sn, min(tmp."time")::date AS start,
tmp.source FROM tmp_gwdata tmp
GROUP BY tmp.source, tmp.sn)
gw
where gw.sn = wd.sn::int
and gw.source not in (select source from v_sourcetowell)
union select unit_id||well_num as well, datum_m, gwo.sn, source
from v_loggerdat wd,
(select * from v_sourcetowell)
gwo
where gwo.well = wd.unit_id||well_num
order by well;
-- using v_sourcedat, as above
-- the final data
create or replace view v_gwdata_4hr as
SELECT datum.well, datum.sn, gw."time",
gw.dtw::numeric(10,4) - datum.datum_m::numeric(10,4) AS dtw,
gw.dtwsd, gw.temp, gw.tempsd
FROM v_sourcedat datum
JOIN gwdata_4hr gw using (source)
WHERE gw.temp <> 3::numeric
AND gw.dtw > (-0.5) AND gw.dtw < 4.5
AND gw."time" < '2010-01-01 00:00:00'::timestamp without time zone
ORDER BY datum.well, datum.sn, gw."time";
Hourly Subway Station Flows
-
Pie charts are bad, as
any fule kno. We’re not as good at judging relative differences between
angles
and areas as we are at judging relative differences ...
13 hours ago

No comments:
Post a Comment