TNO Intern

Commit ebdc0d1d authored by Arjo Segers's avatar Arjo Segers
Browse files

Trap errors from drawing coastlines and country borders.

parent 4ed9e8f5
Loading
Loading
Loading
Loading
+32 −4
Original line number Diff line number Diff line
#
# Changes
# 
# 2022-09, Arjo Segers, Met-Norway
#   Updated documentation.
#
# 2022-02, Arjo Segers, Met-Norway
#   Updated arguments for plotting hist2d to avoid deprication warnings.
#

########################################################################
###
### help
###
########################################################################

"""
.. _cso-plot:
@@ -365,12 +379,26 @@ def Setup_BaseMap( ax, title=None, domain=None, raster=None,
    # add title:
    if title is not None : ax.set_title( title )

    # add coast lines:
    if coastlines : m.drawcoastlines()
    # add coast lines, might fail ..
    if coastlines :
        try :
            m.drawcoastlines()
        except :
            #print( 'WARNING - could not draw coast lines, skip ...' )
            pass
        #endtry
    #endif # coastlines
    # add rivers ?
    if rivers : m.drawrivers()
    # add country borders ?
    if countries : m.drawcountries()
    if type(countries) == bool :
        with_countries = countries
        country_kwargs = {}
    else :
        with_countries = True
        country_kwargs = countries
    #endif
    if with_countries : m.drawcountries( **country_kwargs )

    # add raster ?
    if raster is not None :
@@ -1208,7 +1236,7 @@ class ColorbarFigure( Figure ) :
        hist2d_kwargs = {}
        hist2d_kwargs.update( { 'bins'   : bins } )
        hist2d_kwargs.update( { 'cmap'   : self.cmap } )
        hist2d_kwargs.update( { 'normed' : normed } )
        hist2d_kwargs.update( { 'density' : normed } )
        hist2d_kwargs.update( kwargs )
        
        # add to map: