Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8971551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:59:06+00:00 2026-06-15T17:59:06+00:00

I really like the idea that cartopy can automatically plot in different map projections.

  • 0

I really like the idea that cartopy can automatically plot in different map projections. However, I couldn’t figure out how to do with the Iris cubes. As its a sister project, I expected that I might be able to. Is it possible to do something like this?

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

someCube = I.load('someCube.pp')
ax = plt.axes(projection=ccrs.Robinson())
I.plot.contourf(someCube, transform=ccrs.Robinson())
plt.show()

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:59:06+00:00Added an answer on June 15, 2026 at 5:59 pm

    I took your pseudo code and made it runnable with Iris’ sample data:

    import iris
    import iris.plot as iplt
    import cartopy.crs as ccrs
    import matplotlib.pyplot as plt
    
    
    fname = iris.sample_data_path('air_temp.pp')
    air_temp = iris.load_cube(fname)
    
    ax = plt.axes(projection=ccrs.Robinson())
    iplt.contourf(air_temp, transform=ccrs.Robinson(central_longitude=180))
    ax.coastlines()
    
    plt.show()
    

    If you run this code, you will get an exception along the lines of:

    Traceback (most recent call last):
      File "using_custom_projections.py", line 11, in <module>
        iris.plot.contourf(air_temp, transform=ccrs.Robinson())
      File "lib/iris/plot.py", line 452, in contourf
        result = _draw_2d_from_points('contourf', None, cube, *args, **kwargs)
      File "lib/iris/plot.py", line 263, in _draw_2d_from_points
        result = _map_common(draw_method_name, arg_func, iris.coords.POINT_MODE, cube, data, *args, **kwargs)
      File "lib/iris/plot.py", line 406, in _map_common
        assert 'transform' not in kwargs, 'Transform keyword is not allowed.'
    AssertionError: Transform keyword is not allowed.
    

    Which is trying to tell you that you do not need to tell it which “transform” (or coordinate system) the cube is in. The reason for that is that an Iris cube should contain full metadata about the underlying data: the coordinate systems is part of that metadata.

    So, to get the example to work, you can simply remove the transform keyword argument in your contourf call:

    import iris
    import iris.plot as iplt
    import cartopy.crs as ccrs
    import matplotlib.pyplot as plt
    
    
    fname = iris.sample_data_path('air_temp.pp')
    air_temp = iris.load_cube(fname)
    
    ax = plt.axes(projection=ccrs.Robinson(central_longitude=180))
    iplt.contourf(air_temp)
    ax.coastlines()
    
    plt.show()
    

    contoured result

    There is a similar example in the iris gallery, specifically http://scitools.org.uk/iris/docs/latest/examples/graphics/rotated_pole_mapping.html#rotated-pole-mapping-03 (the very last plot in the example).

    HTH,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really like the Entity Framework Code First idea because I can rapidly prototype
I really like the idea of automatic binding generation like SWIG does. But it
I'm working on a REST API and I really like the idea of using
Hi I'm new to Linux and I really like the idea of writing and
I really like the idea of working with catamorphisms/anamorphisms in a generic way, but
I really like the idea of validating forms client-side before doing so server-side. If
I don't really like the idea of defining user required pages in the web.config,
Simple question: I really like the idea of encapsulation, but I really don't know
I really like git. At least, I like the idea of git. Being able
One of the features I really like about Netbeans is that when you click

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.