<jupyter_start><jupyter_text>___<jupyter_code>ds.tot_wind.isel(time=8).plot()
ax = plt.gca()
ax.set_xticklabels([])
ax.set_yticklabels([])
ax.set_xlabel(None)
ax.set_ylabel(None)
fig = plt.gcf()
fig.set_size_inches(7,4)
countries.plot(ax=ax, fc='None', ec='white', zorder=1)
plt.tight_layout()
# plt.savefig('outputs/built.png', dpi=240)
ds.EMISSIONS_2019.mean('time').plot(vmax=8e-10)
fig = plt.gcf()
ax = plt.gca()
ax.set_xticklabels([])
ax.set_yticklabels([])
ax.set_xlabel(None)
ax.set_ylabel(None)
fig.set_size_inches(7,4)
countries.plot(ax=ax, fc='None', ec='white', zorder=1)
plt.tight_layout()
# plt.savefig('outputs/emissions.png', dpi=240)
corr_df = xr.corr(ds.EMISSIONS_2019, ds.sp, dim=['latitude', 'longitude']).to_dataframe(name='corr')
corr_df.resample('8H').mean().plot()
plt.tight_layout()
# plt.savefig('outputs/pressure_emissions_corr.png', dpi=240)
ds.tot_wind.isel(time=18).plot(robust=True)
ax = plt.gca()
countries.plot(ax=ax, fc='None', ec='white', zorder=1)
plt.tight_layout()
corr_df = xr.corr(ds.CO_tc, ds.EMISSIONS_2019, dim=['time'])
corr_df.plot(vmin=0, cmap='viridis', cbar_kwargs={'label':'Correlation coef.'})#.groupby(corr_df.index.hour).mean().plot()
ax = plt.gca()
ax.set_xticklabels([])
ax.set_yticklabels([])
ax.set_xlabel(None)
ax.set_ylabel(None)
fig = plt.gcf()
fig.set_size_inches(8,6)
countries.plot(ax=ax, fc='None', ec='white', zorder=1)
plt.tight_layout()
plt.savefig('outputs/CO_emissions_corr.png', dpi=240)
xr.corr(ds.tot_wind, ds.EMISSIONS_2019, dim=['time']).plot()
ax = plt.gca()
countries.plot(ax=ax, fc='None', ec='white', zorder=1)
plt.tight_layout()
df = ds[['EMISSIONS_2019', 'NO_tc']].mean(['latitude', 'longitude']).to_dataframe().dropna()
# df = ds[['EMISSIONS_2019', 'NO_tc']].isel(latitude=15, longitude=10)#.to_dataframe().dropna()

df
xr.corr(ds.EMISSIONS_2019, ds.NO_tc, dim=['latitude', 'longitude']).plot()
xr.corr(ds.EMISSIONS_2019, ds.NO_tc, dim='time').plot()
plt.scatter(df.EMISSIONS_2019, df.NO_tc)
from sklearn.metrics import r2_score
pearsonr(df.EMISSIONS_2019, df.NO_tc)
from scipy.stats import linregress
linregress(ds.NO_tc.mean(['latitude', 'longitude']), ds.EMISSIONS_2019.mean(['latitude', 'longitude']))
regr = linregress(df.NO_tc, df.EMISSIONS_2019)
from sklearn.linear_model import LinearRegression
regr = LinearRegression()
regr.fit(list(df.NO_tc), df.EMISSIONS_2019)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup