Open mrustl opened 2 years ago
Example for download. File format is netCDF
:
url <- "https://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/hyras_de/precipitation/pr_hyras_1_1931_v3-0_de_monsum.nc"
tfile <- basename(url)
download.file(url, tfile, mode = "wb")
hyras_sf <- sf::read_sf(tfile)
#> Warning in CPL_read_ogr(dsn, layer, query, as.character(options), quiet, :
#> GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid
#> argument".
hyras_sf
#> # A tibble: 12 × 2
#> time number_of_station
#> <dbl> <dbl>
#> 1 378 881.
#> 2 1086 879.
#> 3 1794 876.
#> 4 2526 879.
#> 5 3258 883.
#> 6 3990 884.
#> 7 4722 883.
#> 8 5466 886.
#> 9 6198 886.
#> 10 6930 885.
#> 11 7662 888.
#> 12 8394 883.
hyras_raster <- raster::raster(tfile)
#> Lade nötigen Namensraum: ncdf4
hyras_raster
#> class : RasterLayer
#> band : 1 (of 12 bands)
#> dimensions : 1100, 1200, 1320000 (nrow, ncol, ncell)
#> resolution : 1000, 1000 (x, y)
#> extent : 3500000, 4700000, 2100000, 3200000 (xmin, xmax, ymin, ymax)
#> crs : +proj=lcc +lat_0=52 +lon_0=10 +lat_1=35 +lat_2=65 +x_0=4000000 +y_0=2800000 +ellps=GRS80 +units=m +no_defs
#> source : pr_hyras_1_1931_v3-0_de_monsum.nc
#> names : Precipitation
#> z-value : 1931-01-16 18:00:00
#> zvar : pr
Created on 2022-09-22 by the reprex package (v2.0.1)
Actually hyras_de offers these now: https://opendata.dwd.de/climate_environment/CDC/grids_germany/daily/hyras_de/air_temperature_min/ https://opendata.dwd.de/climate_environment/CDC/grids_germany/daily/hyras_de/air_temperature_mean/ https://opendata.dwd.de/climate_environment/CDC/grids_germany/daily/hyras_de/air_temperature_max/ https://opendata.dwd.de/climate_environment/CDC/grids_germany/daily/hyras_de/humidity/ https://opendata.dwd.de/climate_environment/CDC/grids_germany/daily/hyras_de/precipitation/ https://opendata.dwd.de/climate_environment/CDC/grids_germany/daily/hyras_de/radiation_global/ https://opendata.dwd.de/climate_environment/CDC/grids_germany/monthly/hyras_de/precipitation/ https://opendata.dwd.de/climate_environment/CDC/grids_germany/multi_annual/hyras_de/precipitation/
These were for example used here:
I extended
read_daily_data_over_shape()
to support all possible variables. The functionlist_daily_grids_germany_tgz()
tells you which variables are available:Unfortunately, precipitation data are not available on a daily basis.
I added a function
read_monthly_data_over_shape()
that can provide precipitation data as well as further variables. The functionlist_monthly_grids_germany_asc_gz()
informs about possible variables:Finally, our package fhpredict has a function to read (and cut) current precipitation data (RADOLAN), see: https://kwb-r.github.io/fhpredict/articles/tutorial.html#spacially-select-and-aggregate-rain-data
Altogether: Too many different functions that do too many different things...
Originally posted by @hsonne in https://github.com/KWB-R/kwb.dwd/issues/37#issuecomment-1251872323