import requests


def is_remote_netcdf(ds_str):
    """
    Check a remote path points to a NetCDF resource.

    Parameters
    ----------
    ds_str (str): remote path to a dataset

    Returns
    -------
    bool
    """

    # Some datasets do not support HEAD requests!  The vast majority will,
    # however, support GET requests
    try:
        head_req = requests.head(ds_str, allow_redirects=True, timeout=10)
        head_req.raise_for_status()
    except:
        content_type = None
    else:
        content_type = head_req.headers.get("content-type")

    # if the Content-Type header returned was "application/x-netcdf",
    # or a netCDF file (not OPeNDAP) we can open this into a Dataset
    return content_type == "application/x-netcdf"