ilyamaclean / microclimc

Below or above canopy microclimate modelling with R
12 stars 7 forks source link

a few fixes to date-time handling in NMR integration #4

Closed dklinges9 closed 4 years ago

dklinges9 commented 4 years ago

A few changes I made, represented in the last four commits on this fork:

1) in commit 43d0ffe, I changed how doy was created in runNMR(). Previously, tme (which was then used to assign doy and then not used again in the function) counted the day index up from the first day to length(tmeher); this doesn't mesh with timeseries that have some days missing. In my commit, I removed the line assigning tme (because it's just a temp object not called again) and used a new method to assign doy that works irregardless of whether there's gaps in your time series.

2) in commit 0f011f5, I pulled obs_time from climdata to assign to tme, which is used later as an argument in jday(). Previously jday() was referring to tme, which didn't exist locally within the function.

3) in commit a6d61b9, I changed how ndays was created so that if your timeseries is multiple years, ndays will be the number of days in your timeseries, rather than the number of days-of-year; this seemed to be the purpose of ndays and allowed multiyear timeseries to work in the model.

3) in commit 6605ec5, I removed a line that manipulates doy1; my previous commit causes this line to throw a warning, but doy1 is an object that isn't used downstream from that line, so removing this line didn't make a difference.