Read the data from AURN
Read the site data by a bounds of longitude and latitude
Users can give a bounds of longitude and latitude to read the site data.
Load the OBSAQ package and Define the range
[1]:
import obsaq
lon_min = -1
lon_max = 2
lat_min = 50
lat_max = 55
bounds=[lon_min, lon_max, lat_min, lat_max]
Get the station metadata
NOTE: This is the all station information and the next step will choose the stations by bounds.
[2]:
meta = obsaq.meta()
site_table = meta.get_metadata('aurn')
Choose the stations by range
[3]:
final_sites = meta.get_site(bounds=bounds)
final_sites.head(5)
Site is selected by bounds: [-1, 2, 50, 55]
[3]:
site_id | site_name | location_type | latitude | longitude | parameter | Parameter_name | start_date | end_date | ratified_to | zone | agglomeration | local_authority | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rownames | |||||||||||||
364 | BDMP | Borehamwood Meadow Park | Urban Background | 51.662332 | -0.270001 | NO | Nitric oxide | 2017-10-01 | ongoing | 2023-12-31 | Eastern | NaN | Hertsmere |
365 | BDMP | Borehamwood Meadow Park | Urban Background | 51.662332 | -0.270001 | NO2 | Nitrogen dioxide | 2017-10-01 | ongoing | 2023-12-31 | Eastern | NaN | Hertsmere |
366 | BDMP | Borehamwood Meadow Park | Urban Background | 51.662332 | -0.270001 | NOXasNO2 | Nitrogen oxides as nitrogen dioxide | 2017-10-01 | ongoing | 2023-12-31 | Eastern | NaN | Hertsmere |
367 | BDMP | Borehamwood Meadow Park | Urban Background | 51.662332 | -0.270001 | PM10 | PM10 particulate matter (Hourly measured) | 2022-03-22 | ongoing | 2023-12-31 | Eastern | NaN | Hertsmere |
368 | BDMP | Borehamwood Meadow Park | Urban Background | 51.662332 | -0.270001 | PM2.5 | PM2.5 particulate matter (Hourly measured) | 2022-03-22 | ongoing | 2023-12-31 | Eastern | NaN | Hertsmere |
Choose a site by site_id
and read it directly
[4]:
obsaq.read_sites('BDMP', 'aurn', year=2018)
https://uk-air.defra.gov.uk/data_files/site_data/BDMP_2018.csv
[4]:
Date | time | Nitric oxide | status | unit | Nitrogen dioxide | status.1 | unit.1 | Nitrogen oxides as nitrogen dioxide | status.2 | unit.2 | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | 01-01-2018 | 01:00 | 0.25166 | R | ugm-3 | 4.75500 | R | ugm-3 | 5.14087 | R | ugm-3 |
1 | 01-01-2018 | 02:00 | 0.12583 | R | ugm-3 | 6.87575 | R | ugm-3 | 7.06869 | R | ugm-3 |
2 | 01-01-2018 | 03:00 | 0.28312 | R | ugm-3 | 5.78313 | R | ugm-3 | 6.21723 | R | ugm-3 |
3 | 01-01-2018 | 04:00 | 0.22020 | R | ugm-3 | 3.75899 | R | ugm-3 | 4.09663 | R | ugm-3 |
4 | 01-01-2018 | 05:00 | 0.18874 | R | ugm-3 | 3.27707 | R | ugm-3 | 3.56647 | R | ugm-3 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
8755 | 31-12-2018 | 20:00 | 0.28836 | R | ugm-3 | 12.08703 | R | ugm-3 | 12.52918 | R | ugm-3 |
8756 | 31-12-2018 | 21:00 | 0.18023 | R | ugm-3 | 8.29340 | R | ugm-3 | 8.56974 | R | ugm-3 |
8757 | 31-12-2018 | 22:00 | 0.10814 | R | ugm-3 | 5.52928 | R | ugm-3 | 5.69508 | R | ugm-3 |
8758 | 31-12-2018 | 23:00 | 0.07209 | R | ugm-3 | 4.77096 | R | ugm-3 | 4.88150 | R | ugm-3 |
8759 | 31-12-2018 | 24:00 | 0.00000 | R | ugm-3 | 4.17640 | R | ugm-3 | 4.17640 | R | ugm-3 |
8760 rows × 11 columns
Read data by a point of longitude and latitude
Users can give a point of longitude and latitude to read the station data.
[5]:
import obsaq
lon = 0.0
lat = 55.0
point = [lon, lat]
NOTE: This is the all station information and the next step will choose the stations by point.
[6]:
meta = obsaq.meta()
site_table = meta.get_metadata('aurn')
site_table.head(5)
[6]:
site_id | site_name | location_type | latitude | longitude | parameter | Parameter_name | start_date | end_date | ratified_to | zone | agglomeration | local_authority | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rownames | |||||||||||||
1 | ABD | Aberdeen | Urban Background | 57.15736 | -2.094278 | O3 | Ozone | 2003-08-01 | 2021-09-20 | 2021-09-20 | North East Scotland | NaN | Aberdeen City |
2 | ABD | Aberdeen | Urban Background | 57.15736 | -2.094278 | NO | Nitric oxide | 1999-09-18 | 2021-09-20 | 2021-09-20 | North East Scotland | NaN | Aberdeen City |
3 | ABD | Aberdeen | Urban Background | 57.15736 | -2.094278 | NO2 | Nitrogen dioxide | 1999-09-18 | 2021-09-20 | 2021-09-20 | North East Scotland | NaN | Aberdeen City |
4 | ABD | Aberdeen | Urban Background | 57.15736 | -2.094278 | NOXasNO2 | Nitrogen oxides as nitrogen dioxide | 1999-09-18 | 2021-09-20 | 2021-09-20 | North East Scotland | NaN | Aberdeen City |
5 | ABD | Aberdeen | Urban Background | 57.15736 | -2.094278 | SO2 | Sulphur dioxide | 2001-01-01 | 2007-09-30 | 2007-09-30 | North East Scotland | NaN | Aberdeen City |
[7]:
final_sites = meta.get_site(point=point)
final_sites
Site is selected by point: [0.0, 55.0]
[7]:
site_id HM
site_name High Muffles
location_type Rural Background
latitude 54.334497
longitude -0.80882
parameter O3
Parameter_name Ozone
start_date 1987-07-16
end_date ongoing
ratified_to 2023-12-31
zone Yorkshire & Humberside
agglomeration NaN
local_authority Ryedale
Name: 1200, dtype: object
[8]:
obsaq.read_sites('HM', 'aurn', year=2018)
https://uk-air.defra.gov.uk/data_files/site_data/HM_2018.csv
[8]:
Date | time | Nitric oxide | status | unit | Nitrogen dioxide | status.1 | unit.1 | Nitrogen oxides as nitrogen dioxide | status.2 | unit.2 | Ozone | status.3 | unit.3 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 01-01-2018 | 01:00 | 0.36708 | R | ugm-3 | 1.00358 | R | ugm-3 | 1.56642 | R | ugm-3 | 65.32591 | R | ugm-3 |
1 | 01-01-2018 | 02:00 | 0.28550 | R | ugm-3 | 1.06600 | R | ugm-3 | 1.50376 | R | ugm-3 | 65.85810 | R | ugm-3 |
2 | 01-01-2018 | 03:00 | 0.27531 | R | ugm-3 | 1.22261 | R | ugm-3 | 1.64474 | R | ugm-3 | 67.15531 | R | ugm-3 |
3 | 01-01-2018 | 04:00 | 0.24472 | R | ugm-3 | 1.26951 | R | ugm-3 | 1.64474 | R | ugm-3 | 66.40692 | R | ugm-3 |
4 | 01-01-2018 | 05:00 | 0.30590 | R | ugm-3 | 2.16255 | R | ugm-3 | 2.63159 | R | ugm-3 | 66.20735 | R | ugm-3 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
8755 | 31-12-2018 | 20:00 | 0.30417 | R | ugm-3 | 1.38387 | R | ugm-3 | 1.85025 | R | ugm-3 | 70.34843 | R | ugm-3 |
8756 | 31-12-2018 | 21:00 | 0.23657 | R | ugm-3 | 1.27605 | R | ugm-3 | 1.63879 | R | ugm-3 | 70.39832 | R | ugm-3 |
8757 | 31-12-2018 | 22:00 | 0.33796 | R | ugm-3 | 1.17346 | R | ugm-3 | 1.69166 | R | ugm-3 | 69.89939 | R | ugm-3 |
8758 | 31-12-2018 | 23:00 | 0.50694 | R | ugm-3 | 1.44300 | R | ugm-3 | 2.22030 | R | ugm-3 | 68.85165 | R | ugm-3 |
8759 | 31-12-2018 | 24:00 | 0.40556 | R | ugm-3 | 1.70419 | R | ugm-3 | 2.32603 | R | ugm-3 | 67.85380 | R | ugm-3 |
8760 rows × 14 columns