I have a scene object from eumetsat satellite.
My area of interest: (xmin_corner, ymin_corner, xmax_corner, ymax_corner) [40,-10,105,40] degrees
area definition looks like this:
Area ID: msg_seviri_unknown_3km
Description: MSG SEVIRI unknown area definition with 3 km resolution
Projection: {'a': '6378169', 'h': '35785831', 'lon_0': '45.5', 'no_defs': 'None', 'proj': 'geos', 'rf': '295.488065897014', 'type': 'crs', 'units': 'm', 'x_0': '0', 'y_0': '0'}
Number of columns: 1848
Number of rows: 1665
Area extent: (-604581.2379, -1096647.3571, 4940163.8125, 3899023.914)
I want to project this into a mercator projection for flat viewing.
I create an area definition using the scene area details from above.
my_area = create_area_def('my_area', {'proj': 'merc', 'lon_0': 45.5},
width=1848, height=1665,
area_extent= (-604581.2379, -1096647.3571, 4940163.8125, 3899023.914))
new_scn = scn.resample(my_area)
new_scn.show('natural_color')
projection looks fine, but some area is being clipped.
I so then try and specify area extent degrees explicitly
my_area = create_area_def('my_area', {'proj': 'merc', 'lon_0': 45.5},
width=1848, height=1665,
area_extent= [40,-10,105,40], units='degrees')
new_scn = scn.resample(my_area)
new_scn.show('natural_color')
Now I get a better image, but with some skew. its shrunk on the horizontal axis. I understand that this happens, because I have specified the width and the height?
How do I choose the best height, width for best optimal realistic output post projecting?
Now, I want to produce an image, maintaining the realistic looks (aspect ratio?,) when i move from geos to merc, without specifying some height and width and skewing the image.
I want the image to look something like this
Additional information: I think because my dataset has np.nans, because its at the edge of the view of the satellite, this creates some issues.
When i convert my area extent from the original scene to lon lats.
scn_area = scn['natural_color'].attrs['area']
# xmin, ymin
scn_area.get_lonlat_from_projection_coordinates(-604581.2379, -1096647.3571)
# (39.95708481758364, -10.007507617303142) - same as original. 40, -10
# xmax, ymax
scn_area.get_lonlat_from_projection_coordinates(-604581.2379, -1096647.3571)
# (inf, inf)
Is this the intended behaviour when computing area extents? Should not i get a lon lat explicitly, from projection coordinates, and not inf?
I'm guessing this inf inf is because of the nan values at the corner, where in the geos projection its not earth, but space.
now. when I do the same with my new merc area definition I get this.
my_area = create_area_def('my_area', {'proj': 'merc', 'lon_0': 45.5},
width=1848, height=1665,
area_extent= (-604581.2379, -1096647.3571, 4940163.8125, 3899023.914))
#xmin, ymin
my_area.get_lonlat_from_projection_coordinates(-604581.2379, -1096647.3571)
# (40.068954335025296, -9.867939236404165) - close to original (40, -10)
#xmax, ymax
my_area.get_lonlat_from_projection_coordinates(4940163.8125, 3899023.914)
# (89.87824658822916, 33.2040663665062) - completely off. and im guessing this is why the clipping happens.
I realise this must be something to do with how when the Scene object is initialised, the area extent is automatically calculated or something, because of the outer space np.nans. And by explicitly mentioning my area extent in degrees, I'm able to kind of get over this problem.
Now. Assuming what I've done and my understanding is correct. I want to be able to get the final image in its original aspect ratio (if i can call it that), or what is best practice used on google maps etc.