davidcarslaw / openair

Tools for air quality data analysis
https://davidcarslaw.github.io/openair/
GNU General Public License v2.0
307 stars 113 forks source link

importAURN() returning NULL for many sites in the Greater London Area #247

Closed carolinecullinan closed 1 year ago

carolinecullinan commented 3 years ago

Hi there,

Firstly, thank you for this awesome package!

Recently, I have tried to use the importAURN() function to collect air quality data for all the sites in the Greater London Area with the following code:

`gla_codes = c('THUR', 'BEX', 'TH2', 'WA2', 'BDMP', 'SUT3', 'SUT1', 'A3', 'TED', 'TED2', 'BRN', 'HS1', 'HIL', 'HRL', 'HARR', 'BREN', 'HR3', 'SK1', 'LON6', 'BY1', 'BY2', 'LW1', 'HP1', 'SK2', 'SK5', 'HG1', 'HK4', 'HG2', 'HG4', 'CA1', 'ISL', 'SK1', 'MY1', 'KC1', 'EA8', 'CLL2', 'LON5', 'SK5', 'SK2', 'CRD', 'CRD2', 'WL', 'CLL', 'HORS', 'BRI')

data_2020_2021 <- importAURN(site = gla_codes, year = c(2020, 2021), meta = TRUE, to_narrow = TRUE) ` I am confused because the result returns NULL for all but 18 of those sites. I have checked with the real time air quality monitoring (https://aqicn.org/city/london/) and there should be data for all of these sites. Perhaps I am using the wrong codes?

Any help would be much appreciated!

Thank you,

Caroline

davidcarslaw commented 3 years ago

Hi

It might be worth having a look at the meta data for these sites. See https://bookdown.org/david_carslaw/openair/sec-importAURN.html

In this case you can see all the details by:

> meta <- importMeta(source = "aurn", all = TRUE)
> meta
# A tibble: 2,644 x 13
   code  site  site_type latitude longitude variable Parameter_name start_date          end_date
   <chr> <chr> <chr>        <dbl>     <dbl> <chr>    <chr>          <dttm>              <chr>   
 1 ABD   Aber… Urban Ba…     57.2     -2.09 O3       Ozone          2003-08-01 00:00:00 ongoing 
 2 ABD   Aber… Urban Ba…     57.2     -2.09 NO       Nitric oxide   1999-09-18 00:00:00 ongoing 
 3 ABD   Aber… Urban Ba…     57.2     -2.09 NO2      Nitrogen diox… 1999-09-18 00:00:00 ongoing 
 4 ABD   Aber… Urban Ba…     57.2     -2.09 NOx      Nitrogen oxid… 1999-09-18 00:00:00 ongoing 
 5 ABD   Aber… Urban Ba…     57.2     -2.09 SO2      Sulphur dioxi… 2001-01-01 00:00:00 2007-09…
 6 ABD   Aber… Urban Ba…     57.2     -2.09 CO       Carbon monoxi… 1999-09-18 00:00:00 2007-09…
 7 ABD   Aber… Urban Ba…     57.2     -2.09 PM10     PM10 particul… 1999-09-18 00:00:00 ongoing 
 8 ABD   Aber… Urban Ba…     57.2     -2.09 NV10     Non-volatile … 2009-02-20 00:00:00 2019-11…
 9 ABD   Aber… Urban Ba…     57.2     -2.09 V10      Volatile PM10… 2009-02-20 00:00:00 2019-11…
10 ABD   Aber… Urban Ba…     57.2     -2.09 PM2.5    PM2.5 particu… 2009-02-20 00:00:00 ongoing 
# … with 2,634 more rows, and 4 more variables: ratified_to <dttm>, zone <chr>,
#   agglomeration <chr>, local_authority <chr>

which e.g. shows for the TED site it stopped sometime in 2016 (to be replaced by TED2). Probably the best thing to do if you are after recent data is check the end_date in the data above and where it says 'ongoing' that means the site if still live. I think that is the problem...