예제 #1
0
def create_metrics(ref, test, ref_regrid, test_regrid, diff):
    """Creates the mean, max, min, rmse, corr in a dictionary"""
    metrics_dict = {}
    metrics_dict['ref'] = {
        'min': min_cdms(ref),
        'max': max_cdms(ref),
        'mean': mean(ref)
    }
    metrics_dict['test'] = {
        'min': min_cdms(test),
        'max': max_cdms(test),
        'mean': mean(test)
    }

    metrics_dict['diff'] = {
        'min': min_cdms(diff),
        'max': max_cdms(diff),
        'mean': mean(diff)
    }
    metrics_dict['misc'] = {
        'rmse': rmse(test_regrid, ref_regrid),
        'corr': corr(test_regrid, ref_regrid)
    }

    return metrics_dict
예제 #2
0
def create_metrics(ref, test, ref_regrid, test_regrid, diff):
    """Creates the mean, max, min, rmse, corr in a dictionary"""
    orig_bounds = cdms2.getAutoBounds()
    cdms2.setAutoBounds(1)
    lev = ref.getLevel()
    if lev is not None:
        lev.setBounds(None)

    lev = test.getLevel()
    if lev is not None:
        lev.setBounds(None)

    lev = test_regrid.getLevel()
    if lev is not None:
        lev.setBounds(None)

    lev = ref_regrid.getLevel()
    if lev is not None:
        lev.setBounds(None)

    lev = diff.getLevel()
    if lev is not None:
        lev.setBounds(None)
    cdms2.setAutoBounds(orig_bounds)

    metrics_dict = {}
    metrics_dict['ref'] = {
        'min': min_cdms(ref),
        'max': max_cdms(ref),
        #'mean': numpy.nan #mean(ref, axis='yz')
        'mean': mean(ref, axis='yz')
    }
    metrics_dict['test'] = {
        'min': min_cdms(test),
        'max': max_cdms(test),
        #'mean': numpy.nan #mean(test, axis='yz')
        'mean': mean(test, axis='yz')
    }

    metrics_dict['diff'] = {
        'min': min_cdms(diff),
        'max': max_cdms(diff),
        #'mean': numpy.nan #mean(diff, axis='yz')
        'mean': mean(diff, axis='yz')
    }
    metrics_dict['misc'] = {
        'rmse': rmse(test_regrid, ref_regrid, axis='yz'),
        'corr': corr(test_regrid, ref_regrid, axis='yz')
    }

    return metrics_dict
예제 #3
0
def create_metrics(ref, test, ref_regrid, test_regrid, diff):
    """
    Creates the mean, max, min, rmse, corr in a dictionary.
    """
    orig_bounds = cdms2.getAutoBounds()
    cdms2.setAutoBounds(1)
    lev = ref.getLevel()
    if lev is not None:
        lev.setBounds(None)

    lev = test.getLevel()
    if lev is not None:
        lev.setBounds(None)

    lev = test_regrid.getLevel()
    if lev is not None:
        lev.setBounds(None)

    lev = ref_regrid.getLevel()
    if lev is not None:
        lev.setBounds(None)

    lev = diff.getLevel()
    if lev is not None:
        lev.setBounds(None)
    cdms2.setAutoBounds(orig_bounds)

    metrics_dict = {}
    metrics_dict["ref"] = {
        "min": min_cdms(ref),
        "max": max_cdms(ref),
        "mean": mean(ref, axis="xz"),
    }
    metrics_dict["test"] = {
        "min": min_cdms(test),
        "max": max_cdms(test),
        "mean": mean(test, axis="xz"),
    }

    metrics_dict["diff"] = {
        "min": min_cdms(diff),
        "max": max_cdms(diff),
        "mean": mean(diff, axis="xz"),
    }
    metrics_dict["misc"] = {
        "rmse": rmse(test_regrid, ref_regrid, axis="xz"),
        "corr": corr(test_regrid, ref_regrid, axis="xz"),
    }

    return metrics_dict
예제 #4
0
def create_single_metrics_dict(values):
    d = {
        'min': float(min_cdms(values)),
        'max': float(max_cdms(values)),
        'mean': float(mean(values)),
        'std': float(std(values))
    }
    return d
예제 #5
0
def create_single_metrics_dict(values):
    d = {
        "min": float(min_cdms(values)),
        "max": float(max_cdms(values)),
        "mean": float(mean(values)),
        "std": float(std(values)),
    }
    return d