As I do not know how you created https://tsb-opendata.s3.eu-central-1.amazonaws.com/bezirksgrenzen/bezirksgrenzen.shp.zip here is how I would do it using kwb.dwd::read_monthly_data_over_shape().
The problem is how the statistics are calculated if the provided shapefile contains multiple polygons. In my test case
#remotes::install_github("kwb-r/kwb.dwd@add-shape-arg")
### https://inbo.github.io/tutorials/tutorials/spatial_wfs_services/
#install.packages("ows4R")
library(magrittr)
library(ggplot2)
library(dplyr)
#>
#> Attache Paket: 'dplyr'
#> Die folgenden Objekte sind maskiert von 'package:stats':
#>
#> filter, lag
#> Die folgenden Objekte sind maskiert von 'package:base':
#>
#> intersect, setdiff, setequal, union
### Helper Function
plot_bezirke <- function(layer) {
layer %>%
dplyr::select(.data$namgem,
.data$geometry) %>%
plot()
}
### Open-Data: get Berliner Stadtbezirke from WFS Service
wfs_regions <- "https://fbinter.stadt-berlin.de/fb/wfs/data/senstadt/s_wfs_alkis_bezirk"
regions_client <- ows4R::WFSClient$new(wfs_regions,
serviceVersion = "2.0.0",
logger = "INFO")
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
#> Loading IANA mime types...
#> No encoding supplied: defaulting to UTF-8.
#> [ows4R][INFO] OWSGetCapabilities - Fetching https://fbinter.stadt-berlin.de/fb/wfs/data/senstadt/s_wfs_alkis_bezirk?service=WFS&version=2.0.0&request=GetCapabilities
#> | | | 0% | |======================================================================| 100%
url <- httr::parse_url(wfs_regions)
url$query <- list(service = "wfs",
version = "2.0.0",
request = "GetFeature",
typenames = "fis:s_wfs_alkis_bezirk",
srsName = "EPSG:4258")
request <- httr::build_url(url)
# Works
response <- httr::GET(request)
content <- httr::content(response)
xml2::write_xml(content, "content.xml")
berlin_bezirke <- sf::read_sf("content.xml")
plot_bezirke(berlin_bezirke)

