Exemplo n.º 1
0
data = data.sortby('longitude')
data = data.sortby('latitude')
#data.to_netcdf('/home/hanna/TEMP_MODELS/{}_L5.nc'.format(fold))
#print('stored nc files')
vals = data['mae_test'].values.transpose() # constant is num hour 2014+-2018
cntours = axes[-1].contourf(vals, levels=100, cmap='hot_r')

# Removes white lines
for c in cntours.collections:
    c.set_edgecolor("face")
#fig.colorbar(cntours, ax=axes[-1], label = '{}'.format(var))
axes[-1].set_title('AR-B-L5', fontsize = 14)
#plt.xlabel('Longitude')
#ax.set_xlabel('Longitude')
axes[-1].set_ylabel('Latitude')
axes[-1] = add_ticks(axes[-1])

#################### Plot ConvLSTM

data = xr.open_dataset(os.path.join('/home/hanna/MS-thesis/python_figs/','mae_convlstm_best_model.nc'))
vals    = data[var].values/43680
print(np.mean(vals))
cntours = axes[1].contourf(vals, levels=levels_contourplot, cmap='hot_r')

# Removes white lines
for c in cntours.collections:
    c.set_edgecolor("face")

#a = sns.heatmap(vals, ax = ax, cbar = True, cmap = 'viridis', linewidths=0)
axes[1].set_title('ConvLSTM-B10-SL24-32-3x3-32-3x3', fontsize = 14)
axes[1].set_ylabel('Latitude')
Exemplo n.º 2
0
p_vals = prediction[var].values
cntours = axes[1].contourf(p_vals, levels=levels_contourplot, cmap='Blues_r')
axes[1].set_title('Prediction')
# Removes white lines
for c in cntours.collections:
    c.set_edgecolor("face")

print('Warming the colorbar is made based on the last subplot---')
#cb_ax = fig.add_axes([0.83, 0.1, 0.02, 0.8])
fig.colorbar(cntours,
             ax=axes,
             anchor=(1.0, 0.0),
             label='{} [{}]'.format(
                 var, UNITS[var]))  # ax=axes, orientation="horizontal",
#a = sns.heatmap(vals, ax = ax, cbar = True, cmap = 'viridis', linewidths=0)

axes[0].set_ylabel('Latitude')
axes[1].set_ylabel('Latitude')
axes[1].set_xlabel('Longitude')

axes[0] = add_ticks(axes[0], x_num_tikz=9, y_num_tikz=5)
axes[1] = add_ticks(axes[1], x_num_tikz=9, y_num_tikz=5)

plt.subplots_adjust(left=0.1,
                    bottom=0.2,
                    right=0.8,
                    top=0.9,
                    wspace=0.1,
                    hspace=0.3)
plt.savefig(path_python_figures + 'target_prediction_plot_vertical.pdf')
Exemplo n.º 3
0
fig.set_size_inches(w = TEXT_WIDTH_IN, h = TEXT_HEIGHT_IN - 1 - 2) # minus to for title
fig.suptitle('Correlation to Cloud Fractional Cover', fontsize = 16)
counter = 0
for var, ax in zip(VARIABLES, axes):
    #if var != 'tcc':
    #print('Warning this duplicates the RH in plot for tcc')
    #vals   = data[var].values
    vals = data[var].values
    min = np.min(vals)
    max = np.max(vals)
    val  = np.max( [max, abs(min)] )

    cntours = ax.contourf(vals,
                          levels=levels_contourplot,
                          cmap='PiYG', vmin = -val, vmax = val)
    counter += 1
    # Removes white lines
    for c in cntours.collections:
        c.set_edgecolor("face")

    fig.colorbar(cntours, ax=ax)
    #a = sns.heatmap(vals, ax = ax, cbar = True, cmap = 'viridis', linewidths=0)
    ax.set_title(LONGNAME[var], fontsize = 14)
    ax.set_ylabel('Latitude')

    ax = add_ticks(ax, x_num_tikz = 9, y_num_tikz = 5)
    #a.legend()
plt.xlabel('Longitude')
plt.subplots_adjust(wspace = 0.2, hspace = 0.3, top=0.9, bottom=0.1, left = 0.14, right = .95)
plt.savefig(path_python_figures + 'correlation_figure.pdf')
Exemplo n.º 4
0
    #ax.tick_params(labelbottom=False, labeltop=False, labelleft=False, labelright=False,
    #top=False, bottom=False, left=False, right=False)
    test = data.isel(time=i)
    vals = np.flipud(test[var].values)
    cntours = ax.contourf(vals,
                          levels=levels_contourplot,
                          cmap='Blues_r',
                          vmin=0.0,
                          vmax=1.0)
    # Removes white lines
    for c in cntours.collections:
        c.set_edgecolor("face")

    ax.set_xlabel('Longitude')
    ax.set_ylabel('Latitude')
    ax = add_ticks(ax)

    cmap = mpl.cm.get_cmap('Blues_r')
    norm = mpl.colors.Normalize(vmin=0.0, vmax=1.0)
    mappable = mpl.cm.ScalarMappable(norm=norm, cmap=cmap)

    fig.colorbar(mappable, ax=ax, label='cfc [1]')
    plt.subplots_adjust(left=0.1,
                        bottom=0.15,
                        right=.99,
                        top=0.92,
                        wspace=0.2,
                        hspace=0.3)
    plt.savefig(
        os.path.join(path_store_figures,
                     '{}_{}_{}.png'.format(i, model, start_date)))