ARTIFACTS IN L3 MODIS ACQUA CHLOROPHYLL IMAGES
Posted: Fri May 19, 2023 5:55 am America/New_York
Hi,
i am counting nan values along the time dimension of my 18-years long array, but the the image i get has orrible diagonals artifacts not related to any variability. Do you know which could be the problem?
Here my python code:
ds = xr.open_dataset(path + "MODIS_chl.nc").load()
chlor = ds['chlor_a']
#DataArray.count() counts the non NaN values along one dimension
count = (chlor.count(axis=0).to_numpy() / chlor.shape[0]) * 100
#plot
depths = (50, 100, 200, 500, 1000, 2500, 3000)
proj = ccrs.PlateCarree()
fig, ax = plt.subplots(subplot_kw = dict(projection=proj), figsize=(14, 12))
im = ax.pcolormesh(lons, lats, count, cmap="jet", vmin = 10)
# im = ax.contourf(lons, lats, count, cmap="jet", levels = np.linspace(10, 40, 20))
lines = ax.contour(lons, lats, -depth, levels = depths, colors='black', linewidths = .75)
ax.clabel(lines, inline=2, fontsize=30, colors = 'black')
# Show all ticks and label them with the respective list entries
ax.axes.get_xaxis().set_ticklabels([])
ax.axes.get_yaxis().set_ticklabels([])
ax.axes.axis("tight")
ax.set_xlabel("")
res = '10m'
ax.coastlines(resolution = res, linewidths = 0.5)
gl = ax.gridlines(linewidth=0.5, color='gray', alpha=0.5,
linestyle='--', draw_labels=False)
gl.xlabels_top = False
gl.ylabels_right = False
gl.ylabels_left = True
gl.xlabels_bottom = True
gl.xlabel_style = {'fontsize': 25}
gl.ylabel_style = {'fontsize': 25}
ax.add_feature(cfeature.LAND.with_scale(res), facecolor = 'lightgray', zorder = 1)
cbar = fig.colorbar(im, format='%.0f', spacing='proportional',
orientation = 'horizontal', location = "bottom", pad = 0.1)
cbar.set_label( label = "% of not cloudy days per pixel", fontsize = 30, y = 0.5)
cbar.ax.tick_params(which='minor', size=25, width=1, color='k', direction='in')
cbar.ax.tick_params(which='major', size=25, width=1, color='k', direction='in', labelsize = 25)
# adjust bottom margin and position colorbar at the bottom
fig.subplots_adjust(bottom=0.2)
cbar.ax.set_position([0.2, 0.07, 0.6, 0.07])
ax.set_title("Number of useful days for calculations", {'fontsize': 40})
fig.tight_layout()
plt.show()
fig.savefig(plot_path + 'count_days.png', dpi = 500, bbox_inches='tight')
i attached also the image i get:
i am counting nan values along the time dimension of my 18-years long array, but the the image i get has orrible diagonals artifacts not related to any variability. Do you know which could be the problem?
Here my python code:
ds = xr.open_dataset(path + "MODIS_chl.nc").load()
chlor = ds['chlor_a']
#DataArray.count() counts the non NaN values along one dimension
count = (chlor.count(axis=0).to_numpy() / chlor.shape[0]) * 100
#plot
depths = (50, 100, 200, 500, 1000, 2500, 3000)
proj = ccrs.PlateCarree()
fig, ax = plt.subplots(subplot_kw = dict(projection=proj), figsize=(14, 12))
im = ax.pcolormesh(lons, lats, count, cmap="jet", vmin = 10)
# im = ax.contourf(lons, lats, count, cmap="jet", levels = np.linspace(10, 40, 20))
lines = ax.contour(lons, lats, -depth, levels = depths, colors='black', linewidths = .75)
ax.clabel(lines, inline=2, fontsize=30, colors = 'black')
# Show all ticks and label them with the respective list entries
ax.axes.get_xaxis().set_ticklabels([])
ax.axes.get_yaxis().set_ticklabels([])
ax.axes.axis("tight")
ax.set_xlabel("")
res = '10m'
ax.coastlines(resolution = res, linewidths = 0.5)
gl = ax.gridlines(linewidth=0.5, color='gray', alpha=0.5,
linestyle='--', draw_labels=False)
gl.xlabels_top = False
gl.ylabels_right = False
gl.ylabels_left = True
gl.xlabels_bottom = True
gl.xlabel_style = {'fontsize': 25}
gl.ylabel_style = {'fontsize': 25}
ax.add_feature(cfeature.LAND.with_scale(res), facecolor = 'lightgray', zorder = 1)
cbar = fig.colorbar(im, format='%.0f', spacing='proportional',
orientation = 'horizontal', location = "bottom", pad = 0.1)
cbar.set_label( label = "% of not cloudy days per pixel", fontsize = 30, y = 0.5)
cbar.ax.tick_params(which='minor', size=25, width=1, color='k', direction='in')
cbar.ax.tick_params(which='major', size=25, width=1, color='k', direction='in', labelsize = 25)
# adjust bottom margin and position colorbar at the bottom
fig.subplots_adjust(bottom=0.2)
cbar.ax.set_position([0.2, 0.07, 0.6, 0.07])
ax.set_title("Number of useful days for calculations", {'fontsize': 40})
fig.tight_layout()
plt.show()
fig.savefig(plot_path + 'count_days.png', dpi = 500, bbox_inches='tight')
i attached also the image i get: