mesowx / MesoPy

A Python wrapper for the MesoWest environmental data API
MIT License
59 stars 23 forks source link

Is that possible to add more option for the timeseries function? #27

Open pingyangtiaer opened 6 years ago

pingyangtiaer commented 6 years ago

I found out for the api version 2 has additional options for ASOS data (e.g. noHighFrequecy ) base_url = 'http://api.mesowest.net/v2/stations/' query_type = 'timeseries'

csv_format = '&output=csv'

noHighFrequecy = '&hfmetars=0'

How can I specify those options in the MesoPy to download timeseries data because I didn't see this option in the timeseries function.

joeyoun9 commented 6 years ago

Hi pingyangtiaer,

We will need to update the documentation to express support for the hfmetars argument, however MesoPy itself does support when that argument is given. For example:

>>> from MesoPy import Meso
>>> instance = Meso(token=[YOUR TOKEN])
>>> with_hf = instance.timeseries(stid='kiad',start='201802240000',end='201802260000',hfmetars=1)
>>> len(with_hf['STATION'][0]['OBSERVATIONS']['date_time'])
648
>>> no_hf = instance.timeseries(stid='kiad',start='201802240000',end='201802260000',hfmetars=0)
>>> len(no_hf['STATION'][0]['OBSERVATIONS']['date_time'])
78

So the flag works as expected, but we should add it to the documentation. We will also emphasize in the notes that our comprehensive API documentation at https://mesowest.org/api/mesonet/reference/ is the most accurate source of information about what arguments can be passed to MesoPy functions.

Re CSV support, you can see some other issues regarding adding that support, but at the time MesoPy is designed for using the JSON output from the API to create Python dictionaries, which could not be done with the CSV service. We invite pull requests of sensible ways for MesoPy to integrate CSV responses, however.

carlobianchi89 commented 4 years ago

What about the quality control option? Is it possible to specify it?