Learn R Programming

sarp.snowprofile (version 1.3.2)

snowprofilePro: Construct snowprofile object from PRO file

Description

Read .pro files from SNOWPACK model output

Usage

snowprofilePro(
  Filename,
  ProfileDate = NA,
  tz = "UTC",
  remove_soil = TRUE,
  suppressWarnings = FALSE
)

Value

a single snowprofile object of list of multiple snowprofile objects

Arguments

Filename

path to pro file

ProfileDate

read a single profile from file (default = NA will read all profiles)

tz

time zone (default = 'UTC')

remove_soil

if soil layers are present in PRO file, remove them from snowprofile objects?

suppressWarnings

boolean switch

Author

shorton

Details

Several SNOWPACK model output formats exist see SNOWPACK documentation

Definitions of PRO files are provided at https://models.slf.ch/docserver/snowpack/html/pro_format.html and an example file is available at niViz

PRO files typically contain profiles from the same station at multiple time steps. If a specific ProfileDate is provided a single snowprofile object is returned (search available dates with scanProfileDates), otherwise all profiles are read and a list of snowprofile objects is returned.

See Also

snowprofilePrf, scanProfileDates, snowprofileSno

Examples

Run this code

## Path to example pro file
Filename <- system.file('extdata', 'example.pro', package = 'sarp.snowprofile')

## Download example pro file from niViz
#Filename <- tempfile(fileext = '.pro')
#download.file('https://niviz.org/resources/example.pro', Filename)

## Scan dates in file
Dates <- scanProfileDates(Filename)
print(Dates)

## Read a single profile by date and plot
ProfileDate <- Dates[3]
Profile <- snowprofilePro(Filename, ProfileDate = ProfileDate)
plot(Profile)

## Read entire time series and plot
Profiles <- snowprofilePro(Filename)
plot(Profiles, main = 'Timeseries read from example.pro')

Run the code above in your browser using DataLab