New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some composite are produced with the wrong colors #2082
Comments
The RGB data needs to be "enhanced" before being plotted with matplotlib. See the mention of |
yes, you're right! I didn't see that tutorial. Any clue why cartopy does not draw some of the borders? it only happens at the fine resolution. BTW here is the (much cleaner) code for reference which plots both normal channel and composites. channel='airmass'
scn = Scene(filenames = {reader:[file]})
scn.load([channel])
area = create_area_def('my_area',
{'proj': 'latlong', 'lon_0': 0},
area_extent=[-2, 36, 22, 55],
resolution=0.005,
units='degrees',
description='test')
scn = scn.resample(area)
image = get_enhanced_image(scn[channel]).data
crs = scn[channel].attrs["area"].to_cartopy_crs()
fig = plt.figure(figsize=(20,20))
ax = fig.add_subplot(1, 1, 1, projection=crs)
ax.coastlines(resolution="10m", color="white")
if len(scn[channel].shape) > 2:
image.plot.imshow(vmin=0, vmax=1, add_colorbar=False, rgb='bands', ax=ax)
else:
image[0].plot.imshow(vmin=0, vmax=1, cmap='Greys_r', add_colorbar=False, ax=ax) |
Probably not a problem, but try renaming Very odd with the coastlines. I'm not sure why it would not be able to do some of those. It is important to note that pycoast (the pytroll package drawing the coastlines in your code) and cartopy use two different sets of shapefiles. Pycoast uses GSHHG and cartopy uses NaturalEarth. However, the polygons missing are pretty easy ones to draw (not over the dateline, not going outside the extents of the image, etc). 🤔 Or maybe they are going outside of the image extents. You could try looking at forcing the x/y extents to be larger just to see if it has an effect on where the coastlines show up. |
I'm going to close this issue as I think the main satpy stuff is figured out, but feel free to keep commenting here and we can continue the discussion/debugging. |
Hey @djhoese , thank you a lot for the support, the coastlines are definitely not Anyway I'm exploiting your kindness to do some additional debugging :) I'm trying to write a processing script to operationally plot SEVIRI rapid scan native images. I'm using the EUMETSAT APIs to download the latest scans and then spawn some parallel processes with matplotlib to do all the plotting. I'm quite close but I still don't get how can I get the same quality output as when using the What I want to achieve is to be able to plot
Here is the code that I'm using (only pasting the minimum required, although the rest handling the file downloading and parallelization is quite interesting, I could share it in the future). # channel is either HRV or a composite name
scn = Scene(filenames={"seviri_l1b_native": [fname]})
scn.load([channel])
if channel not in scn: # means we're plotting composite so we have to resample
area = create_area_def('my_area',
{'proj': 'latlong', 'lon_0': 0},
area_extent=area,
resolution=0.01, # chosen arbitrarily... don't know what to put
units='degrees',
description='test')
scn = scn.resample(area)
else: # normal channel, no resample needed, just crop
scn = scn.crop(ll_bbox=tuple(area))
#
image = get_enhanced_image(scn[channel]).data
crs = scn[channel].attrs["area"].to_cartopy_crs()
fig = plt.figure(figsize=(20, 20))
ax = fig.add_subplot(1, 1, 1, projection=crs)
if len(scn[channel].shape) > 2:
image.plot.imshow(vmin=0, vmax=1, add_colorbar=False,
rgb='bands', ax=ax)
else:
image[0].plot.imshow(vmin=0, vmax=1, cmap='Greys_r',
add_colorbar=False, ax=ax) I cannot seem to get the same quality as in the Do you think the problem is related to the way |
You are already using the Scene.crop method so that should be fine. Instead of doing regular resampling you can do
As long as you provide all the resolutions as input then Satpy should default to loading the highest resolution it can find.
I'm not an expert on the SEVIRI readers, but maybe @pnuu or @ameraner can point to some of the options with those readers. I think there is one to force the data to be flipped inside the reader so that it doesn't get produced upside down. |
I get a
Again, I'm just trying to do as little processing as possible and to plot the data as-is without resampling or interpolation, just with the geospatial metadata extracted from the native file. |
What I suggested about the keyword arguments to the reader would not be any "real" additional processing. It would be mostly just flipping the data around. You are probably using the HRV channel which may require an additional keyword argument to produce a "padded" version of the HRV channel (HRV is made up of two separate images, but a single full disk is needed to use it without resampling). I think if you do |
Thanks I'll definitely try that! |
Describe the bug
I'm using SEVIRI L1.5 Rapid scan data.
When creating some of the composites the resulting data has wrong RGB channels data, resulting in the wrong image being produced.
To Reproduce
Expected behavior
The images produced by the two methods should coincide.
Actual results
Image obtained with matplotlib
Image obtained with second method
Some of the other composites are fine, e.g. for natural color
Image obtained with matplotlib
Image obtained with second method
The single channels image are also fine
Environment Info:
The text was updated successfully, but these errors were encountered: