Comments (3)
@wrightky deleting my previous comment so it does not mislead others.
TLDR - try using product=hourly_height
instead of product=water_level
.
The issue here is that while the CO-OPS API product hourly_height
is available prior to 1996 ...
from pprint import pprint
import noaa_coops as nc
station = nc.Station("8771510")
hourly_height = station.get_data(
begin_date="19951201 00:00",
end_date="19951231 00:00",
product="hourly_height",
datum="MSL",
units="english",
time_zone="gmt",
)
pprint(hourly_height)
# hourly_height sigma flags
# date_time
# 1995-12-01 00:00:00 -0.207 0.0 0,0
# 1995-12-01 01:00:00 -0.016 0.0 0,0
# 1995-12-01 02:00:00 0.223 0.0 0,0
# 1995-12-01 03:00:00 0.384 0.0 0,0
# 1995-12-01 04:00:00 0.535 0.0 0,0
# ... ... ... ...
# 1995-12-27 19:00:00 -1.476 0.0 0,0
# 1995-12-27 22:00:00 -1.375 0.0 0,0
# 1995-12-27 23:00:00 -0.886 0.0 0,0
# 1995-12-30 17:00:00 0.673 0.0 0,0
# 1995-12-30 19:00:00 0.692 0.0 0,0
... the product water_level
is NOT available. NOAA confirmed that no station has water levels prior to 1996. I am adding some checks on the arguments provided to station.get_data()
and updating the error messages when the API returns no data, particularly for water level data so that the user is directed to try the hourly_height
product instead.
water_level = station.get_data(
begin_date="19951201 00:00",
end_date="19951231 00:00",
product="water_level",
datum="MSL",
units="english",
time_zone="gmt",
)
# Traceback (most recent call last):
# File "/Users/gclunies/Repos/noaa_coops/noaa_coops/station.py", line 1023, in <module>
# data2 = station.get_data(
# File "/Users/gclunies/Repos/noaa_coops/noaa_coops/station.py", line 693, in get_data
# df = self._make_api_request(data_url, product)
# File "/Users/gclunies/Repos/noaa_coops/noaa_coops/station.py", line 425, in _make_api_request
# raise COOPSAPIError(message=err_msg)
# noaa_coops.station.COOPSAPIError: CO-OPS API returned an error: No data was found. This product may not be offered at this station at the requested time.
#
# NOTE: `water_levels` product is only available from 1996 and onwards.
So what you see in the CO-OPS website is data for the hourly_height
product, not water_level
. In fact, the API completely ignores the interval
parameter when requesting water_level
data which is always reported on the 6-min interval.
from noaa_coops.
Ah! This makes perfect sense, and seems obvious in retrospect. I did not realize there was a formal distinction in the API between "hourly water level" and "hourly height" – not a super user-friendly distinction, but at least a simple one to fix. Looking back at the data inventory, I can see now that 6-minute water levels start on 1996-01-01, which should have been a clue as to what was happening.
Thank you for looking into this, I'm glad that the solution is straightforward. If possible, I suppose it would be a helpful enhancement if the combined choices of product='water_level'
, interval='h'
, and date<1996
would auto-redirect to a request for hourly_height
, but an informative error message would also do the job. Thanks again!
from noaa_coops.
addressed in #47
from noaa_coops.
Related Issues (18)
- Issues downloading large Met data requests
- `pandas.io.json.json_normalize` is deprecated, use `pandas.json_normalize` instead HOT 1
- ValueError: No Predictions data was found. Please make sure the Datum input is valid. HOT 1
- Selecting stations by bounding box HOT 2
- KeyError saying "['flags', 'QC', 'date_time'] not found in axis" when downloading tide gage data before 1995 HOT 4
- deprecated append method fname.append HOT 2
- Column names should keep the product name HOT 2
- noaa_coops.py doesn't handle HTML exceptions HOT 2
- IOOS SOS API access? HOT 1
- _parse_known_date_formats is broken HOT 1
- Pulled data from the package does not match with the downloaded data from noaa website HOT 1
- Records should be deduped based on datetime index. Not column values. HOT 2
- Scripts to get the harmonic constituents of a station HOT 1
- numpy version requirement? HOT 3
- Failed dependency for `pandas` HOT 2
- Issue with downloading 6 min data HOT 1
- No Station Inventory data available HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from noaa_coops.