ARGODEV-138: cal2dec
Jira Issue
https://jira.ceh.ac.uk/browse/ARGODEV-138
Python Implementation
The python implementation mostly mirrors the original Matlab code, with two slight changes:
- There is some error handling if the user tries to access a month that does not exist (eg the 14th month of the year)
- There is some error handling if the calculated day of the year exceeds 366 (ie. is more than a leap year)
I have been informed that there is some date checking of the data earlier during the real time checks, so I should not expect for there to be an "impossible date" here
Testing
To test cal2dec 5 simple tests were written:
- Is the return type a float?
- Does the function raise an exception if the input month does not exist?
- Does the 0th minute of the 0th hour on the 1st day of the 0th month return 0?
- Does the 0th minute of the 24th hour on the 31st day of the final month return 365?
- Does the function raise an exception if the calculated decimalised date is over 366?
Old Matlab Implementation
Used to calculate the decimalised version of a calendar date. Inputs are a month [int], a day [int], an hour [int] (optional argument), and a minute [int] (optional argument). Optional arguments default to 0.