NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Jim So when you type: ax.set_extent([-135, -60, 10, 65], crs=ccrs.Mercator()) You are telling cartopy "set the extents of the axes to a box with lower left corner (-135, 10) and upper right corner (-60, 65); those points are native coordinates in the Mercator() projection". You essentially specified a 75m x 55m box. To plot with Mercator you want: # Tell cartopy the axes we're plotting on should be in Mercator ax = fig.add_subplot(1, 1, 1, projection=Mercator()) # Specify the extent as lat/lon ax.set_extent([-135, -60, 10, 65], crs=ccrs.PlateCarree()) Hope this helps! Ryan On Thu, Nov 18, 2021 at 11:54 AM Weber, Jim <Jim.Weber@xxxxxxx> wrote: > Below is a snippet of code from Brian Blaylock’s True Color Recipe. I am > trying to instead display imagery in a Mercator projection. I thought I > would do this with a line such as: > > mc=cartopy.ccrs.Mercator(*central_longitude=0.0*, *min_latitude=-80.0*, > *max_latitude=84.0*, *globe=None*) > > > > and then have lines: > > ax = fig.add_subplot(1, 1, 1, projection=mc) > > ax.set_extent([-135, -60, 10, 65], crs=ccrs.Mercator()) > > > > but this does not work. Can someone point out what I am doing wrong or > point me to the correct resource so I might understand my problem better? > > > > > > Thanks, Jim > > > > ------ Code snippet --------- > > > > > > fig = plt.figure(figsize=(15, 12)) > > > > # Generate an Cartopy projection > > lc = ccrs.LambertConformal(central_longitude=-97.5, > standard_parallels=(38.5, > > > 38.5)) > > > > ax = fig.add_subplot(1, 1, 1, projection=lc) > > ax.set_extent([-135, -60, 10, 65], crs=ccrs.PlateCarree()) > > > > ax.imshow(RGB, origin='upper', > > extent=(x.min(), x.max(), y.min(), y.max()), > > transform=geos, > > interpolation='none') > > ax.coastlines(resolution='50m', color='black', linewidth=0.5) > > ax.add_feature(ccrs.cartopy.feature.STATES, linewidth=0.5) > > > > plt.title('GOES-16 True Color', loc='left', fontweight='bold', fontsize=15) > > plt.title('{}'.format(scan_start.strftime('%d %B %Y %H:%M UTC ')), > loc='right') > > > > plt.show() > > > > > > > This message and its attachments may contain legally privileged or > confidential information. It is intended solely for the named addressee(s). > If you are not an addressee indicated in this message (or responsible for > delivery of the message to an addressee), you may not copy or deliver this > message or its attachments to anyone. Rather, you should permanently delete > this message and its attachments and kindly notify the sender by reply > e-mail. Any content of this message and its attachments that does not > relate to the official business of Fox Corporation, or its subsidiaries > must be taken not to have been sent or endorsed by any of them. No > representation is made that this email or its attachments are without > defect. > _______________________________________________ > NOTE: All exchanges posted to Unidata maintained email lists are > recorded in the Unidata inquiry tracking system and made publicly > available through the web. Users who post to any of the lists we > maintain are reminded to remove any personal information that they > do not want to be made public. > > > python-users mailing list > python-users@xxxxxxxxxxxxxxxx > For list information, to unsubscribe, or change your membership options, > visit: https://www.unidata.ucar.edu/mailing_lists/ > -- Ryan May, Ph.D. Software Engineer UCAR/Unidata Boulder, CO
python-users
archives: