Page 1 of 1

ARTIFACTS IN L3 MODIS ACQUA CHLOROPHYLL IMAGES

Posted: Fri May 19, 2023 5:55 am America/New_York
by serenaneg
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:

Re: ARTIFACTS IN L3 MODIS ACQUA CHLOROPHYLL IMAGES

Posted: Wed Aug 30, 2023 4:48 pm America/New_York
by OB General Science - guoqingw
Hi, sorry for the delayed response. And sorry that I can't debug your code, but have you noticed similar patterns in our L3 MODIS Aqua chlorophyll images? If so, please provide more details. Otherwise, you may want to check your code for the way that you count the NAN at the same pixel/bin/location.

Re: ARTIFACTS IN L3 MODIS ACQUA CHLOROPHYLL IMAGES

Posted: Wed Aug 30, 2023 11:42 pm America/New_York
by hossez
The diagonal artifacts you're observing in your MODIS Aqua chlorophyll images are likely due to missing data and inconsistent spatial coverage across the 18-year dataset. These artifacts emerge as gaps when counting non-NaN values along the time dimension. To mitigate this, consider applying interpolation or smoothing techniques to fill in missing data or use statistical methods to identify and exclude unreliable data. Additionally, refining your visualization by using appropriate color scales and contour levels can help present the data more accurately.

Re: ARTIFACTS IN L3 MODIS ACQUA CHLOROPHYLL IMAGES

Posted: Sat Sep 02, 2023 8:26 am America/New_York
by serenaneg
OB General Science - guoqingw wrote:
> Hi, sorry for the delayed response. And sorry that I can't debug your code,
> but have you noticed similar patterns in our L3 MODIS Aqua chlorophyll
> images? If so, please provide more details. Otherwise, you may want to
> check your code for the way that you count the NAN at the same
> pixel/bin/location.

No i haven't that patterns when I look at weekly/monthly or yearly means of the data, they appears only when I count the NaN values along the time dimension, with a period longer than 1 month.