Given: -
1- Data data
(the entire data is to plotted).
2- A geostationary projection map_proj=crss.Geostationary(central_longitude=82.4)
over which the data is to be plotted.
3- An area bounded within the geostationary projection where data is to be plotted by plt.imshow
method.
I want the data to be plotted within a particular area restricted by lower_lat
, upper_lat
,left_lon
and right_lon
. 2 latitude and longitude lines make an enclosed area on the globe, an area bounded by lower/upper latitude lines and left/right longitude lines.
Code till now: -
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
left_lon=40 #40°E
right_lon=120 #120°E
lower_lat=10 #10°N
upper_lat=60 #60°N
map_proj = ccrs.Geostationary(central_longitude=82.4) #Geostationary projection centered at India.
fig=plt.figure(figsize=(10,10))
ax1 = plt.axes(projection=map_proj)
ax1.coastlines(color='black')
At the end, I want to use lower_lat
, upper_lat
,left_lon
and right_lon
to create some sort of extent where the data will be plotted.
Expected code: -
ax1.imshow(data, extent=map_extent,cmap='jet')
Question: - How to use the 4 latitude and longitude values to create map_extent
Till now, I've been getting map_extent
by map_extent=ax1.get_extent(crs=map_proj)
method, which isn't viable if I want a smaller plot area.
How can I create map_extent
from scratch?