Skip to content

Commit

Permalink
load all functions on db setup
Browse files Browse the repository at this point in the history
  • Loading branch information
smnorris committed Mar 1, 2024
1 parent 729f821 commit 99a4520
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ ALL_TARGETS = .make/db \
$(VALUE_ADDED) \
$(VALUE_ADDED_CHUNKED) \
.make/fwa_streams_watersheds_lut \
.make/fwa_functions \
.make/extras

all: $(ALL_TARGETS)
Expand Down Expand Up @@ -60,6 +59,16 @@ clean_db:
$(PSQL) -f db/functions/FWA_Upstream.sql
$(PSQL) -f db/functions/huc12.sql
$(PSQL) -f db/functions/hydroshed.sql
$(PSQL) -f db/functions/FWA_SliceWatershedAtPoint.sql
$(PSQL) -f db/functions/FWA_WatershedAtMeasure.sql
$(PSQL) -f db/functions/FWA_WatershedHex.sql
$(PSQL) -f db/functions/FWA_WatershedStream.sql
$(PSQL) -f db/functions/FWA_UpstreamBorderCrossings.sql
$(PSQL) -f db/functions/FWA_IndexPoint.sql
$(PSQL) -f db/functions/FWA_LocateAlong.sql
$(PSQL) -f db/functions/FWA_LocateAlongInterval.sql
$(PSQL) -f db/functions/FWA_UpstreamTrace.sql
$(PSQL) -f db/functions/postgisftw.sql # pg_fs/pg_ts functions
echo "ALTER DATABASE :db SET search_path TO public,whse_basemapping,usgs,hydrosheds" | \
$(PSQL) -v db=$(shell echo $(DATABASE_URL) | cut -d "/" -f 4)
touch $@
Expand Down Expand Up @@ -247,22 +256,6 @@ data/WBD_National_GDB.zip:
/vsizip/vsicurl/https://www.hillcrestgeo.ca/outgoing/public/fwapg/hydrosheds.gpkg.zip
touch $@

# additional FWA functions
.make/fwa_functions: $(SPATIAL) $(SPATIAL_CHUNKED) $(NON_SPATIAL) $(VALUE_ADDED) $(VALUE_ADDED_CHUNKED) .make/fwa_streams_watersheds_lut \
.make/hydrosheds \
.make/wbdhu12
$(PSQL) -f db/functions/FWA_SliceWatershedAtPoint.sql
$(PSQL) -f db/functions/FWA_WatershedAtMeasure.sql
$(PSQL) -f db/functions/FWA_WatershedHex.sql
$(PSQL) -f db/functions/FWA_WatershedStream.sql
$(PSQL) -f db/functions/FWA_UpstreamBorderCrossings.sql
$(PSQL) -f db/functions/FWA_IndexPoint.sql
$(PSQL) -f db/functions/FWA_LocateAlong.sql
$(PSQL) -f db/functions/FWA_LocateAlongInterval.sql
$(PSQL) -f db/functions/FWA_UpstreamTrace.sql
$(PSQL) -f db/functions/postgisftw.sql # pg_fs/pg_ts functions
touch $@

# rather than generating these lookups/datasets (scripts in /extras), download pre-generated data
.make/extras: .make/db
for table in $(EXTRAS) ; do \
Expand Down

0 comments on commit 99a4520

Please sign in to comment.