Exemplo n.º 1
0
    def setUp(self):
        self.pattern_correlation = metrics.PatternCorrelation()
        self.ref_dataset = Dataset(
            np.array([1., 1., 1., 1., 1.]),
            np.array([1., 1., 1., 1., 1.]),
            np.array([dt.datetime(2000, x, 1) for x in range(1, 13)]),
            # Reshapped array with 300 values incremented by 5
            np.arange(0, 1500, 5).reshape(12, 5, 5),
            'ds1')

        self.tar_dataset = Dataset(
            np.array([1., 1., 1., 1., 1.]),
            np.array([1., 1., 1., 1., 1.]),
            np.array([dt.datetime(2000, x, 1) for x in range(1, 13)]),
            # Reshapped array with 300 values incremented by 2
            np.arange(0, 600, 2).reshape(12, 5, 5),
            'ds2')
Exemplo n.º 2
0
    Bounds(20.0, 33.0, 25.0, 32.5),
    Bounds(-19.3, -10.2, 12.0, 20.0),
    Bounds(15.0, 30.0, 15.0, 25.0),
    Bounds(-10.0, 10.0, 7.3, 15.0),
    Bounds(-10.9, 10.0, 5.0, 7.3),
    Bounds(33.9, 40.0, 6.9, 15.0),
    Bounds(10.0, 25.0, 0.0, 10.0),
    Bounds(10.0, 25.0, -10.0, 0.0),
    Bounds(30.0, 40.0, -15.0, 0.0),
    Bounds(33.0, 40.0, 25.0, 35.00)
]

region_list = ["R" + str(i + 1) for i in xrange(13)]

# metrics
pattern_correlation = metrics.PatternCorrelation()

# create the Evaluation object
RCMs_to_CRU_evaluation = evaluation.Evaluation(
    CRU31,  # Reference dataset for the evaluation
    # 1 or more target datasets for
    # the evaluation
    target_datasets,
    # 1 or more metrics to use in
    # the evaluation
    [pattern_correlation],
    # list of subregion Bounds
    # Objects
    list_of_regions)
RCMs_to_CRU_evaluation.run()
Exemplo n.º 3
0
################################################################################
# Get the bounds of the reference dataset and use it to create a new
# set of lat/lon values on a 1 degree step
# Using the bounds we will create a new set of lats and lons on 1 degree step
min_lat, max_lat, min_lon, max_lon = knmi_dataset.spatial_boundaries()
new_lons = numpy.arange(min_lon, max_lon, 1)
new_lats = numpy.arange(min_lat, max_lat, 1)

# Spatially regrid datasets using the new_lats, new_lons numpy arrays
knmi_dataset = dsp.spatial_regrid(knmi_dataset, new_lats, new_lons)
wrf_dataset = dsp.spatial_regrid(wrf_dataset, new_lats, new_lons)

# Load the metrics that we want to use for the evaluation.
################################################################################
sstdr = metrics.SpatialStdDevRatio()
pc = metrics.PatternCorrelation()

# Create our new evaluation object. The knmi dataset is the evaluations
# reference dataset. We then provide a list of 1 or more target datasets
# to use for the evaluation. In this case, we only want to use the wrf dataset.
# Then we pass a list of all the metrics that we want to use in the evaluation.
################################################################################
test_evaluation = evaluation.Evaluation(knmi_dataset, [wrf_dataset],
                                        [sstdr, pc])
test_evaluation.run()

# Pull our the evaluation results and prepare them for drawing a Taylor diagram.
################################################################################
spatial_stddev_ratio = test_evaluation.results[0][0]
# Pattern correlation results are a tuple, so we need to index and grab
# the component we care about.