-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Out of bounds timestamp for temporal averaging #301
Comments
Thanks for raising this issue @pochedls. I'll be able to take a closer look next week, but it looks like you're beating me to it. Here's that method's docstring to explain when Lines 1308 to 1318 in 050d57e
Basically, I didn't take into account a situation where you would compute averages for datasets outside the pd.Timestamp range (e.g., start year 1010).
Yes, I think using
Yes, the solution is to probably remove the |
* attempted fix for #301: use cftime for temporal operations * Update temporal accessor to use specific cftime objects - Update format of `decode_non_cf_time()` conditional statement - Update `time_cf` with encoding dict attributes (xarray behavior) - Update `test_dataset.py` and `test_temporal.py` with specific `cftime` date_type objects - Add `xesmf` to `dev.yml` Co-authored-by: Tom Vo <[email protected]>
What happened?
In trying to compute annual averages for data with non-cf-compliant time units I get an OutOfBoundsError.
What did you expect to happen?
I think this functionality should work with non-cf-compliant time.
Minimal Complete Verifiable Example
Relevant log output
Anything else we need to know?
This issue does not occur with original data (with cf-compliant datetimes).
The condensed log above shows that this issue arises in the
_convert_df_to_dt
function when the dataframe is cast to datetime objects using pandas (becauseyear_is_unused = False
).year_is_unused
is set toFalse
because the mode is set toaverage
and the_freq
is not yearly. I don't totally understand why we usecftime
for this step for some conditions, but use pandas for others.Can we use
cftime
for all cases? I'm wondering if we started by using pandas and then used cftime for some conditions (e.g., see the documentation), but in reality we may be able to simply usecftime
. @tomvothecoder – do you remember these details well enough to know?If I remove the
if year_is_unused
conditional and re-run the code I don't get an error. But I fail a bunch of unit tests – I'm not sure if this is a unit issue or an actual problem.Also note that it is possible that this issue affects other functions/functionality (but using
cftime
might resolve those potential issues).Environment
main branch
The text was updated successfully, but these errors were encountered: