horrgs / earth Goto Github PK
View Code? Open in Web Editor NEWCongregate of multiple weather, climate, and geologic APIs pertaining to general public information.
License: GNU General Public License v3.0
Congregate of multiple weather, climate, and geologic APIs pertaining to general public information.
License: GNU General Public License v3.0
Per the documentation on weather.gov, a number of values are being deprecated in the near future. Below are following snippets relevant to the values that are being deprecated.
Snippet 1:
Earth/wrappers/weather/weathergov/forecast.py
Lines 36 to 48 in f9c3523
Snippet 2:
Earth/wrappers/weather/weathergov/forecast.py
Lines 53 to 61 in f9c3523
temperature
, windSpeed
, and windGust
will now become QuantitativeValue
objects (as opposed to integers.
)
temperatureUnit
will be completely deprecated. QuantitativeValue
objects have a property for units, and temperatureUnit
will go there (in a way) under the QuantitativeValue
for temperature
.
Below, we have our generic request method
def req(url, method: RequestMethod, payload=None):
headers = {
'User-Agent': 'https://www.github.com/Horrgs/Earth',
'Feature-Flag': 'forecast_temperature_qv'
}
try:
if payload is not None: # check if a payload is specified for HTTP request.
req = requests.request(method=method.value, url=url, headers=headers, data=payload) # valid payload to send with HTTP request.
else:
req = requests.request(method.value, headers=headers, url=url) # no payload to send, send remaining info.
The issue lies with the headers. This method is to serve for multiple services, and therefore the headers for the NWS service shouldn't be sent unless it's the NWS service sending the request. Specifically, the below lines should be removed, and headers shall only send per service need.
Lines 36 to 39 in af7c5b1
See additional details on commit 9 here
We ran a test to see how things are working so far, here is a snippet of said response:
response = get('https://api.weather.gov/gridpoints/TOP/31,80/forecast', RequestMethod.GET)
print(response['properties'])
p = GridpointForecastGeoJson.from_json(json.dumps(response))
print(p.properties.periods)
The issue here occurs on the 3rd line with the call & loading of GridpointForecastGeoJson.
This loops back to GridpointForecast & then GridpointForecastPeriod, where the error occurs.
Specifically, this line in GridpointForecastPeriod
temperature: Dict[QuantitativeValue]
raises a TypeError with an error message of: Too few parameters for typing.Dict; actual 1, expected 2.
The error here is that Dict[] expects two arguments, see the docs here.
Thus, errors exist in the following locations:
& more.
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.