for co2mult in mults: co2vmr = co2mult * atm_pt[(atm, 2, 'co2')] int_fun = interp_coeffs[(nam, 'int_fun')] sc = interp_coeffs[(nam, 'signc')] if int_fun.ndim == 1: interplog = int_fun[ialt](co2vmr[ialt]) else: interplog = np.array( [intfu(co2vmr[ialt]) for intfu in int_fun[..., ialt]]) print(co2mult, interplog) coefff.append(interplog) coefff = np.stack(coefff) colors = npl.color_set(n_alts_trlo) fig, ax = plt.subplots() ax.grid() for j, col in zip(range(n_alts_trlo), colors): ax.plot(mults, coefff[:, j], color=col, linewidth=0.5) #plt.scatter(coeffs['co2profs'][:, ialt]/coeffs['co2profs'][1, ialt], -np.log(coeffs[nam][:, j, ialt]/coeffs['co2profs'][:, ialt])) ax.set_title(nam + '[:, {}]'.format(ialt)) ax.set_xlabel('x CO2') figs.append(fig) axes.append(ax) npl.adjust_ax_scale(axes) npl.plot_pdfpages(cart_out_4 + 'check_{}_all.pdf'.format(nam), figs) ###### Check. correlazione fra acoeff e cose
hr_calc_v2 = npl.hr_from_xi(xis2_unif, atm, cco2, all_coeffs = all_coeffs, atm_pt = atm_pt, allatms = allatms, n_alts = n_alts) # hr_ab_orig = npl.hr_atm_calc(atm, cco2)[:n_alts] hr_calc_var = np.zeros(n_alts) for ialt in range(n_alts):#range(n_alts_lte): xis_var = best_var[(cco2, ialt)] hr_calc_var[ialt] = npl.hr_from_xi_at_x0(xis_var, atm, cco2, ialt) tit = 'co2: {} - atm: {}'.format(cco2, atm) xlab = 'CR (K/day)' ylab = 'Alt (km)' # hrs = [hr_ref, hr_calc, hr_calc_v2, hr_calc_var] # labels = ['ref', 'fit unif 1', 'fit unif 2', 'fit var'] hrs = [hr_ref, hr_calc_v2, hr_calc_var] labels = ['ref', 'fit unif', 'fit var'] fig, a0, a1 = npl.manuel_plot(alts, hrs, labels, xlabel = xlab, ylabel = ylab, title = tit, xlimdiff = (-2., 2.)) # fig = plt.figure() # plt.plot(hr_ref, alts, label = 'ref') # plt.plot(hr_calc, alts, label = 'calc') # plt.plot(hr_calc-hr_ref, alts, label = 'diff') # plt.legend() # plt.grid() # plt.title('co2: {} - atm: {}'.format(cco2, atm)) figs.append(fig) a0s.append(a0) a1s.append(a1) npl.adjust_ax_scale(a0s) npl.adjust_ax_scale(a1s) npl.plot_pdfpages(cart_out + 'check_newparam_LTE_unifit2_vs_varfit.pdf', figs)