Read the data from RData

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_RData()

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
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', 'RData', year=2018)
[4]:
date NO NO2 NOXasNO2 site code
0 2018-01-01 0.83099 11.88590 13.16008 Borehamwood Meadow Park BDMP
1 2018-01-02 4.54542 25.94125 32.91080 Borehamwood Meadow Park BDMP
2 2018-01-03 0.45567 6.42378 7.12245 Borehamwood Meadow Park BDMP
3 2018-01-04 1.71805 17.93630 20.57061 Borehamwood Meadow Park BDMP
4 2018-01-05 9.42881 30.02306 44.48037 Borehamwood Meadow Park BDMP
... ... ... ... ... ... ...
360 2018-12-27 73.50291 31.44885 144.15175 Borehamwood Meadow Park BDMP
361 2018-12-28 32.39124 30.84101 80.50689 Borehamwood Meadow Park BDMP
362 2018-12-29 3.01088 19.15533 23.77195 Borehamwood Meadow Park BDMP
363 2018-12-30 2.68686 16.69486 20.81466 Borehamwood Meadow Park BDMP
364 2018-12-31 0.31389 8.33177 8.81307 Borehamwood Meadow Park BDMP

365 rows × 6 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_RData()

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
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', 'RData', year=2018)
[8]:
date O3 NO NO2 NOXasNO2 site code
0 2018-01-01 58.92582 0.35858 4.08157 4.63138 High Muffles HM
1 2018-01-02 54.69188 0.32505 8.03221 8.53062 High Muffles HM
2 2018-01-03 74.20609 0.31064 1.47330 1.94961 High Muffles HM
3 2018-01-04 58.83227 0.35530 4.92558 5.47037 High Muffles HM
4 2018-01-05 52.63312 0.38510 4.91850 5.50898 High Muffles HM
... ... ... ... ... ... ... ...
360 2018-12-27 43.76512 0.52885 1.62471 2.43561 High Muffles HM
361 2018-12-28 48.66471 0.57100 2.17362 3.04914 High Muffles HM
362 2018-12-29 63.12164 0.62033 3.39774 4.34889 High Muffles HM
363 2018-12-30 57.56365 0.52792 2.20239 3.01186 High Muffles HM
364 2018-12-31 69.08520 0.49333 1.40954 2.16597 High Muffles HM

365 rows × 7 columns

[ ]: