home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 290576826

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/1330#issuecomment-290576826 https://api.github.com/repos/pydata/xarray/issues/1330 290576826 MDEyOklzc3VlQ29tbWVudDI5MDU3NjgyNg== 1217238 2017-03-30T23:49:21Z 2017-03-30T23:49:21Z MEMBER

Is it worth introducing custom exception types into xarray?

My thought is that custom exception types make sense when the exception is effectively part of the API, though possibly it would make sense to have AlignmentError inherit from ValueError.

For example, the first part of a utility function my_custom_align might involve something like: def is_aligned(*objects): try: xarray.align(*objects, join='exact') except AlignmentError: return False else: return True (actually, perhaps we should write is_aligned ourselves!)

Or to log potential performance issues: def align_but_log(*objects): try: aligned = xarray.align(*objects, join='exact') except AlignmentError: logging.warning('objects were not aligned') aligned = xarray.align(*objects) return aligned

Otherwise you'll probably want to change some others to AlignmentError for consistency.

I actually think every operation that automatically aligns already goes through xarray.align. Though it's probably worth double checking...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  217287113
Powered by Datasette · Queries took 0.622ms · About: xarray-datasette