Giter VIP home page Giter VIP logo

bcsnowdata's Introduction

bcsnowdata

img License

Project Status

This package is currently under development, and subject to future changes and iterations.

This package is maintained by River Forecast Centre, part of the Water Management Branch of the Ministry of Forest Lands, Natural Resource Operations and Rural Development within the Government of British Columbia.

What does bcsnowdata do?

This package contains functions for retrieving snow-related data from the BC Data Catalogue, which can be found here.

Data is collected from both manual and automated snow weather (ASWE) stations around the province. These sites, and data collection, is the responsibility of the Ministry of Environment and Climate Change Strategy’s Snow Survey Program, BC Hydro and other partners. Snow data includes snow water equivalent (SWE; both manual and automated stations), snow depth (ASWE and manual sites), precipitation (ASWE), and temperature (ASWE sites). The authors of this package are not responsible for any errors within the source data, and assume no responsibility or liability for subsequent use of any data resources compiled by these functions.

This package uses the bcdata package to access ASWE and manual snow data from the BC Data Catalogue, and provides a means of quickly accessing different records across the different types of data that exist for snow within the BC Data Catalogue.

Features

This package features functions for retrieving BC snow data from the BC Data Catalogue for ASWE stations and manual snow surveys. It also contains functions for retrieving the location metadata of snow survey and automated snow weather stations, as well as snow basin administrative areas.

Installation

The snow package can be installed from GitHub:

install.packages("remotes", repos = "http://cran.us.r-project.org")
remotes::install_github("bcgov/bcsnowdata")
library(bcsnowdata)

Usage

This package contains seven functions for returning snow-associated data.

get_snow

The get_snow function retrieves either ASWE or manual data, and does not require the user to specify whether the site(s) they are retrieving data for are manual or ASWE sites.

The get_snow function is a wrapper for the get_aswe_databc() and get_manual_swe() functions detailed below.

Variables include:

  • id: Station ID of the site(s) to retrieve data for. Can also be: “All”(all manual and ASWE sites), “automated” (all ASWE sites), or “manual” (all manual snow sites).
  • get_year: water year you want to retrieve data for.
  • survey_period: manual site survey period you want to retrieve data for (in “01-01” or “Jan-01” format). Only for manual data.
  • parameter: Type of data you are retrieving for ASWE data. Only for ASWE data.
  • timestep: Whether you are trying to retrieve hourly or daily ASWE data. Only for ASWE data.
library(bcsnowdata)
# Get hourly swe data for 2022 water year for 1A01P
aswe_test <- get_snow(id = "1A01P", get_year = "2022", parameter = "swe", timestep = "hourly")

# Get manual snow data for all sites for the 2022 water year across all survey
# periods
manual_test <- get_snow(id = "1A06A", get_year = "2022", survey_period = "all")

Automated Snow Function

get_aswe_databc() retrieves data for automated snow stations, including snow water equivalent (swe), snow depth, precipitation and air temperature. Hourly data is available until 2003, and daily data available before that for stations that were established before this point up to (and including) the current water year.

The user can define multiple options within the function, including:

  1. station_id: This function will retrieve data for one station (by specified station ID), or multiple stations specified within a string (i.e., c(“2F05P”, “1C18P”)). The user can also specify to return all ASWE stations within the Data BC Catalogue.

  2. get_year: Specifies the year you want to return. Can be one water year, multiple, or all.

  3. parameter_id: Specifies what type of data you want to retrieve. The choices include SWE, Temperature, SD (snow depth), and Precipitation.

  4. timestep: Specifies what type of data to retrieve (hourly or daily average).

The function in this example will retrieve data for station ID 2F05P for all years on record without updating the cache of historic data (data prior to this water year).

# Get hourly swe data for one station across all years available (no data
# available before 2003 for all stations)
id <- c("2F05P")
SWE_test <- get_aswe_databc(station_id = id, get_year = "All", parameter = "swe",
    timestep = "hourly")

Manual Snow Survey Data Function

The manual snow station data function - get_manual_swe() - is similar to the function that gets data from the ASWE sites.

Specifically, the user can define multiple options within the function, including:

  1. station_id: This function will retrieve data for one station (by specified station ID), or multiple stations specified within a string (i.e., c(“2F05P”, “1C18P”)). The user can also specify to return all manual snow survey locations within the Data BC catalogue. This is significantly faster than the ASWE station function.

  2. survey_period: Specifies what survey period the user wants to return. Can be “All” (the default within the function), or else a specific survey period (or number of them). The format can either be numeric month year (i.e., “03-01” is March 1), or annotated in the format day-month, such as “01-Mar”.

# Retrieve manual snow survey data for one site over all survey periods and
# years
id <- c("1C21")
manual_test <- get_manual_swe(station_id = id, survey_period = "All", get_year = "All")
Automated Snow Weather Station Locations

The snow_auto_location() returns a dataframe containing location metadata for all of the automated snow weather stations. The returned dataframe includes both active as well as inactive stations, in addition to their latitude, longitude and elevation.

Data obtained from the BC Data Catalogue.

ASWE_locations <- snow_auto_location()

head(ASWE_locations)
Manual Snow Survey Locations

The snow_auto_location() function returns a dataframe containing location metadata for all of the manual snow survey locations. The returned dataframe includes both active as well as inactive stations, in addition to their latitude, longitude and elevation.

Data obtained from the BC Data Catalogue.

manual_locations <- snow_manual_location()

