Package: pyaro
pyaro - Airquality Reader-interface for ObservationsThe library that solves the mystery of reading airquality measurement databases. (Pronounciation as in French: Poirot)AboutPyaro is an interface which uses a simple access pattern to different air-pollution databases.
The goal of pyro was threefold.A simple interface for different types of air-pollution databasesA programatic interface to these databases easily usable by large applications likePyAerocomEasy extension for air-pollution database providers or programmers giving the users (1. or 2.) direct access
their databases without the need of a new API.A few existing implementations of pyaro can be found atpyaerocom-readers.Installationpython -m pip install 'pyaro@git+https://github.com/metno/pyaro.git'This will install pyaro and all its dependencies (numpy).Usageimportpyaro.timeseriesTEST_FILE="csvReader_testdata.csv"engines=pyaro.list_timeseries_engines()# {'csv_timeseries': <pyaro.csvreader.CSVTimeseriesReader.CSVTimeseriesEngine object at 0x7fcbe67eab00>}print(engines['csv_timeseries'].args)# ('filename', 'columns', 'variable_units', 'csvreader_kwargs', 'filters')print(pyaro.timeseries.filters.list)# immutable dict of all filter-names to filter-classesprint(engines['csv_timeseries'].supported_filters())# list of filter-classes supported by this readerprint(pyaro.timeseries.filters.list)withengines['csv_timeseries'].open(filename=TEST_FILE,filters={'countries':{include=['NO']}})asts:forvarints.variables():# stationsts.data(var).stations# start_timests.data(var).start_times# stop_timests.data(var).end_times# latitudests.data(var).latitudes# longitudests.data(var).longitudes# altitudests.data(var).altitudes# valuests.data(var).values# flagsts.data(var).flags# if pandas is installed, data can be converted to a pandas Dataframedf=pyaro.timeseries_data_to_pd(data)Supported readerscsv_timeseries
Reader for all tables readable with the python csv module.
The reader supports reading from a single local file, with csv-parameters added on the command-line.Usage - csv_timeseriesimportpyaro.timeseriesTEST_FILE="csvReader_testdata.csv"engine=pyaro.list_timeseries_engines()["csv_timeseries"]ts=engine.open(TEST_FILE,filters=[],fill_country_flag=False)print(ts.variables())# stationsts.data('SOx').stations# start_timests.data('SOx').start_times# stop_timests.data('SOx'.end_times# latitudests.data('SOx').latitudes# longitudests.data('SOx').longitudes# altitudests.data('SOx').altitudes# valuests.data('SOx').valuesCOPYRIGHTCopyright (C) 2023  Heiko Klein, Daniel Heinesen, Norwegian Meteorological InstituteThis library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.You should have received a copy of the GNU Lesser General Public
License along with this library; if not, seehttps://www.gnu.org/licenses/