snowprofile: High-level constructor for a snowprofile object

View source: R/snowprofile.R

snowprofileR Documentation

High-level constructor for a snowprofile object

Description

Conveniently create a snowprofile object. Calls low-level constructor (only available internally: new_snowprofile), asserts correctness through a snowprofile validator function (validate_snowprofile) and yields meaningful error messages. Use low-level constructor if you generate many (!) profiles.

Usage

snowprofile(
  station = as.character(NA),
  station_id = as.character(NA),
  datetime = as.POSIXct(NA),
  latlon = as.double(c(NA, NA)),
  elev = as.double(NA),
  angle = as.double(NA),
  aspect = as.double(NA),
  hs = as.double(NA),
  maxObservedDepth = as.double(NA),
  type = "manual",
  band = as.character(NA),
  zone = as.character(NA),
  comment = as.character(NA),
  hn24 = as.double(NA),
  hn72 = as.double(NA),
  ski_pen = as.double(NA),
  layers = snowprofileLayers(dropNAs = FALSE, validate = FALSE),
  tests = snowprofileTests(dropNAs = FALSE),
  instabilitySigns = snowprofileInstabilitySigns(dropNAs = FALSE),
  validate = TRUE,
  dropNAs = TRUE
)

Arguments

station

character string

station_id

character string

datetime

date and time as class POSIXct in most meaningful timezone (timezone can be converted very easily: e.g. print(profile$datetime, tz = 'EST').

latlon

2-element vector latitude (first), longitude (second)

elev

profile elevation (m)

angle

slope angle (degree)

aspect

slope aspect (degree)

hs

total snow height (cm); if not provided, the field will be derived from the profile layers.

maxObservedDepth

equivalent to hs for full profiles that go down to the ground. for test profiles that only observe the upper part of the snowpack this value refers to the maximum depth of the profile observation.

type

character string, must be either 'manual', 'modeled', 'vstation', 'aggregate', or 'whiteboard'

band

character string describing elevation band as ALP, TL, BTL (alpine, treeline, below treeline)

zone

character string describing the zone or region of the profile location (e.g., BURNABY_MTN)

comment

character string with any text comments

hn24

height of new snow within 24 h

hn72

height of new snow within 72 h

ski_pen

skier penetration depth (m)

layers

snowprofileLayers object

tests

snowprofileTests object

instabilitySigns

snowprofileInstabilitySigns object

validate

Validate the object with validate_snowprofile?

dropNAs

Do you want to drop non-mandatory snowprofile and snowprofileLayers fields that are NA only?

Value

snowprofile object

Author(s)

shorton, fherla

See Also

summary.snowprofile, plot.snowprofile, snowprofileLayers, snowprofileTests, snowprofileInstabilitySigns, SPpairs

Examples


## Empty snowprofile:
snowprofile()

## Test profile:
testProfile <- snowprofile(station = 'SARPstation', station_id = 'SARP007',
                           datetime = as.POSIXct('2019/04/01 10:00:00', tz = 'PDT'),
                           latlon = c(49.277223, -122.915084), aspect = 180,
                           layers = snowprofileLayers(height = c(10, 25, 50),
                                                      hardness = c(3, 2, 1),
                                                      gtype = c('FC', NA, 'PP')))
summary(testProfile)
plot(testProfile)


sarp.snowprofile documentation built on March 31, 2023, 5:17 p.m.