get_multitable_measurements_from_ssdb | R Documentation |
Get measurements ("measurements" or other "measurements"-like tables) from several tables of a SumavaDB-like spatio-temporal database
get_multitable_measurements_from_ssdb( conn, table_name = get_value_table_names_from_ssdb(conn), ..., return.zoo = FALSE )
conn |
database (preferably PostgresSQL) connection. See output of |
table_name |
vector with names of the tables . Default is |
... |
further arguments for |
return.zoo |
logical. If |
## Not run: library(RPostgreSQL) dbname <- "hydroclimatedb_testing00" conn = dbConnect(PostgreSQL(), dbname = dbname) ### Add weather data from stations from MeteoTrentino network, Trentino, Italy val_smet <- meteotrentino_smet_dataset(smet_files=c("T0175","T0179")) add_locations_into_ssdb(conn,val_smet$locations,new=TRUE) add_measurement_types_into_ssdb(conn,val_smet$measurement_type) add_measurements_into_ssdb(conn,val_smet$measurements) dbDisconnect(conn) conn = dbConnect(PostgreSQL(), dbname = dbname) out <- get_measurements_from_ssdb(conn) out <- get_measurements_from_ssdb(conn,locations_code0="IT-TN_T0179") out <- get_measurements_from_ssdb(conn,locations_code0="IT-TN_T0179", variables_code0=c("SMET_TA","SMET_PINT")) out <- get_measurements_from_ssdb(conn, variables_code0=c("SMET_TA","SMET_PINT")) time_interval <- as.Date(c("2021-03-01","2021-03-31")) out <- get_multitable_measurements_from_ssdb(conn, variables_code0=c("SMET_TA","SMET_PINT"), start_time=time_interval[1],end_time=time_interval[2]) dbDisconnect(conn) ## End(Not run) library(dygraphs) ssdb <- system.file('sumava_extdata/sumava.rds',package="SuSnowDB") %>% readRDS() ####ssdb <- '/home/ecor/activity/2022/local/shiny/SuSnowApp/ext-data/sumava.rds' %>% readRDS() table_name <- get_value_table_names_from_ssdb(ssdb) out2 <- get_multitable_measurements_from_ssdb(ssdb) ## FIND A LOCATION locs <- get_locations_from_ssdb(ssdb) ilocations_filipova <- which(str_detect(locs$location_name,"Filipova")) locs[ilocations_filipova,] out3 <- get_multitable_measurements_from_ssdb(ssdb, locations_code0=locs$location_code0[ilocations_filipova][2]) out4 <- get_multitable_measurements_from_ssdb(ssdb, locations_code0=locs$location_code0[ilocations_filipova][2],return.zoo=TRUE) dygraph(out4[[1]][[1]]) %>% dyRangeSelector() out4_all <- get_multitable_measurements_from_ssdb(ssdb, locations_code0=locs$location_code0[ilocations_filipova],return.zoo=TRUE) str(out4_all$snow_depth_cm$CZ_CHMI_SNOW_C1FILH01_20040401_20070912) dygraph(out4_all$snow_depth_cm$CZ_CHMI_SNOW_C1FILH01_20070913_20191231) %>% dyRangeSelector()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.