-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from DOI-USGS/contribute
Fix up Check
- Loading branch information
Showing
18 changed files
with
101 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
#courtesy of R bloggers for is.leapyear | ||
is.leapyear <- function(year){ | ||
#http://en.wikipedia.org/wiki/Leap_year | ||
return(((year %% 4 == 0) & (year %% 100 != 0)) | (year %% 400 == 0)) | ||
is.leapyear <- function(year, yearType='calendar', wyMonth=10L){ | ||
if (yearType=='calendar' || wyMonth<3 || wyMonth>6) { | ||
#http://en.wikipedia.org/wiki/Leap_year | ||
return(((year %% 4 == 0) & (year %% 100 != 0)) | (year %% 400 == 0)) | ||
}else if ((yearType=='water') && (wyMonth>=3 && wyMonth <=6)) { | ||
# | ||
# add 1 year if water year is supposed to start in Mar, Apr, May, Jun. | ||
# For these cases, the water year is assigned the previous | ||
# year value but contains the leap day. | ||
# | ||
# Example: | ||
# Time series: 01Apr1999 - 31Mar2000 | ||
# wyMonth = 4 | ||
# Assigned water year: 1999 | ||
# Number of days: 366 (because it contains 29Feb2000) | ||
# -> Function must return true for 1999 (and any other year that | ||
# precedes a leap year) | ||
# | ||
return((((year+1) %% 4 == 0) & ((year+1) %% 100 != 0)) | ((year+1) %% 400 == 0)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
tests/testthat/data/tests_calc_timingAverage_1158Thresh.rds
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters