How do I use high resolution coastlines?

1,375 views
Skip to first unread message

Nick Savage

unread,
Jul 24, 2013, 11:36:17 AM7/24/13
to scitoo...@googlegroups.com

I am trying to make some plots from a limited area model and while I can get coastlines on the plot, they are too low resolution for my needs (see attached example)

I tried this:
for yx_slice in tsurf.slices(['grid_latitude', 'grid_longitude']):
    i+=1
    print i
    # Draw the contour with 25 levels.
    plot=qplt.contourf(yx_slice, 25)
    plot.add_feature(cartopy.feature.COASTLINE)
    # Add coastlines to the map created by contourf.
    #plt.gca().coastlines()
    plt.show()

but it doesn't like it:
AttributeError: QuadContourSet instance has no attribute 'add_feature'

Most of the examples in the gallery are for global models and the ones which are for non global plots don't have any data.Could we have some more LAM specific examples please?
figure_1.png

pp-mo

unread,
Jul 24, 2013, 12:04:03 PM7/24/13
to scitoo...@googlegroups.com
I think you can just add an argument to the 'coastlines' method
Checkout the method  in the Cartopy documentation
 -- see http://scitools.org.uk/cartopy/docs/latest/matplotlib/geoaxes.html?highlight=coastlines#cartopy.mpl.geoaxes.GeoAxes.coastlines

You want something like 
plt.gca().coastlines('50m')

NOTE: '50m' means 1:50M resolution (not 50 metre). 
This is admittedly unclear !

Regards
Patrick

Message has been deleted

Nick Savage

unread,
Jul 24, 2013, 5:55:54 PM7/24/13
to scitoo...@googlegroups.com
Thanks, I'll try that out.


I feel there is a gap between the user guide - which covers basic usage well, and the reference documentation which is very detailed. I find it hard to work out where to look in the reference documentaiton for coastlines for example. In fact it is part of cartopy and documented there. How would I work that out from the example command: plt.gca().coastlines() ? This sort of intermediate type understanding seems to me to be essential to go from copying examples from the user guide and rweaking them, to getting the most out of Iris and Cartopy.

Nick Savage

unread,
Jul 25, 2013, 8:20:04 AM7/25/13
to scitoo...@googlegroups.com
That worked really well. Coastlines with 50m are just what I need, thank you. I think that it would be useful to include this on the page here:
http://scitools.org.uk/iris/docs/latest/examples/graphics/rotated_pole_mapping.html
as many people will want to do this.

Nick Savage

unread,
Jul 25, 2013, 9:29:51 AM7/25/13
to scitoo...@googlegroups.com
Just for completeness here is a plot using 50m and a couple of other tweaks. Much better!
ts200601041200.png
Reply all
Reply to author
Forward
0 new messages