-
Notifications
You must be signed in to change notification settings - Fork 19
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
Aggregate crashes when fields contain the actual_range attribute #764
Comments
The result of cf.environment:
|
Hi Mark, Thanks for the report. I'm having a look, but it'd be useful to know if you provided any keywords to configure the aggregation process (such as When you say "actual_range", do you perhaps mean "valid_range", or is there something else going on? I'll run some tests ... |
Hi Mark, I agree that Lines 4864 to 4869 in 7d78eac
numpy arrays - thanks for spotting this.
I see that you did mean |
Thanks David, just in case its still useful - I didn't set any other keywords, so default behaviour was to ignore the |
Hi Mark - PR #765 created. With a following wind it should make the public release we're planning for Thursday/Friday this week. |
Hi Mark, This change will go into David |
I have been trying to load some monthly files containing air temperature data (from chess-met https://catalogue.ceh.ac.uk/documents/835a50df-e74f-4bfb-b593-804fd61d5eab; although the data themselves are not important for this error) using cf.load, with the intention of aggregating along the time axis. I get a crash from cf.aggregate when the files contain the
actual_range
attribute AND there are at least three files to aggregate.This occurs because unlike some other attributes
actual_range
is not handled specially by cf.aggregate. The default behviour is to convert both to strings and append one to the other:cf-python/cf/aggregate.py
Lines 4871 to 4881 in 7d78eac
When the third file is appended, the string comparison is performed between a two-element np.ndarray from the new file and a string from the previous aggregation
cf-python/cf/aggregate.py
Lines 4864 to 4869 in 7d78eac
Since the valid_range attribute is defined in the CF-standard (https://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/ch02s05.html.) this should be handled. A simple correction would be to check if the property being updated is actual_range, and if so to set the parent's corresponding attribute to the minima and maxima of the two aggregated datasets. For instance:
Alternatively it could be fixed by ignoring this attribute, as is currently done for valid_range & similar attributes.
The text was updated successfully, but these errors were encountered: