R¶
R is a common programming language for data analysis and visualization. R provides easy access to various statiscal analysis libraries. We are going to use the R libraries: sf to load features, dplyr for data manipulation, and
Install Requirements
[ ]:
install.packages("sf")
install.packages("dplyr")
Import Requirements
[1]:
library(sf)
library(dplyr)
oapi <- "http://pygeoapi/pygeoapi" # jupyter is run through docker
#oapi = http://localhost:8999/pygeoapi # jupyter is run on host machine
Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Stations¶
[2]:
stations <- read_sf(paste0(oapi,"/collections/stations/items?f=json"))
print(stations)
Simple feature collection with 7 features and 5 fields
Geometry type: POINT
Dimension: XYZ
Bounding box: xmin: 33.67305 ymin: -15.84052 xmax: 35.27428 ymax: -9.92951
z_range: zmin: 618 zmax: 1288
Geodetic CRS: WGS 84
# A tibble: 7 × 6
wigos_id name url status id geometry
<chr> <chr> <chr> <chr> <int> <POINT [°]>
1 0-454-2-AWSLOBI LOBI AWS http… opera… 65618 Z (34.07244 -14.39528 12…
2 0-454-2-AWSKAYEREKERA KAYEREKERA http… opera… 91840 Z (33.67305 -9.92951 848)
3 0-454-2-AWSMALOMO MALOMO http… opera… 91873 Z (33.83727 -13.14202 10…
4 0-454-2-AWSNKHOMA NKHOMA UNI… http… opera… 91875 Z (34.10468 -14.04422 12…
5 0-454-2-AWSTOLEZA TOLEZA http… opera… 91880 Z (34.955 -14.948 764)
6 0-454-2-AWSNAMITAMBO NAMITAMBO http… opera… 91885 Z (35.27428 -15.84052 80…
7 0-454-2-AWSBALAKA BALAKA http… opera… 91893 Z (34.96667 -14.98333 61…
Discovery Metadata¶
[3]:
discovery_metadata <- read_sf(paste0(oapi,"/collections/discovery-metadata/items"))
print(discovery_metadata)
Simple feature collection with 1 feature and 13 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 32.68817 ymin: -16.8013 xmax: 35.7719 ymax: -9.230599
Geodetic CRS: WGS 84
# A tibble: 1 × 14
identifier externalId title description themes providers language type extent
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 data.core… "[ { \"sc… Surf… Surface we… "[ { … "[ { \"n… en data… "{ \"…
# … with 5 more variables: created <date>, rights <chr>,
# X_metadata.anytext <chr>, id <chr>, geometry <POLYGON [°]>
Observations¶
[4]:
malawi_obs <- read_sf(paste0(oapi,"/collections/data.core.observations-surface-land.mw.FWCL.landFixed/items"))
print(malawi_obs)
Simple feature collection with 10 features and 7 fields
Geometry type: POINT
Dimension: XYZ
Bounding box: xmin: 35.27 ymin: -15.84 xmax: 35.27 ymax: -15.84
z_range: zmin: 806 zmax: 806
Geodetic CRS: WGS 84
# A tibble: 10 × 8
identifier phenomenonTime resultTime wigos_station_i… metadata
<chr> <dttm> <dttm> <chr> <chr>
1 WIGOS_0-45… 2021-07-07 14:55:00 2022-02-21 14:15:14 0-454-2-AWSNAMI… "[ { \"…
2 WIGOS_0-45… 2021-07-07 15:55:00 2022-02-21 14:15:14 0-454-2-AWSNAMI… "[ { \"…
3 WIGOS_0-45… 2021-07-07 16:55:00 2022-02-21 14:15:14 0-454-2-AWSNAMI… "[ { \"…
4 WIGOS_0-45… 2021-07-07 17:55:00 2022-02-21 14:15:14 0-454-2-AWSNAMI… "[ { \"…
5 WIGOS_0-45… 2021-07-07 18:55:00 2022-02-21 14:15:14 0-454-2-AWSNAMI… "[ { \"…
6 WIGOS_0-45… 2021-07-07 19:55:00 2022-02-21 14:15:15 0-454-2-AWSNAMI… "[ { \"…
7 WIGOS_0-45… 2021-07-07 20:55:00 2022-02-21 14:15:15 0-454-2-AWSNAMI… "[ { \"…
8 WIGOS_0-45… 2021-07-07 21:55:00 2022-02-21 14:15:15 0-454-2-AWSNAMI… "[ { \"…
9 WIGOS_0-45… 2021-07-07 22:55:00 2022-02-21 14:15:15 0-454-2-AWSNAMI… "[ { \"…
10 WIGOS_0-45… 2021-07-07 23:55:00 2022-02-21 14:15:15 0-454-2-AWSNAMI… "[ { \"…
# … with 3 more variables: observations <chr>, id <chr>, geometry <POINT [°]>
[ ]: