I have a 1 dimensional array of CO2 values where I need to repeat each value over lon/lat dimensions [360, 720] creating an array of dims [365, 360, 720] - i.e. 1 year of daily CO2 values across longitude and latitude.
I would want to take an array:
a = np.array([343.79258065, 343.79096774, 343.78935484])
And tile the first value across an array of dims [360, 720], then tile the second value across the same dims [360, 720], and do that for n values in the array (365 times in my case)
A small dim example of this would be (but please note the dims I want below):
array([[343.79258065, 343.79258065, 343.79258065, ...],
[343.79096774, 343.79096774, 343.79096774, ...],
[343.78935484, 343.78935484, 343.78935484, ...]])
The output dimensions
So effectively each value in array a would be repeated (tiled?) over an array of dims [360, 720] for 365 layers resulting in a 3D array of dims [365, 360, 720].
It would be great to solve this with broadcast_to() if it's possible. Some links that don't quite do what I want: Repeating values n times and Repeat across multiple dimensions
aabove? I getValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()when I try use this on an array object. Shape of the input array is 1D - [365,]