From 5bfd02548a8f93ebadb5c3931bdb7ca6c1e5d8a8 Mon Sep 17 00:00:00 2001 From: Simon Norris Date: Mon, 29 Jul 2024 16:21:31 -0700 Subject: [PATCH] fix source table names in cw analysis and drop only when done with them --- extras/channel_width/Makefile | 6 +++--- extras/channel_width/sql/channel_width_analysis.sql | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extras/channel_width/Makefile b/extras/channel_width/Makefile index b585525..30ae409 100644 --- a/extras/channel_width/Makefile +++ b/extras/channel_width/Makefile @@ -46,9 +46,6 @@ all: $(GENERATED_FILES) $(PSQL) -f sql/fiss_stream_sample_sites_events.sql # Now load the measured channel widths where we have them, averaging measurements on the same stream $(PSQL) -f sql/channel_width_measured.sql - # drop the source tables - $(PSQL) -c "drop table fwapg.fiss_stream_sample_sites_sp" - $(PSQL) -c "drop table fwapg.pscis_assessment_svw" touch $@ # -------- @@ -100,3 +97,6 @@ clean: for table in $(GENERATED_TABLES); do \ $(PSQL) -c "DROP TABLE IF EXISTS "$$table ;\ done + # drop the source tables + $(PSQL) -c "drop table fwapg.fiss_stream_sample_sites_sp" + $(PSQL) -c "drop table fwapg.pscis_assessment_svw" diff --git a/extras/channel_width/sql/channel_width_analysis.sql b/extras/channel_width/sql/channel_width_analysis.sql index fd47d64..e45269a 100644 --- a/extras/channel_width/sql/channel_width_analysis.sql +++ b/extras/channel_width/sql/channel_width_analysis.sql @@ -52,7 +52,7 @@ SELECT p.channel_width, (st_dump(p.geom)).geom as geom FROM fwapg.fiss_stream_sample_sites_events_sp e -INNER JOIN whse_fish.fiss_stream_sample_sites_sp p +INNER JOIN fwapg.fiss_stream_sample_sites_sp p ON e.stream_sample_site_id = p.stream_sample_site_id WHERE p.channel_width IS NOT NULL UNION ALL @@ -67,7 +67,7 @@ SELECT a.downstream_channel_width as channel_width, (st_dump(e.geom)).geom as geom FROM fwapg.pscis_crossings e -LEFT OUTER JOIN whse_fish.pscis_assessment_svw a +LEFT OUTER JOIN fwapg.pscis_assessment_svw a ON e.stream_crossing_id = a.stream_crossing_id WHERE a.downstream_channel_width IS NOT NULL UNION ALL