ShinyWeatherCan App

Photo by Kym MacKinnon on Unsplash

Motivation and Background

The ShinyWeatherCan app was created with Nick Rong in early 2020 shortly after ShinyCFA was completed. The idea was to build another useful Shiny application while avoiding some of the pitfalls encountered working on ShinyCFA (such as scope creep). We were also able to use some of the code and framework from ShinyCFA which led to a much faster development.

Nick Rong has the application hosted on the free tier of shinyapps.io at https://nickrongkp.shinyapps.io/WeatherCan/ and wrote a very brief blog post providing the link. The app is also available at https://app.waterexplorer.net/shinyWeather/ and is hosted there using a free tier AWS account as was recently done for ShinyCFA.

Application Overview

ShinyWeatherCan allows a user to enter a station ID and access climate data from Environment and Climate Change Canada (ECCC). Currently the ECCC website only allows manual data downloads of one month at a time. This app aims to minimize repetition for downloading these data which can be time consuming and tedious.

The idea of the app is that it provides a practitioner with a tool to search for and access data from an ECCC climate station, view the data at a high-level, and download the data for further processing and analysis.

The best way to understand the functionality is to just explore the app but a brief description is also provided below:

Select and Download Data from an ECCC climate station. The selector allows various station ID types and provides a summary of data record lengths available at the selected station. Flags are also provided based on differing station data resolution record lengths.

Climate Station Selector

The user can then select the desired data resolution (hourly, daily, monthly) for the app to download the data from ECCC. Popups are provided letting the user know when the download is in progress and when it is complete.

Download Station Data from ECCC

View the locations of ECCC stations in a simple (non-searchable) map. As shown in the figure below, clicking on a station location provides a summary of data available. The station information can also be updated if it is out of date.

Climate Stations Map

View data for a selected station in a table format. The Data Table tab allows the user to hide/show columns as many variables for a given station may be largely empty. The purpose of viewing the data within the app is to provide a practitioner with a quick view of the data.

Selected Station Data Table

View an interactive visual summary of missing data. The resolution of interest can be selected and the functionality is provided by the naniar package which was inspired by a previous vignette for the weathercan package. The plot shows annual percent missing for each climate station variable.

Missing Data Summary

Similar to ShinyCFA, the app uses an existing R package to provide the functionality for accessing data. The weathercan package used by the app is part of the rOpenSci project and is authored by Dr. Steffi LaZerte. Accordingly, much of the functionality of the app can be easily done directly within R but the app was considered as a tool for a practitioner with no programming ability.

The functionality to bulk download data from ECCC from an application is also not unique and other options existed at the time of writing the application; however, they did not use the maintained weathercan package and did not have the supporting data viewing capability. Accordingly, this project was still felt to be sufficiently unique and was also largely approached with a learning objective in mind.

Concluding Thoughts

The ShinyWeatherCan app was built as a follow-up to working on ShinyCFA and has less functionality than that app. However, this tighter scope of the project was part of the goal to avoid the scope creep that occurred while working on ShinyCFA. This led to a much faster development time and tidier code which could be reasonably modified in the future if required. There is additional functionality that may be added to the ShinyWeatherCan app in the future but the current scope still resulted in a useful tool. The project also provided the opportunity to host the application on the free tier of shinyapps.io which was an area we had run into issues when originally trying to deploy ShinyCFA.

Nathan Smith
Nathan Smith
Data Science | Water Resource Engineering

My interests include machine learning and using interactive applications to convey results and uncertainties.

Related