Open jenjar93 opened 1 year ago
I had a poke with the benchmark data.
Editting: inputs/namelist_local.bdy
line 87: nn_month_end = 12
Then pybdy -s inputs/namelist_local.bdy
, as normal.
I get @jenjar93's error.
I'm not sure how the time stepping works but I deduce it iterates through the time steps in the inputs data, interpolating as it goes. While the neighbouring timestamps are both in Nov, the data object has a whole month of timestamps and data entries. When it gets to the points where the neighbouring timesteps are in Nov and Dec then the data object only has two time steps whereas the data within the object still has the whole month worth of data.
Here are the key bits of code from nemo_bdy_extr_tm3.py
:
line 989
nt = len(self.d_bdy[self.var_nam[var_id]]["date"])
I think that this is where the problem lies. For some reason nt=2
after a month of time steps, when the turn of the month is met.
This then results in a short time_counter
(of length only 2)
line 995
for t in range(nt):
time_counter[t] = tmp_cal.date2num(
self.d_bdy[self.var_nam[var_id]]["date"][t]
)
which then is at odds with the length of the data record line 1032
for v in varnams:
intfn = interp1d(
time_counter,
#self.d_bdy[v][year]["data"][0:len(time_counter), :, :], # Inserting this line fixes the problem, but only briefly.
self.d_bdy[v][year]["data"][:, :, :],
axis=0,
bounds_error=True,
)
My expectation is that time_counter
is being define too short at this junction between months.
@jpolton you shouldn't be able to put nn_month_end = 12
for the benchmark as there isn't enough source data (there is only data for November). pyBDY requires data either side of the required month. So if you select December then you'll need an entry for the January of the next year. You will only ever get 1 month of output from the benchmark case. There's probably no error handling in place for this, something to add later. We can run over this in the meeting - I have a feeling there maybe some crossover with #124
If nn_month_000 == nn_month_end, pybdy works and produces output with no runtime errors. But when nn_month_end > nn_month_000, it sucessfully outputs the first month but crashes moving onto the next.
The error is:
File "/work/jenjar/jenjar-conda/pybdy/lib/python3.9/site-packages/scipy/interpolate/_polyint.py", line 126, in _set_yi raise ValueError("x and y arrays must be equal in length along " ValueError: x and y arrays must be equal in length along interpolation axis.
(This happens both with the benchmark and Copernicus data).