'Calculating snow accumulation and snow melt using SnowMelt {EcoHydRology} package in R

I found an R package that calculates snow accumulation and snow melt. However, I'm getting an error which I have no idea about. My confusion is that snowdepth data is not required but says its missing. Anyone experienced with this can give me a hand?

library(EcoHydRology)
dat <- read.csv("D:/met-forcing.csv")
sm <- SnowMelt(Date=dat$Time,precip=dat$precip,Tmax_C=dat$tmax,Tmin_C=dat$tmin,lat_deg=43,windSp=dat$ws)
summary(sm)

dat
#         Time  tmin  tmax precip ws
#1   9/15/2017 13.55 25.55 0.0 0.08888889 
#2   9/16/2017 11.81 26.50 0.0 0.04687500 
#3   9/17/2017 12.73 28.54 0.0 0.09895833 
#4   9/18/2017 16.13 21.89 0.0 0.18229167 
#5   9/19/2017 16.20 22.32 0.0 0.10937500 
#6   9/20/2017 17.63 28.25 0.0 0.33333333 
#7   9/21/2017 16.39 29.74 0.0 0.30208333 
#8   9/22/2017 17.37 31.28 0.0 0.13020833 
#9   9/23/2017 14.86 30.55 0.0 0.12500000 
#10  9/24/2017 14.91 31.92 0.0 0.03645833 

Error message:

Error in if (SnowDepth[i - 1] < 0.1) { : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In Solar(lat = lat, Jday = JDay[1], Tx = Tmax_C[1], Tn = Tmin_C[1],  :
  In Solar(): Input latitude units are not specified and assumed to be radians
r


Solution 1:[1]

A simple solution that I eventually found was to fix this error was to change the date format from yyyy/mm/dd to yyyy-mm-dd.

library(EcoHydRology)
dat <- read.csv("D:/met-forcing.csv")
dat$Time <- format(as.Date(dat$Time),"%Y-%m-%d")
sm <- SnowMelt(Date=dat$Time,precip=dat$precip,Tmax_C=dat$tmax,Tmin_C=dat$tmin,lat_deg=43,windSp=dat$ws)

dat
#          Time   tmin   tmax precip            ws
#1   2017-07-28  15.49  25.40    0.0  5.510638e-01
#2   2017-07-29  11.76  26.89    0.0  2.927083e-01
#3   2017-07-30  14.53  30.95    0.0  0.000000e+00
#4   2017-07-31  15.75  31.23    0.0  2.916667e-02
#5   2017-08-01  15.77  31.97    0.0  0.000000e+00
#6   2017-08-02  17.75  29.99    0.1  7.187500e-02
#7   2017-08-03  17.65  29.34    2.4  6.250000e-02
#8   2017-08-04  16.42  24.82    0.4  2.083333e-01
#9   2017-08-05  12.77  26.65    0.0  2.614583e-01
#10  2017-08-06  13.47  27.31    0.0  0.000000e+00

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yogi