Skip to content

quishqa/qualR.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qualR.py

This is qualR package python flavored. It will help you to bring CETESB QUALAR data to your python session.

Installation

You can install qualRpy by cloning this repository and install it via pip:

git clone https://github.com/quishqa/qualR.py.git
pip install .

Or you can install it directly from this repository by doing:

pip install git+https://github.com/quishqa/qualR.py.git

Example of use

Downloading ozone information from Pinheiros air quality station, from January first to january 7th, 2021.

import qualRpy.qualR as qr

user_name = "your_awesome_mail@amail.com"
my_password = "a_mistery_password"

start_date = "01/01/2021"
end_date = "07/01/2021"

o3_code = 63 # you can check it by qr.cetesb_param()
pin_code = 99 # you can check it by qr.ceteb_aqs()

o3_pin = qr.cetesb_retrieve(
  user_name,
  my_password,
  start_date,
  end_date,
  o3_code,
  pin_code
  )

If you want to download a parameter for multiples station you can use dictionary comprehension. Let says that you want to download all O3 information from all the station, you can do the following:

import qualRpy.qualR as qr

user_name = "your_awesome_mail@amail.com"
my_password = "a_mistery_password"

start_date = "01/01/2021"
end_date = "07/01/2021"

o3_code = 63 # you can check it by qr.cetesb_param()
aqs = qr.cetesb_aqs() # Loading all the aqs

o3_aqs = {aqs_name: qr.cetesb_retrieve(user_name, my_password,
                                    start_date, end_date,
                                    o3_code, aqs_code)
          for aqs_name, aqs_code in zip(aqs.name, aqs.code)}

Also, you can use pickle to save the data:

import pickle
with open("o3_aqs_data.pickle", "wb") as my_pickle:
  pickle.dump(o3_aqs, my_pickle)

Acknowledgments

Very thankful to CETESB for make this data available and to the awesome LAPAT-IAG team.

About

This is qualR package python flavored

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages