I created a TimeSeries from TimeObjects (i.e.the list timemeting, times of the measurements) and the measured values (anglesarray). I want to fit the data to a function of time. The function contains another function (SunPosition) requiring the time in the form of a TimeObject, the same as used in making the TimeSeries. Just calling it "t" as done in the examples for fitting a timeseries does not work. Do I have to deconstruct the timeobjects to get a simpler variable and construct again when calling the function? That seems putting the horse behind the wagon.
timemeting= {DateObject[{2022, 7, 17, 7, 54, 33.}, "Instant"],
DateObject[{2022, 7, 17, 8, 16, 8.}, "Instant"],
DateObject[{2022, 7, 17, 8, 56, 4.}, "Instant"],
DateObject[{2022, 7, 17, 9, 36, 20.}, "Instant"],
DateObject[{2022, 7, 17, 10, 16, 1.}, "Instant"],
DateObject[{2022, 7, 17, 10, 16, 55.}, "Instant"],
DateObject[{2022, 7, 17, 10, 55, 51.}, "Instant"],
DateObject[{2022, 7, 17, 10, 56, 13.}, "Instant"],
DateObject[{2022, 7, 17, 11, 36, 8.}, "Instant"],
DateObject[{2022, 7, 17, 12, 16, 10.}, "Instant"],
DateObject[{2022, 7, 17, 14, 16, 21.}, "Instant"],
DateObject[{2022, 7, 17, 14, 57, 3.}, "Instant"],
DateObject[{2022, 7, 17, 15, 37, 4.}, "Instant"],
DateObject[{2022, 7, 17, 16, 16, 6.}, "Instant"],
DateObject[{2022, 7, 17, 16, 56, 3.}, "Instant"],
DateObject[{2022, 7, 17, 17, 36, 26.}, "Instant"],
DateObject[{2022, 7, 17, 18, 16, 22.}, "Instant"],
DateObject[{2022, 7, 17, 19, 34, 8.}, "Instant"],
DateObject[{2022, 7, 17, 19, 35, 44.}, "Instant"]}
anglesarray= {-83.95, -79.106, -68.979, -58.889, -49.1, -48.725, \
-38.725, -39.15, -29.31, -19.25, 10.595, 20.688, 30.924, 40.635, \
50.53, 60.993, 71.066, 90.977, 91.1841}
NonlinearModelFit[TimeSeries[Transpose[{timemeting, anglesarray}]],
ArcTan[Cos[#1] (Cos[#3] Sin[\[Beta]] Sin[#2] +
Cos[\[Beta]] Sin[#3]) +
Sin[#1] (-Cos[\[Gamma]] Cos[#2] Cos[#3] -
Sin[\[Gamma]] (Cos[\[Beta]] Cos[#3] Sin[#2] -
Sin[\[Beta]] Sin[#3])), -Cos[#2] Cos[#3] Sin[\[Gamma]] +
Cos[\[Gamma]] (Cos[\[Beta]] Cos[#3] Sin[#2] -
Sin[\[Beta]] Sin[#3])] & @
Flatten[{gardenloc["Latitude"] Degree + \[Alpha],
QuantityMagnitude[SunPosition[gardenloc, t]] Degree}]/
Degree, {\[Alpha], \[Beta], \[Gamma]}, t]