adamancer / pyncei Goto Github PK
View Code? Open in Web Editor NEWUse Python to access data from NOAA's Climate Data Online Web Services v2 API
License: MIT License
Use Python to access data from NOAA's Climate Data Online Web Services v2 API
License: MIT License
Hi Adam,
For certain stations, the data(TMAX) seems incorrect. When I view the data for a specific year for these particular stations using the web tool, I get different data .
For e.g. for the station, RIVERSIDE FIRE STATION 3, CA US (GHCND:USC00047470), I am getting
TMAX in range of 200, which seems incorrect. I get different results when queried from web
(https://www.ncdc.noaa.gov/cdo-web/datasets/GHCND/stations/GHCND:USC00047470/detail).
#Example
from datetime import date
from pyncei.reader import NCEIReader
import datetime as dt
import csv
import pandas as pd
token = '##############'
ncei = NCEIReader(token,encode_queries=False)
mindate = '1970-01-01' # either yyyy-mm-dd or a datetime object
maxdate = dt.datetime.today().strftime("%Y-%m-%d")
datatypes = ['TMAX']
dataset = 'GHCND'
minyear = int(mindate[:4])
year = date.today().year
val='GHCND:USC00047470'
ncei.get_data(dataset=dataset,
station=val,
datatype=datatypes,
startdate=date(1990, 1, 1),
enddate=date(1990, 12, 31))
There are several other stations for which the data seems incorrect.
Thanks
Hi,
I just tried the examples provided but they are returning empty list.
Thanks
File "C:\Users\slowt\Anaconda3\envs\tide\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 4, in
from pyncei import NCEIReader
File "C:\Users\slowt\Anaconda3\envs\tide\lib\site-packages\pyncei-0.12-py3.8.egg\pyncei_init_.py", line 1, in
from .reader import NCEIReader
File "C:\Users\slowt\Anaconda3\envs\tide\lib\site-packages\pyncei-0.12-py3.8.egg\pyncei\reader.py", line 701
print textwrap.fill(s, initial_indent=' ' * indent,
^
SyntaxError: invalid syntax
There is a good chance this is a user error, but I am running into the following error, specifically when pulling GHCND
and PRCP
data. If I follow the example and generate a response, there appears to be data, but using to_dataframe()
throws the following error for some stations:
File "/PycharmProjects/Regenerate/.venv/lib/python3.12/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-15-7a2ac4d974af>", line 1, in <module> response.to_dataframe() File "/PycharmProjects/Regenerate/.venv/lib/python3.12/site-packages/pyncei/bot.py", line 1068, in to_dataframe df = pd.DataFrame(self.values()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/PycharmProjects/Regenerate/.venv/lib/python3.12/site-packages/pandas/core/frame.py", line 832, in __init__ data = list(data) ^^^^^^^^^^ File "/PycharmProjects/Regenerate/.venv/lib/python3.12/site-packages/pyncei/bot.py", line 1010, in values yield {k: val[k] for k in self.key_order if k in keys} ~~~^^^ KeyError: 'station'
Is there anything I can do to avoid this or check for this issue before running to_dataframe()
to avoid erroring out?
Hi Adam! Thanks for the interesting work.
I find the documentation page is gone. Or is it still under development?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.