mrghg / py12box_invert

MIT License
3 stars 0 forks source link

Inversion fails if end_date is specified #25

Closed mrghg closed 3 years ago

mrghg commented 3 years ago

Example from py12box_agage:

inv = Invert(project_path / "inputs", species, obs_path = obs_path, method="rigby14", n_threads=nthreads, sensitivity_freq=inversion_params.loc["Sensitivity frequency"], end_year=2021.)

Gets an error message saying:

Traceback (most recent call last): File "py12box_agage/run_py12box_invert.py", line 50, in inv = Invert(project_path / "inputs", species, File "/home/chxmr/code/py12box_invert/py12box_invert/invert.py", line 151, in init self.run_sensitivity(freq=sensitivity_freq, File "/home/chxmr/code/py12box_invert/py12box_invert/invert.py", line 324, in run_sensitivity if not np.allclose(self.mod.time, self.obs.time): File "<__array_function__ internals>", line 5, in allclose File "/home/chxmr/.conda/envs/py12box/lib/python3.8/site-packages/numpy/core/numeric.py", line 2159, in allclose res = all(isclose(a, b, rtol=rtol, atol=atol, equal_nan=equal_nan)) File "<__array_function__ internals>", line 5, in isclose File "/home/chxmr/.conda/envs/py12box/lib/python3.8/site-packages/numpy/core/numeric.py", line 2260, in isclose return within_tol(x, y, atol, rtol) File "/home/chxmr/.conda/envs/py12box/lib/python3.8/site-packages/numpy/core/numeric.py", line 2246, in within_tol return less_equal(abs(x-y), atol + rtol * abs(y)) ValueError: operands could not be broadcast together with shapes (552,) (553,)

mrghg commented 3 years ago

I assume this is related to https://github.com/mrghg/py12box/issues/18

lukewestern commented 3 years ago

(this is more a note for me) This seems to be problem specifically with setting with end_year = 2021. or greater. Currently end_year is not the final year, but the cut-off (i.e. end_year=2021 is includes up to end of 2020). Problem stems from missing obs in 2021.