def test_validation_switzerland30(self): """Validation for Switzerland: two combinations of Lit and Pop, checking Pearson correlation coefficient and RMSF""" rho = lp.admin1_validation('CHE', ['LitPop', 'Lit5'], [[1, 1], [5, 0]],\ res_arcsec=30, check_plot=False)[0] self.assertTrue(np.int(round(rho[0] * 1e12)) == 945416798729) self.assertTrue(np.int(round(rho[-1] * 1e12)) == 3246081648798)
income_groups = list() for cntry in countries: income_groups.append(income_group(cntry, 2016)[1]) if compute_validation: """computation of normalized Gross Regional Product nGRP, skill metrics, and make scatter plots""" rho = dict() adm0 = dict() adm1 = dict() # loop over countries, computing nGRP and skill for i in countries_sel: print('*** ' + countries[i] + ' *** ') start_time_c = time.time() rho[countries[i]], adm0[countries[i]], adm1[countries[i]] =\ lp.admin1_validation(countries[i], methods, exponents_list, \ res_arcsec=resolution, check_plot=False) plt.figure() # Scatter plot per country lit3_scatter = plt.scatter(adm1[countries[i]]['Lit3'], \ adm0[countries[i]]['Lit3'], c=colors3[0], marker='^') pop_scatter = plt.scatter(adm1[countries[i]]['Pop'], \ adm0[countries[i]]['Pop'], c=colors3[1]) litpop_scatter = plt.scatter(adm1[countries[i]]['LitPop'], \ adm0[countries[i]]['LitPop'], c=colors3[2]) plt.plot([0, np.max([plt.gca().get_xlim()[1], plt.gca().get_ylim()[1]])], [0, np.max([plt.gca().get_xlim()[1], plt.gca().get_ylim()[1]])],\ ls="--", c=".3") plt.legend((litpop_scatter, lit3_scatter, pop_scatter),\ (r'$LitPop$', r'$Lit^3$', r'$Pop$',)) plt.xlabel('Reference nGRP')