JavaScript
, Python/Pandas
, D3.js
, (React.js
)A CLI weather-tool / (app) which fetches a lat/lon coordinates of user-input address (postal codes, zip codes, cities, etc.), from the Google maps API, and uses those coordinates to fetch the past, current, and forecasted weather data from the forecast.io (darksky.net) API (requires an API-key). Currently, this only functions as a CLI (command-line-interface) tool, where functionality is run by Node.js
(e.g. $node app.js -a [address]
) based on the user-input address.
The goal of this project is to ultimately use React.js
to create the font-end of an on-line app where current, hourly, and minutely weather data will be displayed, both visually as time-series figures and as data tables, depending on the input-address from the user. Visual representation will be presented by using D3.js
; Back-end will be powered by Node.js
(currently, to test out and learn the D3.js
library, the back-end server will be powered by Python
); Data fetching, parsing, and manipulations will be done so using Python/Pandas
.
JavaScript
)The CLI tool is a quick way of fetching the current weather conditions from the DarkSky API. Simply call the app.js
script via. node
and the -a
flag to specify a specific address (either a city's name - i.e. Vancouver, or a postal/zip code, or even a country's name) to output the current weather conditions for the specified address.
Fetching the current weather by a country's name
Python/D3.js
)The web-app is still a work-in-progress, but from the current code there is a currently functional MVP with the current code-base.
Currently, there are two parts to the MVP. Firstly, weather.py
is run, to fetch the weather data from the DarkSky API. Second, when all the data has been fetched, parsed, and saved, the Flask server passes the data to the static html files that renders the data using D3
.
1. Revise the D3
code to be more modular → complete
Also, research and fix the D3
to render the temperature data returned from both the forecast and time-machine requests. → complete (the problem was the x/y-axis min/max limits between the two data sets being used, I think...)
D3
rendered figure for the /hindcast
end-point is missing both the y-axis and x-axis bars.First, this issue needs to be resolved. → complete
D3
rendered figure will have to be resolved. complete! (note the original goal of the project was to produce a time series figure showing both the historical and forecasted temperature data).2. Refactor the flask_server.py
script such that all the data fetching/parsing will be done with requests to particular end-points. complete
3. Start constructing the front-end
The Landing Page has now been created and can be seen in the image below.
The idea is to have a single Landing Page which will have links to *different weather parameters that will be rendered by D3
.
I'd like to construct data-panels which allows the client to view weather time-series' for a variety of weather parameters, etc.
There is also the possibility of doing the above using React.js
.
https://api.darksky.net/forecast/[key]/[latitude],[longitude]
https://api.darksky.net/forecast/[api-key]/[latitude],[longitude],[time]
cd
into python/flask-d3/
from the projects' root directory.python flask_server.py
to start the server (on localhost::8080
)/
: Index/home page (rendering templates/index.html
)
/
end-point currently renders an <ul>
element, listing href
links for different parts of the projectTemperature
will take you to a static html
page for the D3)/about
: Gives a summary of what the project is all about (i.e. what tech stack is used, what API is being used, etc.)/temperature
: Renders the temperature data for both the forecast and time-machine requests to the DarkSky API. Currently, there are some problems encoutered with this end-point (refer to the question posted on stackoverflow), which I'm currently attempting to solve./forecast
: Renders the static D3
HTML
page, producing a figure of the temperature data returned from a forecast request to the DarkSky API.D3.js
can be viewed on as an Observable notebook.D3.js
instead of matplotlib.From the figure above,
Since the data was not rendering properly (despite being successfully passed from server to html), I hard-coded the data into the HTML page to produce this figure. I'll have to explore the code and read up more, on D3
to hopefully solve the issue.
Update: This has now been solved (see figure below).
D3
calls to the data, the time series properly rendered!(for full details on request response formats, see here)
apparentTemperature
: 'feels like' temp in FarenheitcloudCover
: percentage of sky occluded by clouds, between 0 and 1, inclusive.dewPoint
: dew point in deg. Farenheithumidity
: relative humidity, between 0 and 1, inclusiveicon
: machine-readable text summary of data-point, suitable for selecting an icon for display.
clear-day
clear-night
rain
snow
sleet
wind
fog
cloudy
partly-cloudy-day
partly-cloudy-night
ozone
: columnar density of total atmospheric ozone at the given time (in Dobson units)precipIntensity
: intensity (in inches of liquid of water per hour) of precipitation occurring at a given time.precipProbability
: probability of precipitation occurring, between 0 and 1, inclusiveprecipType
: type of precipitation occurring at a given time.pressure
: sea-level pressure in millibarssummary
: human-readable text summary of data pointtemperature
: air-temp in deg. Farenheittime
(unix
timestamp): UNIX
time at which data point begins.uvIndex
: UV indexvisibility
: average visibility in miles, capped at 10 mileswindBearing
: direction that the wind is coming from in degrees, with true north at 0$^o$ and progressing clockwisewindGust
: wind gust in miles / hrwindSpeed
: wind speed in miles / hr