How to set the map corner in cartopy LCC

1,315 views
Skip to first unread message

tjang

unread,
May 11, 2016, 4:17:18 AM5/11/16
to Iris
Hello, 

I want to plot a contour field on Lambert Conformal Conic map using the cartopy.
But I can't find the option to define the corners. 
In the basemap, I can define the four corner using the option, llcrnrlon, llcrnrlat, urcrnrlon, urlrnrlat.
Is there any method to set the corner in the cartopy LCC?


Andrew Dawson

unread,
May 11, 2016, 4:51:41 AM5/11/16
to Iris
You can use the set_extent() method of the GeoAxes class. The extent of the axes can be changed independently of the projection specification. This also allows you to choose the coordinate reference system you specify the map extent in. If you want to specify extents in latitude/longitude the correct form would be

...
p
= ccrs.LambertConformal(...) # Use whatever keywords you require for your map e.g.
                               
# standard_parallels, central_latitude, central_longitude
ax
= plt.axes(projection=p)
ax
.set_extent([lonmin, lonmax, latmin, latmax], crs=ccrs.PlateCarree())
...

A particular example that plots a map showing most of the USA:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt


p
= ccrs.LambertConformal(central_longitude=262.5, central_latitude=38.5, standard_parallels=(38.5, 38.5))
ax
= plt.axes(projection=p)
ax
.set_extent([-140, -60, 20, 70], crs=ccrs.PlateCarree())
ax
.coastlines()
ax
.gridlines()
plt
.show()

Which produces the attached:

tjang

unread,
May 11, 2016, 10:35:18 PM5/11/16
to Iris
Thanks, Andrew.

What's the meaning of lonmin, lonmax, latmin, latmax?
Are they the left and right corner points?

2016년 5월 11일 수요일 오후 5시 17분 18초 UTC+9, tjang 님의 말:

Andrew Dawson

unread,
May 16, 2016, 6:51:29 AM5/16/16
to Iris
Not exactly. They are the corners of a box in a regular lat/lon projection. When setting the extent you are telling cartopy to make sure this box fits exactly inside the LCC projection. An example is probably useful, have a look at this notebook for an illustration.

Hope that helps.

tjang

unread,
May 19, 2016, 8:58:41 PM5/19/16
to Iris
Thank you.
I got it.


2016년 5월 11일 수요일 오후 5시 17분 18초 UTC+9, tjang 님의 말:
Hello, 
Reply all
Reply to author
Forward
0 new messages