head(manual_locations)
Snow Survey Administrative Basin Areas

The snow_auto_location() returns a dataframe containing location metadata for the administrative basin areas. Returned data includes the polygon geometries necessary to map snow basin areas (for example, upon integration with the bcmaps() package).

Data obtained from the BC Data Catalogue.

basin_locations <- snow_basin_areas()

head(basin_locations)
Assign water year

This package also contains the function wtr_yr() for assigning water year to a column of dates. It is meant as an internal function that can also be called externally. The main input is a vector or column of dates that are used to calculate the corresponding water year. The default start to the calendar year is October (start_month = 10).

wtr_yr(as.Date("2018-12-01"))

Project Status

This project is in active development and subject to change.

Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an issue.

How to Contribute

If you would like to contribute to the package, please see our CONTRIBUTING guidelines.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

License

Copyright 2022 Province of British Columbia

Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.

This project was created using the bcgovr package.

bcsnowdata's People

Contributors

ashjolly avatar jongoetz avatar kysiemens avatar repo-mountie[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bcsnowdata's Issues

Add project lifecycle badge

No Project Lifecycle Badge found in your readme!

Hello! I scanned your readme and could not find a project lifecycle badge. A project lifecycle badge will provide contributors to your project as well as other stakeholders (platform services, executive) insight into the lifecycle of your repository.

What is a Project Lifecycle Badge?

It is a simple image that neatly describes your project's stage in its lifecycle. More information can be found in the project lifecycle badges documentation.

What do I need to do?

I suggest you make a PR into your README.md and add a project lifecycle badge near the top where it is easy for your users to pick it up :). Once it is merged feel free to close this issue. I will not open up a new one :)

It's Been a While Since This Repository has Been Updated

This issue is a kind reminder that your repository has been inactive for 180 days. Some repositories are maintained in accordance with business requirements that infrequently change thus appearing inactive, and some repositories are inactive because they are unmaintained.

To help differentiate products that are unmaintained from products that do not require frequent maintenance, repomountie will open an issue whenever a repository has not been updated in 180 days.

  • If this product is being actively maintained, please close this issue.
  • If this repository isn't being actively maintained anymore, please archive this repository. Also, for bonus points, please add a dormant or retired life cycle badge.

Thank you for your help ensuring effective governance of our open-source ecosystem!

Add missing topics

TL;DR

Topics greatly improve the discoverability of repos; please add the short code from the table below to the topics of your repo so that ministries can use GitHub's search to find out what repos belong to them and other visitors can find useful content (and reuse it!).

Why Topic

In short order we'll add our 800th repo. This large number clearly demonstrates the success of using GitHub and our Open Source initiative. This huge success means its critical that we work to make our content as discoverable as possible; Through discoverability, we promote code reuse across a large decentralized organization like the Government of British Columbia as well as allow ministries to find the repos they own.

What to do

Below is a table of abbreviation a.k.a short codes for each ministry; they're the ones used in all @gov.bc.ca email addresses. Please add the short codes of the ministry or organization that "owns" this repo as a topic.

add a topic

That's in, you're done!!!

How to use

Once topics are added, you can use them in GitHub's search. For example, enter something like org:bcgov topic:citz to find all the repos that belong to Citizens' Services. You can refine this search by adding key words specific to a subject you're interested in. To learn more about searching through repos check out GitHub's doc on searching.

Pro Tip 🤓

  • If your org is not in the list below, or the table contains errors, please create an issue here.

  • While you're doing this, add additional topics that would help someone searching for "something". These can be the language used javascript or R; something like opendata or data for data only repos; or any other key words that are useful.

  • Add a meaningful description to your repo. This is hugely valuable to people looking through our repositories.

  • If your application is live, add the production URL.

Ministry Short Codes

Short Code Organization Name
AEST Advanced Education, Skills & Training
AGRI Agriculture
ALC Agriculture Land Commission
AG Attorney General
MCF Children & Family Development
CITZ Citizens' Services
DBC Destination BC
EMBC Emergency Management BC
EAO Environmental Assessment Office
EDUC Education
EMPR Energy, Mines & Petroleum Resources
ENV Environment & Climate Change Strategy
FIN Finance
FLNR Forests, Lands, Natural Resource Operations & Rural Development
HLTH Health
FLNR Indigenous Relations & Reconciliation
JEDC Jobs, Economic Development & Competitiveness
LBR Labour Policy & Legislation
LDB BC Liquor Distribution Branch
MMHA Mental Health & Addictions
MAH Municipal Affairs & Housing
BCPC Pension Corporation
PSA Public Safety & Solicitor General & Emergency B.C.
SDPR Social Development & Poverty Reduction
TCA Tourism, Arts & Culture
TRAN Transportation & Infrastructure

NOTE See an error or omission? Please create an issue here to get it remedied.

It's Been a While Since This Repository has Been Updated

This issue is a kind reminder that your repository has been inactive for 181 days. Some repositories are maintained in accordance with business requirements that infrequently change thus appearing inactive, and some repositories are inactive because they are unmaintained.

To help differentiate products that are unmaintained from products that do not require frequent maintenance, repomountie will open an issue whenever a repository has not been updated in 180 days.

  • If this product is being actively maintained, please close this issue.
  • If this repository isn't being actively maintained anymore, please archive this repository. Also, for bonus points, please add a dormant or retired life cycle badge.

Thank you for your help ensuring effective governance of our open-source ecosystem!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.