shape_file <- "berlin_bezirke.shp"
sf::write_sf(berlin_bezirke, shape_file )
### Does not work, only returns stats for whole city of Berlin
pp_monthly_bezirke <- kwb.dwd::read_monthly_data_over_shape(
variable = "precipitation",
from = "202101",
to = "202102",
shape = berlin_bezirke,
quiet = TRUE)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (2.84s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (2.72s)
pp_monthly_bezirke
#> file date year month
#> 1 grids_germany_monthly_precipitation_202101.asc.gz 2021-01-01 2021 1
#> 2 grids_germany_monthly_precipitation_202102.asc.gz 2021-02-01 2021 2
#> mean sd min max n_values
#> 1 48.59086 2.873999 39 57 897
#> 2 33.10702 1.966723 26 41 897
# My Workaround (but extremely in-efficient)
pp_monthly_berlin_list <- stats::setNames(lapply(
seq_len(nrow(berlin_bezirke)), function(i) {
kwb.dwd::read_monthly_data_over_shape(
variable = "precipitation",
from = "202101",
to = "202102",
shape = berlin_bezirke[i,],
quiet = TRUE)}), berlin_bezirke$namgem)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (2.03s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (1.81s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (1.68s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (1.72s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (1.90s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (1.87s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (1.75s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (1.32s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (1.72s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (1.66s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (1.28s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (1.62s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (1.69s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (2.35s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (2.28s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (2.22s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (2.27s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (1.68s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (1.74s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (1.52s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (1.87s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (1.42s)
#> ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/: ok.
#> 1/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/01_Jan/: ok.
#> 2/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/02_Feb/: ok.
#> 3/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/03_Mar/: ok.
#> 4/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/04_Apr/: ok.
#> 5/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/05_May/: ok.
#> 6/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/06_Jun/: ok.
#> 7/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/07_Jul/: ok.
#> 8/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/08_Aug/: ok.
#> 9/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/09_Sep/: ok.
#> 10/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/10_Oct/: ok.
#> 11/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/11_Nov/: ok.
#> 12/12: ftp://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/precipitation/12_Dec/: ok.
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202101/grids_germany_monthly_precipitation_202101.asc.gz
#> File already available: C:\Users\mrustl\AppData\Local\Temp/R_kwb.dwd/grids_germany_monthly_precipitation_202102/grids_germany_monthly_precipitation_202102.asc.gz
#> Masking and cropping grids_germany_monthly_precipitation_202101 ... ok. (1.88s)
#> Masking and cropping grids_germany_monthly_precipitation_202102 ... ok. (2.26s)
pp_monthly_berlin <- dplyr::bind_rows(pp_monthly_berlin_list,
.id = "bezirk")
pp_monthly_berlin
#> bezirk file
#> 1 Pankow grids_germany_monthly_precipitation_202101.asc.gz
#> 2 Pankow grids_germany_monthly_precipitation_202102.asc.gz
#> 3 Treptow-Köpenick grids_germany_monthly_precipitation_202101.asc.gz
#> 4 Treptow-Köpenick grids_germany_monthly_precipitation_202102.asc.gz
#> 5 Tempelhof-Schöneberg grids_germany_monthly_precipitation_202101.asc.gz
#> 6 Tempelhof-Schöneberg grids_germany_monthly_precipitation_202102.asc.gz
#> 7 Friedrichshain-Kreuzberg grids_germany_monthly_precipitation_202101.asc.gz
#> 8 Friedrichshain-Kreuzberg grids_germany_monthly_precipitation_202102.asc.gz
#> 9 Steglitz-Zehlendorf grids_germany_monthly_precipitation_202101.asc.gz
#> 10 Steglitz-Zehlendorf grids_germany_monthly_precipitation_202102.asc.gz
#> 11 Lichtenberg grids_germany_monthly_precipitation_202101.asc.gz
#> 12 Lichtenberg grids_germany_monthly_precipitation_202102.asc.gz
#> 13 Charlottenburg-Wilmersdorf grids_germany_monthly_precipitation_202101.asc.gz
#> 14 Charlottenburg-Wilmersdorf grids_germany_monthly_precipitation_202102.asc.gz
#> 15 Marzahn-Hellersdorf grids_germany_monthly_precipitation_202101.asc.gz
#> 16 Marzahn-Hellersdorf grids_germany_monthly_precipitation_202102.asc.gz
#> 17 Spandau grids_germany_monthly_precipitation_202101.asc.gz
#> 18 Spandau grids_germany_monthly_precipitation_202102.asc.gz
#> 19 Reinickendorf grids_germany_monthly_precipitation_202101.asc.gz
#> 20 Reinickendorf grids_germany_monthly_precipitation_202102.asc.gz
#> 21 Mitte grids_germany_monthly_precipitation_202101.asc.gz
#> 22 Mitte grids_germany_monthly_precipitation_202102.asc.gz
#> 23 Neukölln grids_germany_monthly_precipitation_202101.asc.gz
#> 24 Neukölln grids_germany_monthly_precipitation_202102.asc.gz
#> date year month mean sd min max n_values
#> 1 2021-01-01 2021 1 47.02885 1.2263826 44 51 104
#> 2 2021-02-01 2021 2 32.47115 0.8238759 31 36 104
#> 3 2021-01-01 2021 1 52.25731 1.5081706 46 57 171
#> 4 2021-02-01 2021 2 33.42105 1.1367762 29 36 171
#> 5 2021-01-01 2021 1 48.00000 1.6252721 45 51 54
#> 6 2021-02-01 2021 2 31.20370 2.4136376 26 35 54
#> 7 2021-01-01 2021 1 47.71429 0.6436503 47 49 21
#> 8 2021-02-01 2021 2 30.61905 0.9206623 29 32 21
#> 9 2021-01-01 2021 1 49.63725 2.8486204 44 57 102
#> 10 2021-02-01 2021 2 35.67647 2.3929011 30 41 102
#> 11 2021-01-01 2021 1 48.13208 1.6295084 45 51 53
#> 12 2021-02-01 2021 2 31.77358 0.7243435 30 33 53
#> 13 2021-01-01 2021 1 46.51562 1.5117759 44 50 64
#> 14 2021-02-01 2021 2 33.68750 1.3671312 32 37 64
#> 15 2021-01-01 2021 1 49.03279 2.3378567 45 55 61
#> 16 2021-02-01 2021 2 32.26230 1.3025826 30 35 61
#> 17 2021-01-01 2021 1 47.38043 1.6497911 44 54 92
#> 18 2021-02-01 2021 2 34.34783 1.4019984 33 40 92
#> 19 2021-01-01 2021 1 45.79121 2.0194415 39 49 91
#> 20 2021-02-01 2021 2 33.06593 1.4437774 29 37 91
#> 21 2021-01-01 2021 1 45.45000 1.5012815 41 48 40
#> 22 2021-02-01 2021 2 31.80000 0.5163978 31 33 40
#> 23 2021-01-01 2021 1 50.88636 1.5732637 48 54 44
#> 24 2021-02-01 2021 2 31.56818 1.6480817 29 34 44
Created on 2022-09-20 by the reprex package (v2.0.1)
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.1 (2022-06-23 ucrt)
#> os Windows 10 x64 (build 19044)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate German_Germany.utf8
#> ctype German_Germany.utf8
#> tz Europe/Berlin
#> date 2022-09-20
#> pandoc 2.18 @ C:/Program Files/RStudio/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> ! package * version date (UTC) lib source
#> D archive 1.1.5 2022-05-06 [1] CRAN (R 4.2.1)
#> askpass 1.1 2019-01-13 [1] CRAN (R 4.2.0)
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.2.0)
#> bitops 1.0-7 2021-04-24 [1] CRAN (R 4.2.0)
#> class 7.3-20 2022-01-16 [2] CRAN (R 4.2.1)
#> classInt 0.4-7 2022-06-10 [1] CRAN (R 4.2.0)
#> cli 3.3.0 2022-04-25 [1] CRAN (R 4.2.0)
#> codetools 0.2-18 2020-11-04 [2] CRAN (R 4.2.1)
#> colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.0)
#> curl 4.3.2 2021-06-23 [1] CRAN (R 4.2.0)
#> DBI 1.1.3 2022-06-18 [1] CRAN (R 4.2.0)
#> digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.0)
#> dplyr * 1.0.9 2022-04-28 [1] CRAN (R 4.2.0)
#> e1071 1.7-11 2022-06-07 [1] CRAN (R 4.2.0)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.0)
#> evaluate 0.15 2022-02-18 [1] CRAN (R 4.2.0)
#> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.0)
#> geometa 0.7 2022-08-19 [1] CRAN (R 4.2.1)
#> ggplot2 * 3.3.6 2022-05-03 [1] CRAN (R 4.2.0)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0)
#> gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.1)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0)
#> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.2.0)
#> httr 1.4.4 2022-08-17 [1] CRAN (R 4.2.1)
#> jsonlite 1.8.0 2022-02-22 [1] CRAN (R 4.2.0)
#> KernSmooth 2.23-20 2021-05-03 [2] CRAN (R 4.2.1)
#> keyring 1.3.0 2021-11-29 [1] CRAN (R 4.2.1)
#> knitr 1.39 2022-04-26 [1] CRAN (R 4.2.0)
#> kwb.dwd 0.2.0 2022-09-20 [1] Github (kwb-r/kwb.dwd@5a73cc2)
#> kwb.utils 0.13.0 2022-08-23 [1] Github (KWB-R/kwb.utils@2a6faaa)
#> lattice 0.20-45 2021-09-22 [2] CRAN (R 4.2.1)
#> lifecycle 1.0.2 2022-09-09 [1] CRAN (R 4.2.1)
#> lubridate 1.8.0 2021-10-07 [1] CRAN (R 4.2.0)
#> magrittr * 2.0.3 2022-03-30 [1] CRAN (R 4.2.0)
#> mime 0.12 2021-09-28 [1] CRAN (R 4.2.0)
#> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.0)
#> openssl 2.0.2 2022-05-24 [1] CRAN (R 4.2.0)
#> ows4R 0.3-1 2022-08-19 [1] CRAN (R 4.2.1)
#> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0)
#> proxy 0.4-27 2022-06-09 [1] CRAN (R 4.2.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.2.0)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0)
#> raster 3.5-15 2022-01-22 [1] CRAN (R 4.2.0)
#> Rcpp 1.0.9 2022-07-08 [1] CRAN (R 4.2.1)
#> RCurl 1.98-1.7 2022-06-09 [1] CRAN (R 4.2.0)
#> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.2.1)
#> rgdal 1.5-32 2022-05-09 [1] CRAN (R 4.2.0)
#> rlang 1.0.5 2022-08-31 [1] CRAN (R 4.2.1)
#> rmarkdown 2.14 2022-04-25 [1] CRAN (R 4.2.0)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.2.0)
#> scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.1)
#> sf 1.0-7 2022-03-07 [1] CRAN (R 4.2.0)
#> sp 1.5-0 2022-06-05 [1] CRAN (R 4.2.0)
#> stringi 1.7.6 2021-11-29 [1] CRAN (R 4.2.0)
#> stringr 1.4.1 2022-08-20 [1] CRAN (R 4.2.1)
#> terra 1.5-34 2022-06-09 [1] CRAN (R 4.2.0)
#> tibble 3.1.7 2022-05-03 [1] CRAN (R 4.2.0)
#> tidyselect 1.1.2 2022-02-21 [1] CRAN (R 4.2.0)
#> units 0.8-0 2022-02-05 [1] CRAN (R 4.2.0)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0)
#> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.2.0)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0)
#> xfun 0.31 2022-05-10 [1] CRAN (R 4.2.0)
#> XML 3.99-0.10 2022-06-09 [1] CRAN (R 4.2.1)
#> xml2 1.3.3 2021-11-30 [1] CRAN (R 4.2.0)
#> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.0)
#>
#> [1] C:/Users/mrustl/AppData/Local/R/win-library/4.2
#> [2] C:/Program Files/R/R-4.2.1/library
#>
#> D ── DLL MD5 mismatch, broken installation.
#>
#> ──────────────────────────────────────────────────────────────────────────────
As I do not know how you created
https://tsb-opendata.s3.eu-central-1.amazonaws.com/bezirksgrenzen/bezirksgrenzen.shp.ziphere is how I would do it usingkwb.dwd::read_monthly_data_over_shape().The problem is how the statistics are calculated if the provided shapefile contains multiple polygons. In my test case
Created on 2022-09-20 by the reprex package (v2.0.1)
Session info