Modelling of upstream catchment area, shreeve and strahler in Spain and Portugal

The rn layer is based on the rht in France, and the wise layers http://www.mapama.gob.es/es/cartografia-y-sig/ide/directorio_datos_servicios/caracteristicas_wms.aspx in Spain and Portugal https://sniambgeoportal.apambiente.pt/geoportal/catalog/search/resource/details.page?uuid={F199A8DA-ECE8-44FF-B753-37DDD9A70240}. Those have been chained, and the algorythm routing the river from the downstream part has been run.

But to get the surface of the basin upstream, the maximum distance to the source, the shreeve or strahler ranks it has to be routed from the source.

This is done using the BaseEdaRiosRiversegments class which has a method stream_order to run the rivers from the upstream part.

The following code shows examples on how to run the method in Spain :

require("RPostgreSQL")
require("sqldf")
library("sp")
library("rgdal")
library("sf")
source("EDACCM/init.r")
# Creates a class for all rivers in Spain (no basins selected- no emu selected)
rios_surf <- new('BaseEdaRiosRiversegments',
        baseODBC = "baseODBCrios",
        schema = "dbeel_rivers",        
        table = "rn",
        prkey = "idsegment", 
        zonegeo = 'Spain',
        basin=as.character(NULL),
        emu=as.character(NULL))
# Loads all the riversegments from spain including attributes
rios_surf  <- loaddb_all(rios_surf)#2.3 min
#  run the stream order method
rios_surf<-stream_order(rios_surf,silent=TRUE)
# extract a dataset with the columns idsegment, shreeve, strahler, surfacebvm2 (the cumulated surface upstream), and maximum distance source
export <- rios_surf@data[,c("idsegment","shreeve","strahler","surfacebvm2","distancesourcem")]
# save in a temporary table and update the database
sqldf("drop table if exists spain.c_temp")
sqldf("create table spain.c_temp as select * from export")
sqldf("update spain.rna set (shreeve,strahler, surfacebvm2,distancesourcem)= (c_temp.shreeve,c_temp.strahler,c_temp.surfacebvm2,c_temp.distancesourcem) from spain.c_temp
                where c_temp.idsegment=rna.idsegment")
#sqldf("update spain.rna set (shreeve,strahler, surfacebvm2)= (NULL,NULL,NULL)")

The method selects all riversegments and starts from the source. It will stop at a segment untill all ancestors have been found and calculate strahler and shreeve accordingly.

Stahler, shreeve, and distance source

Collection of actual river width data

The data have been collected from electofishing data, a first trial of random sampling using google. Even thought this was designated to concentrate on large water bodies, this sampling very often ended on completely dy lang, in a field, or a dry stream. We have thus chosen a different method with systematic sampling using google and going up the river and trying to measure distance in places where there was no (or the least) influence of downstream dams.

The initial plot shows that a lot of data are missing in some basins, this becomes apparent in a map, a lot of the data for river widht in electrofishing are missing in the central part of Spain and Portugal. We have checked in the source of data, this is not a problem with data integration, we have the surface but not the river width…