for member, each_target_dataset in enumerate(target_datasets):
	target_datasets[member] = dsp.subset(target_datasets[member], EVAL_BOUNDS)
	target_datasets[member] = dsp.water_flux_unit_conversion(target_datasets[member])
	target_datasets[member] = dsp.normalize_dataset_datetimes(target_datasets[member], 'monthly') 		
		
print("... spatial regridding")
new_lats = np.arange(LAT_MIN, LAT_MAX, gridLatStep)
new_lons = np.arange(LON_MIN, LON_MAX, gridLonStep)
CRU31 = dsp.spatial_regrid(CRU31, new_lats, new_lons)

for member, each_target_dataset in enumerate(target_datasets):
	target_datasets[member] = dsp.spatial_regrid(target_datasets[member], new_lats, new_lons)
	
#find the total annual mean. Note the function exists in util.py as def calc_climatology_year(dataset):
_,CRU31.values = utils.calc_climatology_year(CRU31)

for member, each_target_dataset in enumerate(target_datasets):
	_, target_datasets[member].values = utils.calc_climatology_year(target_datasets[member])

#make the model ensemble
target_datasets_ensemble = dsp.ensemble(target_datasets)
target_datasets_ensemble.name="ENS"

#append to the target_datasets for final analysis
target_datasets.append(target_datasets_ensemble)

for target in target_datasets:
	allNames.append(target.name)

list_of_regions = [
Esempio n. 2
0
 def test_total_mean(self):
     total_mean = np.arange(287.5, 312.5, 1)
     total_mean.shape = (5, 5)
     np.testing.assert_array_equal(
         utils.calc_climatology_year(self.test_dataset)[1], total_mean)
Esempio n. 3
0
 def test_invalid_time_shape(self):
     flat_array = np.array(range(350))
     self.test_dataset.values = flat_array.reshape(14, 5, 5)
     with self.assertRaises(ValueError):
         utils.calc_climatology_year(self.test_dataset)
Esempio n. 4
0
 def test_annually_mean(self):
     annually_mean = np.append(
         np.arange(137.5, 162.5, 1), np.arange(437.5, 462.5, 1))
     annually_mean.shape = (2, 5, 5)
     np.testing.assert_array_equal(
         utils.calc_climatology_year(self.test_dataset)[0], annually_mean)
    target_datasets[member] = dsp.water_flux_unit_conversion(
        target_datasets[member])
    target_datasets[member] = dsp.normalize_dataset_datetimes(
        target_datasets[member], 'monthly')

print("... spatial regridding")
new_lats = np.arange(LAT_MIN, LAT_MAX, gridLatStep)
new_lons = np.arange(LON_MIN, LON_MAX, gridLonStep)
CRU31 = dsp.spatial_regrid(CRU31, new_lats, new_lons)

for member, each_target_dataset in enumerate(target_datasets):
    target_datasets[member] = dsp.spatial_regrid(target_datasets[member],
                                                 new_lats, new_lons)

#find the total annual mean. Note the function exists in util.py as def calc_climatology_year(dataset):
_, CRU31.values = utils.calc_climatology_year(CRU31)

for member, each_target_dataset in enumerate(target_datasets):
    _, target_datasets[member].values = utils.calc_climatology_year(
        target_datasets[member])

#make the model ensemble
target_datasets_ensemble = dsp.ensemble(target_datasets)
target_datasets_ensemble.name = "ENS"

#append to the target_datasets for final analysis
target_datasets.append(target_datasets_ensemble)

for target in target_datasets:
    allNames.append(target.name)
Esempio n. 6
0
 def test_invalid_time_shape(self):
     flat_array = np.array(range(350))
     self.test_dataset.values = flat_array.reshape(14, 5, 5)
     with self.assertRaises(ValueError):
         utils.calc_climatology_year(self.test_dataset)
Esempio n. 7
0
 def test_total_mean(self):
     total_mean = np.arange(287.5, 312.5, 1)
     total_mean.shape = (5, 5)
     np.testing.assert_array_equal(
         utils.calc_climatology_year(self.test_dataset)[1], total_mean)
Esempio n. 8
0
 def test_annually_mean(self):
     annually_mean = np.append(
         np.arange(137.5, 162.5, 1), np.arange(437.5, 462.5, 1))
     annually_mean.shape = (2, 5, 5)
     np.testing.assert_array_equal(
         utils.calc_climatology_year(self.test_dataset)[0], annually_mean)