5 min read

Access meteorogical observations using worldmet package

David Carslaw (2019) developed R package worldmet, which provides an easy way to access world meteorological data from from the Integrated Surface Database of National Oceanic and Atmospheric Administration (NOAA). The Integrated Surface Database (ISD) consists of global hourly and synoptic observations compiled from numerous sources into a single common ASCII format and common data model.

The database includes over 35,000 stations from around the world, with some stations with data from 1901. We know that ISD is a global database, but the spatial coverage of the stations varies from region to region. The good geographical coverage is evident in North America, Europe, Australia, and parts of Asia. Coverage in the Northern Hemisphere is better than the Southern Hemisphere, and the overall period of record is currently 1901 to present. Some stations have over 50 years of continuous reporting during the latter half of that time period. However, many stations have “breaks” in the period of record (e.g., 40 years of data may be spread over a 70-year period).

##Installation To use the package we first need to install it in the local machine. Installation of worldmet from GitHub is easy using the install_github() from devtools package (Wickham, Hester, and Chang 2019). The chunk below highlight codes for installation of worldmet package.

require(devtools)
install_github('davidcarslaw/worldmet')

For us to use the functions in worldmet, we need to load it into the workspace. We also load the tidyverse package as the chunk below shows.

require(worldmet)
require(dplyr)

Once we have installed and loaded the package into the session, we can now use the functions of the package. To search for meteorological sites, one must search by the name or partial name of the site in upper or lower case. The getMeta function will return all site names that match the search string. The most important information returned is the code, which can then be supplied to the importNOAA function that downloads the data. For example, to search for site “Arusha”:

worldmet::getMeta(site = "arusha")
## # A tibble: 1 x 13
##   USAF  WBAN  STATION CTRY  ST    CALL  latitude longitude `ELEV(M)` BEGIN     
##   <chr> <chr> <chr>   <chr> <chr> <chr>    <dbl>     <dbl>     <dbl> <date>    
## 1 6378~ 99999 ARUSHA  TZ    <NA>  HTAR     -3.37      36.6     1387. 1960-01-11
## # ... with 3 more variables: END <date>, code <chr>, dist <lgl>

Often we have a geographical positions—latitude longitude of interest. With coordinate formatted in decimal degree, we can search for stations that are near to the location. For example running this code: worldmet::getMeta(lat = -6.8, lon = 39.3) will display a map, which shows the location searched by the user (red dot) and markers showing the nearest meteorological stations. Since the map is an interactive, you can simply click on a station marker to obtain the attribute information of the station.

## # A tibble: 10 x 15
##    USAF  WBAN  STATION CTRY  ST    CALL  latitude longitude `ELEV(M)` BEGIN     
##    <chr> <chr> <chr>   <chr> <chr> <chr>    <dbl>     <dbl>     <dbl> <date>    
##  1 6389~ 99999 MWALIM~ TZ    <NA>  HTDA     -6.88      39.2      55.5 1950-02-01
##  2 6387~ 99999 ZANZIB~ TZ    <NA>  HTZA     -6.22      39.2      16.5 1957-01-01
##  3 6384~ 99999 PEMBA   TZ    <NA>  HTPE     -5.26      39.8      24.4 1957-01-01
##  4 6386~ 99999 MOROGO~ TZ    <NA>  HTMG     -6.83      37.6     526   1957-01-01
##  5 6384~ 99999 TANGA   TZ    <NA>  HTTG     -5.09      39.1      39.3 1957-01-01
##  6 6391~ 99999 KILWA ~ TZ    <NA>  HTKI     -8.93      39.5      18   2001-06-17
##  7 6382~ 99999 MOMBAS~ KE    <NA>  HKMO     -4.04      39.6      61   1949-01-21
##  8 6386~ 99999 KONGWA  TZ    <NA>  <NA>     -6.2       36.4    1113   1957-01-01
##  9 6381~ 99999 SAME    TZ    <NA>  HTSE     -4.08      37.7     872   1957-01-01
## 10 6397~ 99999 LINDI   TZ    <NA>  <NA>    -10         39.7      41   1949-01-21
## # ... with 5 more variables: END <date>, code <chr>, longR <dbl>, latR <dbl>,
## #   dist <dbl>

Meteorological stations along coastal areas

The Meteorological stations in Tanzania are monitored by the Tanzania Meteorological Administration (TMA) and has several stations across the country. However, our interest is to get a list of the available stations within the coastal areas of Tanzania.

near.dar = worldmet::getMeta(lat = -6.8, lon = 39.3)

But we are only interested with meteorological stations that are within the coastal areas of Tanzania

tz.coastal.stations = near.dar %>% filter(CTRY == "TZ")

To obtain the data of the particular station, the user must supply a code id for that stations and year or years of interest. For example, to download hourly data for Mwalimu Nyerere Internationla Airport for 2018 (code 638940-99999) use the code in the chunk below:

dar.data = worldmet::importNOAA(code = "638940-99999", year = 2018)

You can have a glimpse of some variables that are in the dataset using the glimpse function

dar.data %>% glimpse()

If you are interested with rainfall data, they you must parse an argument precip = TRUE in the worldmet::importNOAA() function. This return the precipitation data along with the other variables. The chunk below highlight the code for obtaining both air temperature and precipitation from a site in Dar es Salaam. The sample of the data is shown in table ??

dar.temp.rain = worldmet::importNOAA(code = "638940-99999", year = 2015:2018, precip = TRUE, hourly = TRUE)

Cited references

Carslaw, David. 2019. Worldmet: Import Surface Meteorological Data from Noaa Integrated Surface Database (Isd). http://github.com/davidcarslaw/worldmet.

Wickham, Hadley, Jim Hester, and Winston Chang. 2019. Devtools: Tools to Make Developing R Packages Easier. https://CRAN.R-project.org/package=devtools.