The loadeR
package contains the function dataInventory
for a quick overview of the data contained in the dataset. In the case of stations data, the main argument to be provided is the path to the directory where the dataset (stations.txt
, variables.txt
and associated data) are stored (see section 3.1. Standard (ASCII) format for station data of the Wiki for details on station data format).
For instance, this is a quick overview of the VALUE ECA&D dataset using dataInventory
. This dataset contains weather data of 86 stations spread over Europe, and is available for download:
download.file("http://meteo.unican.es/work/loadeR/data/VALUE_ECA_86_v2.tar.gz",
destfile = "mydirectory/VALUE_ECA_86_v2.tar.gz")
# Extract files from the tar.gz file
untar("mydirectory/VALUE_ECA_86_v2.tar.gz", exdir = "mydirectory")
# Data inventory
value <- "mydirectory/VALUE_ECA_86_v2"
di <-dataInventory(value)
## [2016-02-18 11:05:49] Doing inventory ...
## [2016-02-18 11:05:50] Done.
The object loaded contains all the necessary information in order to make a call to the loading function loadStationData
, including station codes, geolocation and details on the variable names, units … :
str(di)
## List of 3
## $ Stations :List of 4
## ..$ station_id : chr [1:86] "000012" "000013" "000014" "000015" ...
## ..$ LonLatCoords : num [1:86, 1:2] 15.4 11.4 13 12.9 16.4 ...
## .. ..- attr(*, "dimnames")=List of 2
## .. .. ..$ : chr [1:86] "000012" "000013" "000014" "000015" ...
## .. .. ..$ : chr [1:2] "lon" "lat"
## ..$ times :List of 3
## .. ..$ startDate: POSIXlt[1:1], format: "1961-01-01"
## .. ..$ endDate : POSIXlt[1:1], format: "2010-12-31"
## .. ..$ timeStep :Class 'difftime' atomic [1:1] 24
## .. .. .. ..- attr(*, "units")= chr "hours"
## ..$ other.metadata:List of 3
## .. ..$ name : chr [1:86] "GRAZ" "INNSBRUCK" "SALZBURG" "SONNBLICK" ...
## .. ..$ altitude: int [1:86] 366 577 437 3106 198 100 156 4 139 179 ...
## .. ..$ source : chr [1:86] "ECA&D" "ECA&D" "ECA&D" "ECA&D" ...
## $ Variables :'data.frame': 4 obs. of 3 variables:
## ..$ variable : Factor w/ 4 levels "precip","tmax",..: 1 3 4 2
## ..$ unit : Factor w/ 2 levels "degC","mm": 2 1 1 1
## ..$ missing.code: Factor w/ 1 level "NaN": 1 1 1 1
## $ Summary.stats: NULL
Note that the last element of the inventory, named Summary.stats
is NULL. By default, the inventory will return the basic information, but setting the argument return.stats
to TRUE will return also a table summarizing the characteristics of the data (percentage of missing data, mean, min and max values):
di2 <- dataInventory(value, return.stats= TRUE)
## [2016-02-18 11:05:50] Doing inventory ...
## [2016-02-18 11:05:56] Done.
di2$Summary.stats
## $missing.percent
## precip tmean tmin tmax
## 000012 0.1 0.0 0.0 0.0
## 000013 0.0 0.0 0.0 0.0
## 000014 0.0 0.0 0.0 0.0
## 000015 0.0 0.0 0.0 0.0
## 000016 0.0 0.0 0.0 0.0
## 000017 2.1 100.0 1.8 2.1
## 000021 0.0 0.0 0.0 0.0
## 000028 0.0 0.0 0.0 0.0
## 000029 0.0 0.0 0.0 0.0
## 000030 0.0 0.0 0.0 0.0
## 000032 0.0 0.0 0.0 0.0
## 000038 0.0 0.0 0.0 0.0
## 000039 0.3 0.7 4.1 2.5
## 000042 0.0 0.0 0.0 0.0
## 000048 0.0 0.0 0.0 0.0
## 000054 0.0 0.0 0.0 0.0
## 000058 0.0 0.0 0.0 0.0
## 000059 0.3 0.3 0.3 0.2
## 000062 1.2 0.2 0.1 0.1
## 000063 0.5 1.3 0.7 0.8
## 000107 0.0 0.3 0.1 0.1
## 000113 0.6 5.4 1.4 2.0
## 000173 0.3 0.4 0.4 0.4
## 000175 0.1 0.1 0.1 0.0
## 000176 3.7 0.1 0.5 0.5
## 000177 0.3 0.1 0.1 0.1
## 000190 1.7 0.0 0.0 0.0
## 000191 31.3 2.7 2.7 2.7
## 000192 1.3 0.0 0.1 0.1
## 000194 0.5 0.4 0.3 0.3
## 000195 0.0 0.0 0.0 0.0
## 000200 0.0 0.1 0.1 0.1
## 000201 4.6 0.2 0.2 0.2
## 000212 1.0 0.9 0.7 0.4
## 000214 0.0 0.2 0.7 0.7
## 000217 0.0 0.0 0.0 0.0
## 000219 0.0 0.0 0.0 0.0
## 000229 0.0 0.0 0.0 0.0
## 000231 0.0 0.2 0.2 0.2
## 000232 0.0 0.0 0.0 0.0
## 000234 0.0 0.0 0.0 0.0
## 000236 0.0 0.0 0.0 0.0
## 000239 0.0 0.1 0.0 0.1
## 000242 0.0 0.0 0.0 0.0
## 000243 0.0 0.1 0.1 0.0
## 000244 0.0 0.4 0.1 0.0
## 000272 0.0 1.8 1.8 1.8
## 000274 0.6 100.0 0.9 0.9
## 000275 0.4 100.0 0.6 0.6
## 000322 0.0 0.0 0.0 0.0
## 000330 0.0 0.0 0.0 0.0
## 000332 10.1 10.0 10.0 10.0
## 000333 10.0 10.0 10.0 10.0
## 000339 0.0 0.0 0.0 0.0
## 000349 0.0 0.2 0.2 0.2
## 000350 25.0 0.2 0.2 0.2
## 000351 0.0 0.7 0.2 0.7
## 000355 0.2 0.0 0.1 0.0
## 000450 0.0 0.0 0.0 0.0
## 000462 0.0 0.0 0.0 0.0
## 000465 0.7 0.0 0.0 0.0
## 000468 0.0 0.0 0.0 0.0
## 000483 0.0 0.0 0.0 0.0
## 000708 0.0 0.0 0.0 0.0
## 000800 0.0 0.1 0.0 0.0
## 000951 0.0 0.2 0.2 0.1
## 001009 0.0 0.0 18.0 18.0
## 001020 2.2 2.2 20.2 20.2
## 001051 0.0 0.3 0.2 0.3
## 001394 0.0 0.0 0.0 0.0
## 001427 0.5 0.3 0.3 0.3
## 001662 34.1 34.1 34.1 34.0
## 001684 0.0 0.0 0.0 0.0
## 001686 0.0 0.0 0.0 0.0
## 001687 0.4 0.3 0.2 0.1
## 002006 0.0 0.0 0.0 0.0
## 002062 0.0 0.1 0.1 0.1
## 002762 0.0 0.0 0.0 0.0
## 003919 23.2 26.2 26.2 26.2
## 003946 0.0 0.0 0.0 0.0
## 003991 0.0 0.0 0.0 0.0
## 003994 0.0 0.0 0.0 0.0
## 004002 0.0 0.0 0.0 0.0
## 004004 0.0 0.0 0.0 0.0
## 005585 15.6 19.5 19.5 19.5
## 007682 0.0 0.0 0.0 0.0
##
## $min
## precip tmean tmin tmax
## 000012 0 -15.60 -19.5 -12.2
## 000013 0 -19.40 -24.7 -14.3
## 000014 0 -21.10 -29.0 -16.0
## 000015 0 -31.80 -34.3 -31.2
## 000016 0 -17.30 -19.6 -15.1
## 000017 0 Inf -16.8 -9.7
## 000021 0 -11.80 -17.2 -10.4
## 000028 0 -32.50 -34.3 -30.7
## 000029 0 -36.10 -38.5 -33.5
## 000030 0 -47.40 -49.5 -44.1
## 000032 0 -17.50 -20.4 -14.6
## 000038 0 -11.40 -13.9 -10.0
## 000039 0 -7.20 -15.0 -5.1
## 000042 0 -15.50 -20.6 -13.0
## 000048 0 -21.00 -22.0 -18.6
## 000054 0 -19.90 -24.5 -15.3
## 000058 0 -30.50 -32.7 -28.9
## 000059 0 -1.20 -4.6 1.6
## 000062 0 -15.70 -21.6 -10.0
## 000063 0 0.60 -5.6 3.0
## 000107 0 -18.30 -25.0 -15.7
## 000113 0 -11.05 -20.2 -10.8
## 000173 0 -5.60 -9.4 -4.0
## 000175 0 0.50 -4.8 2.4
## 000176 0 -5.60 -11.0 -2.6
## 000177 0 -10.70 -18.4 -4.4
## 000190 0 -50.00 -51.2 -49.4
## 000191 0 -32.40 -35.6 -30.2
## 000192 0 -17.70 -20.8 -16.7
## 000194 0 -11.70 -13.1 -10.3
## 000195 0 -19.20 -22.0 -16.4
## 000200 0 -26.60 -30.6 -22.5
## 000201 0 -26.30 -27.8 -25.1
## 000212 0 -6.20 -11.6 -2.8
## 000214 0 2.00 -15.9 3.4
## 000217 0 -23.20 -29.8 -16.0
## 000219 0 -18.40 -25.6 -13.0
## 000229 0 -1.90 -7.2 1.4
## 000231 0 4.30 -2.6 6.4
## 000232 0 -16.20 -20.3 -12.2
## 000234 0 -6.60 -10.0 -4.3
## 000236 0 -1.10 -4.5 1.4
## 000239 0 -18.50 -23.3 -14.0
## 000242 0 -6.80 -9.0 -3.8
## 000243 0 -27.00 -30.4 -24.6
## 000244 0 -18.10 -20.8 -15.2
## 000272 0 -12.00 -19.0 -5.9
## 000274 0 Inf -17.6 -6.7
## 000275 0 Inf -11.7 -4.3
## 000322 0 -9.40 -14.7 -7.5
## 000330 0 -30.00 -32.4 -28.5
## 000332 0 -16.80 -23.2 -13.6
## 000333 0 -27.60 -33.3 -20.8
## 000339 0 -39.50 -41.7 -36.9
## 000349 0 -4.40 -11.2 -1.6
## 000350 0 -5.10 -9.3 -2.7
## 000351 0 -8.20 -15.1 -5.1
## 000355 0 -20.60 -23.1 -18.0
## 000450 0 -24.60 -31.8 -18.1
## 000462 0 -22.20 -25.9 -19.6
## 000465 0 -15.80 -25.4 -14.6
## 000468 0 -9.60 -10.7 -8.2
## 000483 0 -21.60 -25.3 -15.0
## 000708 0 -34.10 -39.3 -31.6
## 000800 0 -12.70 -18.6 -8.4
## 000951 0 -23.50 -30.6 -19.3
## 001009 0 -29.90 -35.1 -27.8
## 001020 0 -26.60 -30.5 -22.0
## 001051 0 -14.70 -15.5 -12.5
## 001394 0 -2.20 -7.0 -0.4
## 001427 0 -41.10 -44.0 -38.0
## 001662 0 -15.30 -20.6 -10.5
## 001684 0 -18.90 -28.9 -14.6
## 001686 0 -4.20 -6.6 -1.8
## 001687 0 -23.40 -24.5 -20.0
## 002006 0 -20.70 -27.5 -17.4
## 002062 0 -15.40 -17.5 -12.4
## 002762 0 -18.00 -21.9 -12.1
## 003919 0 1.00 -6.0 5.6
## 003946 0 -7.20 -14.8 0.2
## 003991 0 -14.60 -20.6 -12.1
## 003994 0 -13.60 -17.0 -9.8
## 004002 0 -23.00 -28.2 -17.3
## 004004 0 -19.90 -24.4 -17.0
## 005585 0 -36.10 -42.3 -31.5
## 007682 0 -36.70 -41.9 -34.0
##
## $max
## precip tmean tmin tmax
## 000012 84.2 28.3 22.1 36.6
## 000013 92.2 27.7 23.3 37.4
## 000014 116.7 28.9 22.3 37.7
## 000015 102.2 12.7 10.4 15.0
## 000016 84.9 29.1 24.0 37.6
## 000017 60.4 -Inf 24.0 36.2
## 000021 95.8 30.7 25.7 38.2
## 000028 79.3 25.7 22.2 31.2
## 000029 67.6 26.8 21.9 34.2
## 000030 59.7 24.8 19.4 31.3
## 000032 79.0 31.2 22.7 39.9
## 000038 104.2 32.5 25.5 39.5
## 000039 161.3 33.1 28.3 39.7
## 000042 78.5 28.1 21.5 37.6
## 000048 138.5 28.2 25.9 33.1
## 000054 104.8 29.4 21.8 38.6
## 000058 133.9 12.8 11.2 17.6
## 000059 239.3 34.3 26.6 42.9
## 000062 141.1 37.3 27.2 45.4
## 000063 230.1 32.5 29.0 41.0
## 000107 55.5 26.8 19.9 34.8
## 000113 92.3 32.0 21.4 32.2
## 000173 161.2 35.0 29.7 41.1
## 000175 109.6 33.9 29.0 43.6
## 000176 213.0 31.5 26.0 40.6
## 000177 198.0 32.2 27.2 40.0
## 000190 50.5 26.0 19.4 31.6
## 000191 44.8 21.2 17.9 29.7
## 000192 65.5 24.6 22.8 28.0
## 000194 79.1 23.6 21.1 29.3
## 000195 46.2 21.0 16.4 27.0
## 000200 82.9 26.8 21.5 35.1
## 000201 73.9 27.3 23.1 33.5
## 000212 71.9 30.9 23.9 39.5
## 000214 118.4 33.9 28.1 41.8
## 000217 71.0 31.2 23.1 40.2
## 000219 126.4 31.7 24.4 42.2
## 000229 119.1 33.9 26.0 44.8
## 000231 151.0 34.3 28.8 44.2
## 000232 150.0 25.8 20.6 31.8
## 000234 167.7 30.3 25.2 38.6
## 000236 177.0 32.4 25.4 43.6
## 000239 85.0 29.0 21.3 38.6
## 000242 176.8 28.3 24.1 37.1
## 000243 186.7 17.6 15.6 20.8
## 000244 103.1 27.4 21.0 36.0
## 000272 95.0 21.5 17.2 29.8
## 000274 87.9 -Inf 20.6 35.1
## 000275 54.9 -Inf 16.9 24.5
## 000322 82.6 31.8 24.3 39.5
## 000330 40.3 19.3 16.6 26.8
## 000332 141.0 28.4 21.6 37.2
## 000333 81.0 27.6 21.2 35.5
## 000339 47.0 25.9 21.3 32.5
## 000349 65.0 21.4 16.9 26.3
## 000350 210.0 26.0 19.4 33.6
## 000351 72.8 25.6 19.9 34.8
## 000355 520.0 25.4 22.2 32.7
## 000450 70.4 30.4 25.5 38.3
## 000462 85.7 26.3 23.9 33.8
## 000465 77.5 27.0 21.7 33.2
## 000468 64.9 23.7 21.1 28.7
## 000483 158.0 30.4 23.5 36.9
## 000708 84.7 25.8 20.0 32.3
## 000800 83.0 31.8 24.5 40.7
## 000951 136.7 31.8 24.8 40.1
## 001009 84.7 26.9 21.2 35.2
## 001020 79.8 27.4 22.5 34.7
## 001051 103.6 25.4 23.4 31.6
## 001394 218.0 29.0 23.0 39.4
## 001427 60.1 22.5 16.4 29.5
## 001662 79.3 27.5 20.9 37.2
## 001684 141.0 26.6 22.8 37.0
## 001686 159.0 31.9 28.4 37.5
## 001687 186.0 22.9 21.0 27.6
## 002006 154.5 24.8 21.0 28.2
## 002062 201.0 32.1 27.1 38.5
## 002762 97.8 30.6 22.7 40.2
## 003919 106.7 32.1 27.1 41.4
## 003946 73.4 31.8 24.8 42.2
## 003991 91.9 27.6 20.8 37.9
## 003994 65.6 25.5 22.1 31.3
## 004002 121.8 25.2 18.4 34.9
## 004004 56.6 28.6 21.3 39.0
## 005585 78.8 22.9 17.9 32.1
## 007682 48.4 25.4 20.0 33.0
##
## $mean
## precip tmean tmin tmax
## 000012 2.312892 10.1183551 5.5967419 14.604014
## 000013 2.414858 9.7767550 4.7117512 14.807299
## 000014 3.235949 9.4389278 4.7383419 14.104184
## 000015 4.683269 -5.3202771 -7.5743402 -3.045329
## 000016 1.748146 10.6711149 6.7015825 14.602229
## 000017 2.315013 NaN 6.8632735 14.132720
## 000021 2.421323 11.9328058 8.3110010 15.885418
## 000028 1.738895 5.6512156 2.6432209 8.725101
## 000029 1.723114 3.0393106 -1.3725700 7.122343
## 000030 1.407705 -0.5686234 -5.3926076 3.852776
## 000032 2.011812 11.4366553 6.9099660 15.941117
## 000038 1.739475 12.0958712 8.5864144 15.601331
## 000039 1.474632 15.2597188 10.5698224 19.829939
## 000042 1.907820 9.2670956 5.2074362 13.248932
## 000048 3.244420 6.8843500 3.8227631 10.571903
## 000054 1.601265 9.0425051 5.1694873 13.507821
## 000058 5.601117 -4.4990582 -6.9062589 -1.695953
## 000059 2.976650 17.5745565 12.1389722 21.935117
## 000062 1.161428 15.8425075 8.9742162 21.515008
## 000063 1.902031 18.0225280 13.9761480 21.339803
## 000107 2.189574 8.1331347 5.2657290 11.156045
## 000113 1.496716 9.9819801 5.8205856 11.344964
## 000173 2.632045 14.4729632 10.7188448 18.229109
## 000175 1.140982 16.8368006 11.9772847 21.699600
## 000176 2.339645 15.4020502 10.1644182 20.667243
## 000177 2.169947 13.0901754 8.2594375 17.919211
## 000190 1.027997 -1.8748275 -6.9155384 2.749080
## 000191 1.167586 1.7867635 -1.9324669 5.971810
## 000192 2.013425 7.7599430 6.2424611 9.864433
## 000194 3.241819 7.7134665 6.0493932 9.533363
## 000195 1.587523 1.6997125 -0.3128163 3.797376
## 000200 1.724775 6.8084795 3.0593017 10.828468
## 000201 2.110021 7.4734324 4.5940041 10.545326
## 000212 2.110916 12.3667256 6.8951381 18.030530
## 000214 2.111291 17.0869849 13.1702365 21.147037
## 000217 1.608281 10.6392482 5.5681689 16.467944
## 000219 1.669929 10.6881557 5.5075841 16.865962
## 000229 1.298319 16.7174734 10.0086245 23.426240
## 000231 1.560366 18.2555385 13.5096059 23.001515
## 000232 3.675660 6.4993100 2.8844212 10.114801
## 000234 4.244858 13.2629230 10.2777078 16.248330
## 000236 1.481809 17.3598292 11.8842843 22.785823
## 000239 2.217561 10.1286889 6.1470279 14.773926
## 000242 4.344406 12.2456234 8.6981760 16.476204
## 000243 6.872987 -1.4120375 -3.8172648 1.321381
## 000244 3.090790 9.0735792 5.6388901 13.392475
## 000272 4.444234 7.2006105 3.5495735 11.123044
## 000274 1.731048 NaN 6.4974039 14.185183
## 000275 2.213953 NaN 5.0462607 10.605509
## 000322 1.877582 11.7938712 7.5176790 16.016106
## 000330 1.230497 0.1801309 -3.5559334 3.971179
## 000332 1.839626 7.8861463 4.5801168 11.199647
## 000333 1.504864 7.7208227 3.4748053 12.072432
## 000339 1.586984 1.6214489 -2.3920545 5.482767
## 000349 3.274578 8.3419557 5.5922473 11.115089
## 000350 2.379167 10.2620756 7.4885799 13.057353
## 000351 1.649138 9.5446899 5.9010429 13.143556
## 000355 5.591219 4.9620884 2.3256739 7.577215
## 000450 1.756079 8.7874548 3.4828058 14.848609
## 000462 2.288506 8.0084492 4.8056401 11.340779
## 000465 1.421966 7.1701511 3.9961340 10.307852
## 000468 1.994716 9.4406253 7.7253477 11.122571
## 000483 1.814297 9.1285182 5.5003176 13.139853
## 000708 1.627297 4.3222703 0.1344322 8.364892
## 000800 1.769628 13.3923338 8.6385483 18.144118
## 000951 1.587285 9.8116079 5.3327939 15.165057
## 001009 1.706381 6.2847552 2.6636194 10.497856
## 001020 1.633764 6.7242010 2.9919753 11.041660
## 001051 2.702387 7.1151923 4.2394481 10.954875
## 001394 5.103724 12.5987510 7.9375315 17.259227
## 001427 1.671293 -0.9207942 -5.8543417 3.648786
## 001662 1.663926 9.9798156 4.7234845 15.908085
## 001684 3.767337 8.8338736 3.3000767 14.557272
## 001686 2.005355 15.6752409 13.0398478 20.472659
## 001687 5.321376 3.7959155 1.1130418 7.177929
## 002006 4.959139 3.2244606 0.8886540 5.954600
## 002062 1.160059 11.9267664 8.6815546 15.631228
## 002762 2.259857 10.4970403 6.1654309 15.123053
## 003919 1.165785 16.3882026 10.4495032 22.327050
## 003946 1.087022 14.2112857 7.7073814 20.715765
## 003991 1.778984 9.4021794 5.3941737 13.625632
## 003994 1.453592 8.2511335 6.0656828 10.670321
## 004002 4.880380 6.3955481 1.4418903 12.375966
## 004004 1.777385 8.5745920 4.4543643 13.236984
## 005585 2.252986 2.4284966 -2.8856735 7.803122
## 007682 1.433545 2.4122276 -2.1011172 6.380728
A more concise summary of the available stations can be obtained using the stationInfo
command. By default, it also returns a map with the locations of the available stations, labelled by their identification codes.
stationInfo(value)
## [2016-02-18 11:05:56] Doing inventory ...
## [2016-02-18 11:05:56] Done.
## stationID longitude latitude name altitude
## 1 000012 15.45000 47.0831 GRAZ 366
## 2 000013 11.40000 47.2667 INNSBRUCK 577
## 3 000014 13.00000 47.8000 SALZBURG 437
## 4 000015 12.95000 47.0500 SONNBLICK 3106
## 5 000016 16.35000 48.2331 WIEN 198
## 6 000017 4.36640 50.8000 UCCLE 100
## 7 000021 15.97810 45.8167 ZAGREB-GRIC 156
## 8 000028 24.94780 60.1750 HELSINKI-KAISANIEMI 4
## 9 000029 25.67830 62.4019 JYVASKYLA-LENTOASEMA 139
## 10 000030 26.63310 67.3658 SODANKYLA 179
## 11 000032 2.36670 47.0667 BOURGES 161
## 12 000038 2.33670 48.8231 PARIS-14E 75
## 13 000039 5.22670 43.4417 MARSEILLE-MARIGNANE 5
## 14 000042 8.79920 53.0464 BREMEN 4
## 15 000048 11.01170 47.8017 HOHENPEISSENBERG 977
## 16 000054 13.06390 52.3833 POTSDAM 81
## 17 000058 10.98670 47.4219 ZUGSPITZE 2964
## 18 000059 19.91670 39.6167 CORFU 11
## 19 000062 22.45000 39.6500 LARISSA 72
## 20 000063 21.70000 36.8331 METHONI 51
## 21 000107 8.31670 56.7667 VESTERVIG 18
## 22 000113 10.60000 55.8500 TRANEBJERG 11
## 23 000173 9.18920 45.4717 MILAN 150
## 24 000175 9.05000 39.2331 CAGLIARI 21
## 25 000176 12.58310 41.7831 ROMA-CIAMPINO 105
## 26 000177 10.86670 45.3831 VERONA-VILLAFRANCA 68
## 27 000190 25.50310 69.4667 KARASJOK 129
## 28 000191 9.05000 62.1000 KJOEREMSGRENDE 626
## 29 000192 10.53000 59.0267 FAERDER 6
## 30 000194 4.87810 59.3078 UTSIRA 55
## 31 000195 31.08440 70.3669 VARDOE 14
## 32 000200 23.83310 54.8831 KAUNAS 77
## 33 000201 21.06670 55.7331 KLAIPEDA 6
## 34 000212 -6.73310 41.8000 BRAGANCA 690
## 35 000214 -9.15000 38.7167 LISBOA-GEOFISICA 77
## 36 000217 21.35000 46.1331 ARAD 116
## 37 000219 26.08310 44.5167 BUCURESTI-BANEASA 90
## 38 000229 -6.82920 38.8831 BADAJOZ-TALAVERALAREAL 185
## 39 000231 -4.48810 36.6667 MALAGA 7
## 40 000232 -4.01030 40.7806 NAVACERRADA 1894
## 41 000234 -2.03920 43.3075 SAN-SEBASTIAN-IGUELDO 251
## 42 000236 0.49139 40.8206 TORTOSA-OBSERVATORIO-DEL-EBRO 44
## 43 000239 7.58310 47.5500 BASEL-BINNINGEN 316
## 44 000242 8.96670 46.0000 LUGANO 300
## 45 000243 9.35000 47.2500 SAENTIS 2502
## 46 000244 8.56670 47.3831 ZUERISWITZERLAND 556
## 47 000272 -3.20000 55.3167 ESKDALEMUIR 242
## 48 000274 -1.26670 51.7667 OXFORD 63
## 49 000275 -3.08310 58.4500 WICK 36
## 50 000322 -1.73310 48.0667 RENNES 36
## 51 000330 9.28310 62.1167 FOKSTUA 952
## 52 000332 17.53310 54.7500 LEBA 2
## 53 000333 22.25000 52.2500 SIEDLCE 152
## 54 000339 24.14390 65.8269 HAPARANDA 5
## 55 000349 -6.32000 58.3300 STORNOWAY 9
## 56 000350 -4.53310 53.2500 VALLEY 11
## 57 000351 0.52389 53.1658 WADDINGTON 68
## 58 000355 3.58310 44.1167 MONT-AIGOUAL 1567
## 59 000450 24.15000 45.8000 SIBIU 444
## 60 000462 11.99420 57.7158 GOTEBORG 5
## 61 000465 18.33310 57.6667 VISBY 42
## 62 000468 7.89310 54.1764 HELGOLAND 4
## 63 000483 13.75580 51.1292 DRESDEN-KLOTZSCHE 227
## 64 000708 23.50060 60.8139 JOKIOINEN-JOKIOISTEN 104
## 65 000800 1.37810 43.6231 TOULOUSE-BLAGNAC 151
## 66 000951 27.63310 47.1667 IASI 102
## 67 001009 24.76670 56.2000 BIRZAI 60
## 68 001020 23.51670 54.2331 LAZDIJAI 133
## 69 001051 7.41670 62.2333 TAFJORD 15
## 70 001394 -8.41060 42.8878 SANTIAGO-DE-COMPOSTELA 370
## 71 001427 17.00000 66.3797 JACKVIK 430
## 72 001662 7.33310 46.2167 SION 482
## 73 001684 15.36670 44.5500 GOSPIC 564
## 74 001686 16.45000 43.1667 HVAR 20
## 75 001687 14.98310 44.8167 ZAVIZAN 1594
## 76 002006 10.62000 51.8000 BROCKEN 1142
## 77 002062 28.63000 44.2200 CONSTANTA 13
## 78 002762 8.33080 48.9733 RHEINSTETTEN 116
## 79 003919 2.73670 39.5606 PALMA-DE-MALLORCA 8
## 80 003946 -3.55560 40.4667 MADRID-BARAJAS 609
## 81 003991 8.65060 50.6008 GIESSEN-WETTENBERG 203
## 82 003994 13.43670 54.6817 ARKONA 42
## 83 004002 10.27670 47.3989 OBERSTDORF 806
## 84 004004 12.10310 49.0433 REGENSBURG 365
## 85 005585 13.26000 61.1700 SALEN 360
## 86 007682 25.09250 64.6833 SIIKAJOKI-REVONLAHTI 48
## source
## 1 ECA&D
## 2 ECA&D
## 3 ECA&D
## 4 ECA&D
## 5 ECA&D
## 6 ECA&D
## 7 ECA&D
## 8 ECA&D
## 9 ECA&D
## 10 ECA&D
## 11 ECA&D
## 12 ECA&D
## 13 ECA&D
## 14 ECA&D
## 15 ECA&D
## 16 ECA&D
## 17 ECA&D
## 18 ECA&D
## 19 ECA&D
## 20 ECA&D
## 21 ECA&D
## 22 ECA&D
## 23 ECA&D
## 24 ECA&D
## 25 ECA&D
## 26 ECA&D
## 27 ECA&D
## 28 ECA&D
## 29 ECA&D
## 30 ECA&D
## 31 ECA&D
## 32 ECA&D
## 33 ECA&D
## 34 ECA&D
## 35 ECA&D
## 36 ECA&D
## 37 ECA&D
## 38 ECA&D
## 39 ECA&D
## 40 ECA&D
## 41 ECA&D
## 42 ECA&D
## 43 ECA&D
## 44 ECA&D
## 45 ECA&D
## 46 ECA&D
## 47 ECA&D
## 48 ECA&D
## 49 ECA&D
## 50 ECA&D
## 51 ECA&D
## 52 ECA&D
## 53 ECA&D
## 54 ECA&D
## 55 ECA&D
## 56 ECA&D
## 57 ECA&D
## 58 ECA&D
## 59 ECA&D
## 60 ECA&D
## 61 ECA&D
## 62 ECA&D
## 63 ECA&D
## 64 ECA&D
## 65 ECA&D
## 66 ECA&D
## 67 ECA&D
## 68 ECA&D
## 69 ECA&D
## 70 ECA&D
## 71 ECA&D
## 72 ECA&D
## 73 ECA&D
## 74 ECA&D
## 75 ECA&D
## 76 ECA&D
## 77 ECA&D
## 78 ECA&D
## 79 ECA&D
## 80 ECA&D
## 81 ECA&D
## 82 ECA&D
## 83 ECA&D
## 84 ECA&D
## 85 ECA&D
## 86 ECA&D
The function loadStationData
is the interface to acces observational datasets. There are several ways in which observations data can be queried. The most common cases are next presented.
Given the station codes provided by the inventory, it is possible to retrieve a time series for a selected station or several time series for several stations directly by the identification codes. This will load summer temperature data (JJA) for the period 1981-2000 for two stations: San Sebastian-Igueldo and Madrid-Barajas:
example1 <- loadStationData(dataset = value,
var="tmax",
stationID = c("000234", "003946"),
season = 6:8,
years = 1981:2000)
## [2016-02-18 11:05:57] Loading data ...
## [2016-02-18 11:05:58] Retrieving metadata ...
## [2016-02-18 11:05:58] Done.
str(example1)
## List of 5
## $ Variable:List of 1
## ..$ varName: chr "tmax"
## $ Data : num [1:1840, 1:2] 29 22.4 15.2 18.2 23 20 27.4 28.8 17.6 16.8 ...
## ..- attr(*, "dimensions")= chr [1:2] "time" "station"
## $ xyCoords: num [1:2, 1:2] -2.04 -3.56 43.31 40.47
## ..- attr(*, "dimnames")=List of 2
## .. ..$ : chr [1:2] "000234" "003946"
## .. ..$ : chr [1:2] "longitude" "latitude"
## $ Dates :List of 2
## ..$ start: chr [1:1840] "1981-06-01 00:00:00" "1981-06-02 00:00:00" "1981-06-03 00:00:00" "1981-06-04 00:00:00" ...
## ..$ end : chr [1:1840] "1981-06-02 00:00:00" "1981-06-03 00:00:00" "1981-06-04 00:00:00" "1981-06-05 00:00:00" ...
## $ Metadata:List of 4
## ..$ station_id: int [1:2] 234 3946
## ..$ name : chr [1:2] "SAN-SEBASTIAN-IGUELDO" "MADRID-BARAJAS"
## ..$ altitude : int [1:2] 251 609
## ..$ source : chr [1:2] "ECA&D" "ECA&D"
Alternatively, we can choose a location by its coordinates. From the stationInfo
output, we know the geographical coordinates of the San Sebastian-Igueldo (-2.03920, 43.3075). We can introduce these coordinates in the lonLim
and latLim
arguments. Note that it is not necessary to specify all the decimals, as the function will take care of finding the closest station to the given coordinate:
example2 <- loadStationData(dataset = value,
var="tmax",
lonLim = -2.03,
latLim = 43.3,
season = 6:8,
years = 1981:2000)
## [2016-02-18 11:05:58] Closest station located at 0.0119 spatial units from the specified [lonLim,latLim] coordinate
## [2016-02-18 11:05:59] Loading data ...
## [2016-02-18 11:06:00] Retrieving metadata ...
## [2016-02-18 11:06:00] Done.
str(example2)
## List of 5
## $ Variable:List of 1
## ..$ varName: chr "tmax"
## $ Data : num [1:1840, 1] 29 22.4 15.2 18.2 23 20 27.4 28.8 17.6 16.8 ...
## ..- attr(*, "dimensions")= chr [1:2] "time" "station"
## $ xyCoords: num [1, 1:2] -2.04 43.31
## ..- attr(*, "dimnames")=List of 2
## .. ..$ : chr "000234"
## .. ..$ : chr [1:2] "longitude" "latitude"
## $ Dates :List of 2
## ..$ start: chr [1:1840] "1981-06-01 00:00:00" "1981-06-02 00:00:00" "1981-06-03 00:00:00" "1981-06-04 00:00:00" ...
## ..$ end : chr [1:1840] "1981-06-02 00:00:00" "1981-06-03 00:00:00" "1981-06-04 00:00:00" "1981-06-05 00:00:00" ...
## $ Metadata:List of 4
## ..$ station_id: int 234
## ..$ name : chr "SAN-SEBASTIAN-IGUELDO"
## ..$ altitude : int 251
## ..$ source : chr "ECA&D"
A particular case of selection by coordinates is when all data within a given bounding box is desired. In this case, the lonLim
and latLim
arguments are filled with a vector of length two, defining the corners of the bounding box. For instance, running the next example, MARSEILLE-MARIGNANE, CAGLIARI, NAVACERRADA, SAN-SEBASTIAN-IGUELDO, etc. are loaded.
example3 <- loadStationData(dataset = value,
var="tmax",
lonLim = c(-5,10),
latLim = c(37,45),
season = 6:8,
years = 1981:2000)
## [2016-02-18 11:06:01] Loading data ...
## [2016-02-18 11:06:01] Retrieving metadata ...
## [2016-02-18 11:06:01] Done.
str(example3)
## List of 5
## $ Variable:List of 1
## ..$ varName: chr "tmax"
## $ Data : num [1:1840, 1:9] 30.4 27.8 25 22.2 27.2 30.1 28.1 28.2 30.3 31.2 ...
## ..- attr(*, "dimensions")= chr [1:2] "time" "station"
## $ xyCoords: num [1:9, 1:2] 5.227 9.05 -4.01 -2.039 0.491 ...
## ..- attr(*, "dimnames")=List of 2
## .. ..$ : chr [1:9] "000039" "000175" "000232" "000234" ...
## .. ..$ : chr [1:2] "longitude" "latitude"
## $ Dates :List of 2
## ..$ start: chr [1:1840] "1981-06-01 00:00:00" "1981-06-02 00:00:00" "1981-06-03 00:00:00" "1981-06-04 00:00:00" ...
## ..$ end : chr [1:1840] "1981-06-02 00:00:00" "1981-06-03 00:00:00" "1981-06-04 00:00:00" "1981-06-05 00:00:00" ...
## $ Metadata:List of 4
## ..$ station_id: int [1:9] 39 175 232 234 236 355 800 3919 3946
## ..$ name : chr [1:9] "MARSEILLE-MARIGNANE" "CAGLIARI" "NAVACERRADA" "SAN-SEBASTIAN-IGUELDO" ...
## ..$ altitude : int [1:9] 5 21 1894 251 44 1567 151 8 609
## ..$ source : chr [1:9] "ECA&D" "ECA&D" "ECA&D" "ECA&D" ...
By default, the arguments defining the spatial domain of the query (lonLim
and latLim
or stationID
) are NULL. If none of them is indicated, the function will load all available stations for the time domain selected:
example4 <- loadStationData(dataset = value,
var="tmax",
season = 6:8,
years = 1981:2000)
## [2016-02-18 11:06:02] Loading data ...
## [2016-02-18 11:06:03] Retrieving metadata ...
## [2016-02-18 11:06:03] Done.
str(example4)
## List of 5
## $ Variable:List of 1
## ..$ varName: chr "tmax"
## $ Data : num [1:1840, 1:86] 28.4 29.1 30.1 29.3 21.8 20.4 24.7 27.4 26.8 24.9 ...
## ..- attr(*, "dimensions")= chr [1:2] "time" "station"
## $ xyCoords: num [1:86, 1:2] 15.4 11.4 13 12.9 16.4 ...
## ..- attr(*, "dimnames")=List of 2
## .. ..$ : chr [1:86] "000012" "000013" "000014" "000015" ...
## .. ..$ : chr [1:2] "longitude" "latitude"
## $ Dates :List of 2
## ..$ start: chr [1:1840] "1981-06-01 00:00:00" "1981-06-02 00:00:00" "1981-06-03 00:00:00" "1981-06-04 00:00:00" ...
## ..$ end : chr [1:1840] "1981-06-02 00:00:00" "1981-06-03 00:00:00" "1981-06-04 00:00:00" "1981-06-05 00:00:00" ...
## $ Metadata:List of 4
## ..$ station_id: int [1:86] 12 13 14 15 16 17 21 28 29 30 ...
## ..$ name : chr [1:86] "GRAZ" "INNSBRUCK" "SALZBURG" "SONNBLICK" ...
## ..$ altitude : int [1:86] 366 577 437 3106 198 100 156 4 139 179 ...
## ..$ source : chr [1:86] "ECA&D" "ECA&D" "ECA&D" "ECA&D" ...
The same behaviour can be expected with the time definition of the query. For instance, when season
and/or years
are left to their default value NULL, all months and/or years within the dataset will be returned.
The next example plots the time series retrieved in the example 1. Note that time is defined by lower and upper time bounds, rather than one single verification date:
time <- as.POSIXlt(example1$Dates$start)
#First station
plot(time, example1$Data[,1],, ty = 'l', col = "blue", xlab = "time", ylab = "T (ºC)")
#Second station
lines(time, example1$Data[,2], ty = 'l', col = "red")
legend("bottomright", c("San Sebastian", "Madrid"), col = c("blue", "red"), lty = 1)
title("Tmax - JJA (1981-2000)")
The GSN dataset contains data for a World station network. A subset of the stations with at least the 75% of the data in the period 1979-2012 (374 stations), can be downloaded as follows:
download.file("http://meteo.unican.es/work/loadeR/data/GSN_World.tar.gz",
destfile = "mydirectory/GSN_World.tar.gz")
# Extract files
untar("mydirectory/GSN_World.tar.gz", exdir = "mydirectory")
# Define the path to the data directory
gsn <- "mydirectory/GSN_World"
gsnload <- loadStationData(gsn, var = "tmean")
## [2016-02-18 11:06:07] Loading data ...
## [2016-02-18 11:06:09] Retrieving metadata ...
## [2016-02-18 11:06:10] Done.
library(downscaleR)
x <- getCoordinates(gsnload)$x
y <- getCoordinates(gsnload)$y
plot(x,y, pch = 10, col = "blue")
library(fields)
world(add=TRUE)
The VALUE ECA&D dataset contains weather data of 86 stations spread over Europe, and is available for download:
download.file("http://meteo.unican.es/work/loadeR/data/VALUE_ECA_86_v2.tar.gz",
destfile = "mydirectory/VALUE_ECA_86_v2.tar.gz")
# Extract files from the tar.gz file
untar("mydirectory/VALUE_ECA_86_v2.tar.gz", exdir = "mydirectory")
# Data inventory
value <- "mydirectory/VALUE_ECA_86_v2"
valueload <- loadStationData(value, var = "tmean")
## [2016-02-18 11:06:11] Loading data ...
## [2016-02-18 11:06:12] Retrieving metadata ...
## [2016-02-18 11:06:12] Done.
library(downscaleR)
x <- getCoordinates(valueload)$x
y <- getCoordinates(valueload)$y
plot(x,y, pch = 10, col = "blue")
library(fields)
world(add=TRUE)
```
print(sessionInfo())
## R version 3.2.3 (2015-12-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 14.04.3 LTS
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=es_ES.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=es_ES.UTF-8 LC_NAME=es_ES.UTF-8
## [9] LC_ADDRESS=es_ES.UTF-8 LC_TELEPHONE=es_ES.UTF-8
## [11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=es_ES.UTF-8
##
## attached base packages:
## [1] grid stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] downscaleR_0.9-0 downscaleR.java_1.1-0 fields_8.3-6
## [4] maps_3.0.2 spam_1.3-0 loadeR_0.2-0
## [7] loadeR.java_1.1-0 rJava_0.9-8
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.0 knitr_1.10.5 magrittr_1.5
## [4] MASS_7.3-44 munsell_0.4.2 evd_2.3-0
## [7] colorspace_1.2-6 lattice_0.20-31 plyr_1.8.3
## [10] stringr_1.0.0 CircStats_0.2-4 tools_3.2.3
## [13] parallel_3.2.3 nnet_7.3-11 dtw_1.17-1
## [16] htmltools_0.2.6 abind_1.4-3 yaml_2.1.13
## [19] digest_0.6.8 akima_0.5-12 formatR_1.2
## [22] bitops_1.0-6 RCurl_1.95-4.7 evaluate_0.7
## [25] rmarkdown_0.6.1 sp_1.1-0 proxy_0.4-15
## [28] stringi_0.4-1 scales_0.2.5 boot_1.3-17
## [31] verification_1.42