def is_xarray_installed(raise_error=False):
    """Test if xarray is installed."""
    try:
        is_installed = True
    except ImportError:
        is_installed = False
    # Raise error (if needed) :
    if raise_error and not is_installed:
        raise IOError("xarray not installed. See http://xarray.pydata.org"
                      "for installation instructions.")
    return is_installed