-
Notifications
You must be signed in to change notification settings - Fork 1
Charter 23 : Manual testing of interpolating surface temperature and pressure values from CAMS data to use in converting OpenAQ ppm to µg m³
Richard Strange edited this page Aug 2, 2024
·
1 revision
Testing ticket Convert PPM measurements from OpenAQ data based on CAMS air density.
- We have an automated test that verifies the values µg/m³ generated from ppm values using a specified
estimated_surface_pressure_pa
andestimated_temperature_k
- A manual verification is needed to ensure that the
estimated_surface_pressure_pa
andestimated_temperature_k
are correct. They are generated by interpolating data from a given GRIB file, for a given latitude, longitude and time.
- Run the
test__convert_ppm_to_ugm3_and_store__only_no2_so2_o3
test in theopen_aq_etl_tests.py
- This seeds the
in_situ
database with a document that ppm values for pollutants -
latitude_berlin
= 52.52437,longitude_berlin
= 13.41053 anddate_utc
= "2024-06-26T13:10:20+00:00" - the test uses GRIB data from 2024-06-26_12
- This seeds the
- Manually open the single-level and multi-level gribs for 2024-06-26_12 using
xr.open_dataset()
. - Convert each dataset to dataframes, and then to csv files
- Filter the data in each csv by latitude and longitude and time to isolate the nearest values to the specified latitude, longitude and time
- Create a dataset using this data
time = pd.date_range(start="2024-06-26T12:00", end="2024-06-26T15:00", periods=2)
latitude = [52.4, 52.8]
longitude = [13.2, 13.6]
sp_data = np.array(
[
[[100615.58, 100467.2], [100665.58, 100518.2]],
[[100717.58, 100573.2], [100667.58, 100521.2]],
]
)
t_data = np.array(
[
[[301.6565, 302.48303], [301.52954, 302.23303]],
[[300.83423, 301.23108], [300.50415, 300.93225]],
]
)
ds = xr.Dataset(
{
"sp": (["latitude", "longitude", "time"], sp_data),
"t": (["latitude", "longitude", "time"], t_data),
},
{
"latitude": latitude,
"longitude": longitude,
"time": time,
},
)
- export the dataset to csv again to ensure this is identical to the original dataset
- interpolate the data based on the target latitude, longitude and time for the Berlin document
interpolated_data = ds.interp(
latitude=52.52437,
longitude=13.41053,
time="2024-06-26T13:10:20+00:00",
method="linear",
)
- print the interpolated data.to_dict()
- compare pressure and temperature to that stored in the database
- the databse values match the manual interpolation for this data to at least 4 decimal places
Getting Started and Overview
- Product Description
- Roles and Responsibilities
- User Roles and Goals
- Architectural Design
- Iterations
- Decision Records
- Summary Page Explanation
- Deployment Guide
- Working Practices
- Q&A
Investigations and Notebooks
- CAMs Schema
- Exploratory Notebooks
- Forecast ETL Process
- In Situ air pollution data sources
- Notebook: OpenAQ data overview
- Notebook: Unit conversion
- Data Archive Considerations
Manual Test Charters
- Charter 1 (Comparing ECMWF forecast to database values)
- Charter 2 (Backend performance)
- Charter 3 (Forecast range implementation)
- Charter 4 (In situ bad data)
- Charter 5 (Filtering ppm units)
- Charter 7 (Forecast API input validation)
- Charter 8 (Forecast API database sizes)
- Charter 9 (Measurements summary API input validation)
- Charter 10 (Seeding bad data)
- Charter 11 ()Measurements API input validation
- Charter 12 (Validating echart plot accuracy)
- Charter 13 (Explore UI after data outage)
- Charter 14 (City page address)
- Charter 15 (BugFix diff 0 calculation)
- Charter 16 (City page chart data mocking)
- Charter 17 (Summary table logic)
- Charter 18 (AQI chart colour banding)
- Charter 19 (City page screen sizes)
- Charter 20 (Date picker)
- Charter 21 (Graph consistency)
- Charter 22 (High measurement values)
- Charter 23 (ppm -> µg m³)
- Charter 24 (Textures API input validation)
- Charter 25 (Graph line colours)
- Charter 26 (Fill in gaps in forecast)
- Charter 27 (Graph behaviour with mock data)
- Charter 28 (Summary table accuracy)
- Re‐execute: Charter 28
- Charter 29 (Fill in gaps in situ)
- Charter 30 (Forecast window)
- Charter 31 (UI screen sizes)