Skip to content

Commit

Permalink
version 0.9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcarslaw authored and cran-robot committed Jun 5, 2023
1 parent bda9b3c commit caa09b7
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 89 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Expand Up @@ -2,8 +2,8 @@ Package: worldmet
Type: Package
Title: Import Surface Meteorological Data from NOAA Integrated Surface
Database (ISD)
Version: 0.9.7
Date: 2023-02-01
Version: 0.9.8
Date: 2023-06-05
Authors@R: c(person("David", "Carslaw", role = c("aut", "cre"), email =
"david.carslaw@york.ac.uk"))
ByteCompile: true
Expand All @@ -13,7 +13,7 @@ Imports: openair, doParallel, parallel, foreach, purrr (>= 1.0.0),
Maintainer: David Carslaw <david.carslaw@york.ac.uk>
Description: Functions to import data from more than 30,000 surface
meteorological sites around the world managed by the National Oceanic and Atmospheric Administration (NOAA) Integrated Surface
Database.
Database (ISD).
License: GPL (>= 2)
URL: https://davidcarslaw.github.io/worldmet/index.html,
http://davidcarslaw.github.io/worldmet/
Expand All @@ -26,7 +26,7 @@ Encoding: UTF-8
RoxygenNote: 7.2.3
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2023-02-06 09:18:53 UTC; davidcarslaw
Packaged: 2023-06-05 14:45:54 UTC; davidcarslaw
Author: David Carslaw [aut, cre]
Repository: CRAN
Date/Publication: 2023-02-06 09:40:02 UTC
Date/Publication: 2023-06-05 18:20:02 UTC
20 changes: 10 additions & 10 deletions MD5
@@ -1,23 +1,23 @@
fce929d09801d2a99b40be4cb1a410df *DESCRIPTION
8970e835ddc4c19f837aedaa8f954387 *DESCRIPTION
43a7ad08847df11fab073807f57346d0 *NAMESPACE
8256cb7380ec0b09fc5e8f8d59ef80be *R/exportADMS.R
9e5d78085494e5494b03852b983d8e59 *R/getMeta.R
beaf9eeabd0907681968fe05eb3df352 *R/metNOAA.R
161089d9fffca49fba9e8f7b2ade7690 *R/getMeta.R
b0ce45dbbee7ae14a5470adb87e63ee2 *R/metNOAA.R
780d73ad423b237cd9f4e1b880a0aa64 *R/weatherCodes.R
36f6273361297af46d509419ede5a528 *R/worldmet-package.R
cfa9de55cfaeade84545e1fa3cae7ffc *R/worldmet-package.R
b180ead8dd8cc9b27765d4074096bc8b *R/zzz.R
18ad71d31fdafed4f6ecace46a430cf8 *README.md
36eb6d242c2bc18e5ab9da8fb53f3e77 *build/vignette.rds
1b91aaf0b64428595d41a5ce7e788fd9 *data/weatherCodes.rda
9c94f8fad708294dd939e81d8ccf574e *README.md
5067550e211e580d682e7b5540d42f97 *build/vignette.rds
91e0d57ec4f8092abc6d8f554dcaa5e6 *data/weatherCodes.rda
3f3c260f9ac8240233528a631dc1b454 *inst/doc/find-sites.R
cc903022f1b0af45d1578ab4372cf728 *inst/doc/find-sites.Rmd
23a0cf9776d50014edebac480b321085 *inst/doc/find-sites.html
b09cb02f5f2cfbb1441277a9aa7b103d *inst/doc/find-sites.html
cd1a31cac01a35d6f98e54b24d8200e0 *man/exportADMS.Rd
84f21841c2bbb1c09c3ffbcf11ec2145 *man/figures/README-map.png
a3e5f595df491dd9e3bd41450301ceb7 *man/figures/README-windRose-1.png
552b0deba61cded2821edc4e7180c182 *man/getMeta.Rd
a72bfe878d2e9d8795a88441e6836baf *man/getMetaLive.Rd
d9a0db336582b1710038de0532d77a7b *man/importNOAA.Rd
608310d48e7810a45b21b0654f66a4ee *man/importNOAA.Rd
0831995a436e217051806cfef137d22b *man/weatherCodes.Rd
f52b3bc35492a37741e36f290bcba99f *man/worldmet-package.Rd
a285f426aa27a2777c5fee31a17448af *man/worldmet-package.Rd
cc903022f1b0af45d1578ab4372cf728 *vignettes/find-sites.Rmd
14 changes: 14 additions & 0 deletions R/getMeta.R
Expand Up @@ -65,6 +65,19 @@ getMeta <- function(site = "heathrow",
## read the meta data

## download the file, else use the package version
# check if url works and exit gracefully if not

# function to fail gracefully if url is down / moved etc.
not_working <- function(url = "https://www1.ncdc.noaa.gov/pub/data/noaa/isd-history.csv"){
test <- try(suppressWarnings(readLines(url, n = 1)), silent = TRUE)
inherits(test, "try-error")
}

if (not_working()) {
message("Meta data currently not available.")
return()

}
meta <- getMetaLive()

# check year
Expand Down Expand Up @@ -284,3 +297,4 @@ getMetaLive <- function(...) {
# meta <- getMeta(end.year = "all")
# usethis::use_data(meta, overwrite = TRUE, internal = TRUE)
# usethis::use_data(meta, overwrite = TRUE)

4 changes: 1 addition & 3 deletions R/metNOAA.R
Expand Up @@ -2,9 +2,7 @@
#'
#' This is the main function to import data from the NOAA Integrated Surface
#' Database (ISD). The ISD contains detailed surface meteorological data from
#' around the world for over 30,000 locations. For general information of the
#' ISD see website.
#'
#' around the world for over 30,000 locations.
#'
#' Note the following units for the main variables:
#'
Expand Down
2 changes: 1 addition & 1 deletion R/worldmet-package.R
Expand Up @@ -11,7 +11,7 @@
#' These data work well with the `openair` package that has been developed to
#' analyse air pollution data.
#'
#' @references For general information of the ISD see website.
#' @references Search for NOAA ISD for more information.
#'
#' @seealso See <https://github.com/davidcarslaw/openair> for information on the
#' related `openair` package.
Expand Down
60 changes: 28 additions & 32 deletions README.md
Expand Up @@ -51,11 +51,10 @@ library(worldmet)

getMeta(site = "heathrow")
#> # A tibble: 1 × 12
#> usaf wban station ctry st call latitude longitude elev(m…¹ begin
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <date>
#> 1 037720 99999 HEATHROW UK <NA> EGLL 51.5 -0.461 25.3 1948-12-01
#> # … with 2 more variables: end <date>, code <chr>, and abbreviated variable
#> # name ¹​`elev(m)`
#> usaf wban station ctry st call latitude longitude `elev(m)` begin
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <date>
#> 1 037720 99999 HEATHR… UK <NA> EGLL 51.5 -0.461 25.3 1948-12-01
#> # ℹ 2 more variables: end <date>, code <chr>
```

Often we have a latitude / longitude of interest. A search can be made
Expand All @@ -70,21 +69,20 @@ marker to obtain the code and other basic information.
info <- getMeta(lat = 40, lon = 116.9)
info
#> # A tibble: 10 × 15
#> usaf wban station ctry st call latit…¹ longi…² elev(…³ begin
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <date>
#> 1 545110 99999 BEIJING - … CH <NA> ZBAA 40.1 117. 35.4 1945-10-31
#> 2 545270 99999 TIANJIN CH <NA> <NA> 39.1 117. 5 1956-08-20
#> 3 545273 99999 BINHAI CH <NA> ZBTJ 39.1 117. 3 1981-11-25
#> 4 545340 99999 TANGSHAN CH <NA> <NA> 39.6 118. 29 1956-08-20
#> 5 544050 99999 HUAILAI CH <NA> <NA> 40.4 116. 538 1956-08-20
#> 6 543080 99999 FENGNING CH <NA> <NA> 41.2 117. 661 1957-06-01
#> 7 544230 99999 CHENGDE CH <NA> <NA> 41.0 118. 423 1956-08-20
#> 8 544360 99999 QINGLONG CH <NA> <NA> 40.4 119. 228 1957-06-02
#> 9 545390 99999 LETING CH <NA> <NA> 39.4 119. 12 1957-06-01
#> 10 546020 99999 BAODING CH <NA> <NA> 38.7 115. 17 1956-08-20
#> # … with 5 more variables: end <date>, code <chr>, longr <dbl>, latr <dbl>,
#> # dist <dbl>, and abbreviated variable names ¹​latitude, ²​longitude,
#> # ³​`elev(m)`
#> usaf wban station ctry st call latitude longitude `elev(m)` begin
#> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <date>
#> 1 5451… 99999 BEIJIN… CH <NA> ZBAA 40.1 117. 35.4 1945-10-31
#> 2 5452… 99999 TIANJIN CH <NA> <NA> 39.1 117. 5 1956-08-20
#> 3 5452… 99999 BINHAI CH <NA> ZBTJ 39.1 117. 3 1981-11-25
#> 4 5453… 99999 TANGSH… CH <NA> <NA> 39.6 118. 29 1956-08-20
#> 5 5440… 99999 HUAILAI CH <NA> <NA> 40.4 116. 538 1956-08-20
#> 6 5430… 99999 FENGNI… CH <NA> <NA> 41.2 117. 661 1957-06-01
#> 7 5442… 99999 CHENGDE CH <NA> <NA> 41.0 118. 423 1956-08-20
#> 8 5443… 99999 QINGLO… CH <NA> <NA> 40.4 119. 228 1957-06-02
#> 9 5453… 99999 LETING CH <NA> <NA> 39.4 119. 12 1957-06-01
#> 10 5460… 99999 BAODING CH <NA> <NA> 38.7 115. 17 1956-08-20
#> # ℹ 5 more variables: end <date>, code <chr>, longr <dbl>, latr <dbl>,
#> # dist <dbl>
```

<img src="man/figures/README-map.png" alt="map of Beijing area" width="75%" />
Expand All @@ -97,20 +95,18 @@ years of interest. For example, to download data for Heathrow Airport in
met_london <- importNOAA(code = "037720-99999", year = 2010)
head(met_london)
#> # A tibble: 6 × 25
#> code station date latit…¹ longi…² elev ws wd air_t…³
#> <fct> <fct> <dttm> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 03772… HEATHR… 2010-01-01 00:00:00 51.5 -0.461 25.3 3.27 17.4 1.03
#> 2 03772… HEATHR… 2010-01-01 01:00:00 51.5 -0.461 25.3 3.1 6.13 0.967
#> 3 03772… HEATHR… 2010-01-01 02:00:00 51.5 -0.461 25.3 3.1 15.6 1.03
#> 4 03772… HEATHR… 2010-01-01 03:00:00 51.5 -0.461 25.3 2.93 17.0 1
#> 5 03772… HEATHR… 2010-01-01 04:00:00 51.5 -0.461 25.3 2.77 0.606 0.267
#> 6 03772… HEATHR… 2010-01-01 05:00:00 51.5 -0.461 25.3 2.43 356. 0.0667
#> # … with 16 more variables: atmos_pres <dbl>, visibility <dbl>,
#> code station date latitude longitude elev ws wd
#> <fct> <fct> <dttm> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 037720-999… HEATHR… 2010-01-01 00:00:00 51.5 -0.461 25.3 3.27 17.4
#> 2 037720-999… HEATHR… 2010-01-01 01:00:00 51.5 -0.461 25.3 3.1 6.13
#> 3 037720-999… HEATHR… 2010-01-01 02:00:00 51.5 -0.461 25.3 3.1 15.6
#> 4 037720-999… HEATHR… 2010-01-01 03:00:00 51.5 -0.461 25.3 2.93 17.0
#> 5 037720-999… HEATHR… 2010-01-01 04:00:00 51.5 -0.461 25.3 2.77 0.606
#> 6 037720-999… HEATHR… 2010-01-01 05:00:00 51.5 -0.461 25.3 2.43 356.
#> # ℹ 17 more variables: air_temp <dbl>, atmos_pres <dbl>, visibility <dbl>,
#> # dew_point <dbl>, RH <dbl>, ceil_hgt <dbl>, cl_1 <dbl>, cl_2 <dbl>,
#> # cl_3 <dbl>, cl <dbl>, cl_1_height <dbl>, cl_2_height <dbl>,
#> # cl_3_height <dbl>, precip_12 <dbl>, precip_6 <dbl>, pwc <chr>,
#> # precip <dbl>, and abbreviated variable names ¹​latitude, ²​longitude,
#> # ³​air_temp
#> # cl_3_height <dbl>, precip_12 <dbl>, precip_6 <dbl>, pwc <chr>, precip <dbl>
```

A wind rose (for example) can easily be plotted using `openair`:
Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
Binary file modified data/weatherCodes.rda
Binary file not shown.
67 changes: 33 additions & 34 deletions inst/doc/find-sites.html

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions man/importNOAA.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/worldmet-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit caa09b7

Please sign in to comment.