Commit 1867af70 authored by Beatriz Recinos's avatar Beatriz Recinos
Browse files

fixed animation error

parent 43fa9be1
......@@ -126,10 +126,8 @@ for hour in hours_list_to_plot:
plot_sst.plot_sst_map(cci_to_plot, ax=ax, vmin=-7, vmax=7)
for date in dates_list:
buoy_data = df_buoy[date.strftime('%Y-%m-%d')][0]
if buoy_data.empty:
pass
else:
try:
buoy_data = df_buoy[date.strftime('%Y-%m-%d')][0]
xx = buoy_data.lon.values
yy = buoy_data.lat.values
s = 30 / buoy_data.age.values
......@@ -142,6 +140,8 @@ for hour in hours_list_to_plot:
c=temp, cmap=cmap, vmin=-1, vmax=1, edgecolors='k',
linewidths=0.5,
transform=crs.PlateCarree())
except IndexError:
pass
# Now adding the colour-bar
cax, kw = colorbar.make_axes(ax, location='top', pad=0.07, aspect=30)
......@@ -156,10 +156,8 @@ for hour in hours_list_to_plot:
f.suptitle(plot_end_date)
#ax.set_title()
plot_name = str(int(year)) + '_' + f"{str(int(month)):0>2}" \
+ f"{str(int(day_to_plot)):0>2}" + f"{str(int(hour)):0>2}"
plot_name = str(int(year)) + '_' + f"{str(int(month)):0>2}" + f"{str(int(day_to_plot)):0>2}" + f"{str(int(hour)):0>2}"
plt.savefig(os.path.join(config['plots_path'], plot_name + '.png'),
bbox_inches='tight', pad_inches=0.25)
bbox_inches='tight', pad_inches=0.25)
plt.clf()
plt.close(f)
plt.close(f)
\ No newline at end of file
......@@ -92,11 +92,7 @@ def process_hour_drift_from_start_to_end(df,
day_df = day_df.dropna(subset=['lon', 'lat'])
if day_df.empty:
day_df = day_df.assign(cci_sst=np.NaN)
day_df['cci_sst_2x2'] = np.NaN
day_df['cci_sst_1x1'] = np.NaN
day_df = day_df.assign(sst_z_mean=np.NaN)
day_df['age'] = day_df['date'].apply(lambda x: age.get(x.strftime('%Y-%m-%d')))
pass
else:
# It is important when using interp that you convert to xarray!
yy = xr.DataArray(day_df.lat.values, dims='z')
......@@ -137,8 +133,8 @@ def process_hour_drift_from_start_to_end(df,
day_df['age'] = day_df['date'].apply(lambda x: age.get(x.strftime('%Y-%m-%d')))
# Save all in a dictionary lead by date
d[date.strftime('%Y-%m-%d')].append(day_df)
return d
d[date.strftime('%Y-%m-%d')].append(day_df)
return d
def compute_coarsen(data, resolution):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment