Exemplo n.º 1
0
        ax22.set_ylabel("$A_{net}$ ($kgC\,m^{-2}$)", y=1)
    elif var=="Lai":
        ax22.set_ylabel("$LAI$ $(m^{2}\,m^{-2})$", y=1)

if case == 'brazil':
    fig1 = plt.figure(1, figsize=(16,9))
    fig1.canvas.set_window_title("modi_%s" % (var))
    ax11 = plt.subplot()

    for each, imarker, icolor, ilabel in zip(data_list, ('^', 'v'), ('red', 'blue'), ('Terra', 'Aqua')):
        if (var == 'Lai') | (var == 'Psn') | (var == 'Gpp'):
            selection = each['mean'].groupby(each['mean'].index.month)
            selection.mean().plot(ax=ax11, ls='none', marker=imarker, color=icolor, markersize=10, label=ilabel)
            plot_error_bands(ax11, selection.mean().index, selection.mean().values, selection.std().values, color=ax11.lines[-1].get_color())
            if (var == 'Lai'):
                ax11.set_ylabel("%s" % var.upper())
            else:
                ax11.set_ylabel("%s $(kgC\,m^{-2})$" % var.upper())
            ax11.set_xticks(range(1,13))
            ax11.set_xticklabels([get_month_name(imonth, length=3) for imonth in range(1,13)])
            ax11.set_xlabel("Time (month)")
            ax11.legend()
        else:
            each['mean'].plot(ax=ax11, ls='none', marker=imarker, color=icolor, markersize=10)
            ax11.set_ylabel("%s $(kgC\,m^{-2})$" % var.upper())
            ax11.set_xlabel("Time (date)")
            
    
    # Show it
plt.show(block=False)
Exemplo n.º 2
0
# Plot it
fig1 = plt.figure(1, figsize=(9,12))
fig1.canvas.set_window_title("svanhovd_soilwater_content")
for i, j in zip(range(6), range(1,7)):
    ax = plt.subplot(6,1,j)
    ax.set_title("%s cm" % data.iloc[:,i*2][0], x=0.1, y=0.8)
    z_data = selection.where((selection < 30) & (selection >= 0)).iloc[:,i]
    #z_data.plot(ax=ax, marker='.', ls='None')
    z_data.groupby(z_data.index.dayofyear).apply(np.nanmean).plot(color='red')

    ax.set_ylim(0,30)
    #ax.set_xlim([dt.date(2018, 1, 1), dt.date(2018, 12, 31)])

ax.set_ylabel("Volumetric soilwater content (%)", y=3.25)
ax.set_xlabel("Time (months)")
ax.set_xticklabels([get_month_name(i, length=3) for i in range(1,13 )])

for ax in fig1.axes[:-1]:
    ax.set_xticklabels("")


fig2 = plt.figure(2, figsize=(16,9))
fig2.canvas.set_window_title("svanhovd_soilwater_content_3d")
Y = selection.columns.values
X = selection.index.values
Z = selection.values

x,y = np.meshgrid(X, Y)
levels = np.arange(vmin,np.round(vmax,-1), 1)
cp1 = plt.contourf(x, y, Z.transpose(), levels=levels, cmap=plt.cm.viridis_r)
cbar = plt.colorbar(cp1)
Exemplo n.º 3
0
#(brazil_0_ref['NPP']*sec_in_months*area*1e-12).plot(ax=ax31, color='black', linewidth=3, label='ref')
(brazil_0_ref_sum[pp]*60**2).plot(ax=ax31, color='black', linewidth=3, label='ref')

if b_hydro:
    sum_wo_hydr_ozone_luna[pp].plot(ax=ax31, color='orange', ls='--', label='ozoneluna wohydr')
    sum_wo_hydr_ref[pp].plot(ax=ax31, color='orange', label='ref wohydr')
# Annual sum
sums.append(brazil_0_ref_sum.sum()*60**2*area)

# Reference obs
if pp == 'GPP':
    obs_sel = obs.where((obs.Site=='K34') | (obs.Site=='K67') | (obs.Site=='RJA')).dropna()
    ax31.fill_between(np.arange(1,13), obs_sel.min().values[1:].astype(float), obs_sel.max().values[1:].astype(float), color='grey', alpha=0.5, label='obs')
    
ax11.set_xticks(np.arange(1,13))
ax11.set_xticklabels([get_month_name(each, length=3) for each in np.arange(1,13)])
ax11.set_xlabel("Time (month)")
ax11.set_ylabel("C:N $(gC m^{-2} / gN\,m^{-2})$")

ax21.set_xticks(np.arange(1,13))
ax21.set_xticklabels([get_month_name(each, length=3) for each in np.arange(1,13)])
ax21.set_xlabel("Time (month)")
ax21.set_ylabel("$\Delta$C:N (%)")

for ax in fig3.axes:
    ax.set_xticks(np.arange(1,13))
    ax.set_xticklabels("")
    ax.set_xlabel("")

ax31.set_ylim(0,15)
ax32.set_ylim(-10,0)
Exemplo n.º 4
0
    ax2 = plt.subplot(412)
    ax3 = plt.subplot(413)
    ax4 = plt.subplot(414)
    #(test[2018][u'f_temp']-test[2019][u'f_temp']).plot(ax=ax1, color='blue')
    (test[2018][u'f_SW']-test[2019][u'f_SW']).plot(ax=ax1, color='blue')
    #(test[2018][u'f_VPD']-test[2019][u'f_VPD']).plot(ax=ax2, color='red')
    (test[2018][u'f_phen']-test[2019][u'f_phen']).plot(ax=ax2, color='red')
    (test[2018][u'f_light']-test[2019][u'f_light']).plot(ax=ax3, color='black')
    (test[2018][u'PODY (mmol/m^2 PLA)']-test[2019][u'PODY (mmol/m^2 PLA)']).plot(ax=ax4, color='darkgreen')

    for ax in fig1.axes:
        ax.set_ylim(-1,1)
        ax.set_xticklabels("")
    ax4.set_xticklabels(np.round(ax.get_xticks()/24))
    for each in np.round(ax1.get_xticks()[1:-1]/24):
        ax1.text(each*24, ax.get_ylim()[-1], "%s" % get_month_name(indi.groupby(indi.dayofyear)[each].month[0], length=3), size='x-large')
    ax4.set_ylim(-4.5, 4.5)
    ax4.set_xlabel("Time (doy)")
    #ax1.set_ylabel('$\Delta f_{T}$')
    ax1.set_ylabel('$\Delta f_{SWP}$')
    #ax2.set_ylabel('$\Delta f_{VPD}$')
    ax2.set_ylabel('$\Delta f_{phen}$')
    ax3.set_ylabel('$\Delta f_{light}$')
    ax4.set_ylabel('$\Delta POD_y$ ($mmol\,m^{-2}$ PLA)')


# Show it
plt.show(block=False)
# Print it
print_all()
Exemplo n.º 5
0
#for iyear, icolor in zip(('2018','2019'), ('violet','purple')):
#    selection.sel(time=iyear)['tcc'].plot.hist(ax=ax11, color=icolor, label=iyear)

#plt.legend()

fig2 = plt.figure(2, figsize=(16, 9))
fig2.canvas.set_window_title("fraction_total_cloud_cover")
ax21 = plt.subplot()

pd_sel = []
for iyear in ('2018', '2019'):
    hours_month = np.array(
        [seconds_in_month(i, int(iyear)) for i in range(1, 13)]) / 60**2
    pd_sel.append(
        selection.sel(time=iyear)['tcc'].groupby(
            selection.sel(
                time=iyear).time.dt.month).sum().to_dataframe()['tcc'].values /
        hours_month)

pd_sel = pd.DataFrame({'2018': pd_sel[0], '2019': pd_sel[1]})

pd_sel.plot.bar(ax=ax21, color=('violet', 'purple'))

plt.xticks(range(12), [get_month_name(i, length=3) for i in range(1, 13)],
           rotation='horizontal')
ax21.set_xlabel("Time (months)")
ax21.set_ylabel("Faction of max. monthly cloud cover")

# Show it
plt.show(block=False)