src/pys5p/s5p_geoplot.py
def draw_geo_msm(self, gridlon, gridlat, data_in, *,
                     whole_globe=False, vperc=None, vrange=None,
                     title=None, sub_title=None, fig_info=None):
        """
        Show measurement data projected with (better) TransverseMercator.

        Parameters
        ----------
        gridlon :  array_like
        gridlat :  array_like
           The coordinates of the quadrilateral corners, with dimensions one
           larger then data
        data :  array_like or xarray.DataArray
           Measurement data as a scalar 2-D array. The values will be
           color-mapped.
        whole_globe :  boolean
           Show the whole globe
        vrange :  list [vmin,vmax]
           Range to normalize luminance data between vmin and vmax.
        vperc :  list
           Range to normalize luminance data between percentiles min and max of
           array data. Default is [1., 99.].
           keyword 'vperc' is ignored when vrange is given
        title :  string, optional
           Title of the figure. Default is None
           [Suggestion] use attribute "title" of data-product
        sub_title :  string, optional
           Sub-title of the figure. Default is None
           [Suggestion] use attribute "comment" of data-product
        fig_info :  FIGinfo, optional
           OrderedDict holding meta-data to be displayed in the figure

        The information provided in the parameter 'fig_info' will be displayed
        in a small box. In addition, we display the creation date and the data
        (biweight) median & spread.
        """
        if fig_info is None:
            fig_info = FIGinfo()

        if vrange is None and vperc is None:
            vperc = (1., 99.)
        elif vrange is None:
            if len(vperc) != 2:
                raise TypeError('keyword vperc requires two values')
        else:
            if len(vrange) != 2:
                raise TypeError('keyword vrange requires two values')

        # check image data
        try:
            check_data2d('data', data_in)
        except Exception as exc:
            raise RuntimeError('invalid input-data provided') from exc

        if isinstance(data_in, np.ndarray):
            img_data = data_in.copy()
        else:
            img_data = data_in.values.copy()
            self.set_zunit(data_in.attrs["units"])

        # define data-range
        if vrange is None:
            vmin, vmax = np.nanpercentile(img_data, vperc)
        else:
            vmin, vmax = vrange

        # determine central longitude
        if gridlon.max() - gridlon.min() > 180:
            if np.sum(gridlon > 0) > np.sum(gridlon < 0):
                gridlon[gridlon < 0] += 360
            else:
                gridlon[gridlon > 0] -= 360
        lon_0 = np.around(np.mean(gridlon), decimals=-1)

        # define projection
        myproj = BetterTransverseMercator(
            central_longitude=lon_0, globe=ccrs.Globe(ellipse='sphere'))

        # inititalize figure
        fig, axx = plt.subplots(1, 1, figsize=(12.5, 9),
                                subplot_kw={'projection': myproj})
        if title is not None:
            ypos = 1 - 0.35 / fig.get_figheight()
            fig.suptitle(title, fontsize='x-large',
                         position=(0.5, ypos), horizontalalignment='center')
        if sub_title is not None:
            axx.set_title(sub_title, fontsize='large')

        # Add the colorbar axes anywhere in the figure.
        # Its position will be re-calculated at each figure resize.
        cax = fig.add_axes([0, 0, 0.1, 0.1])
        fig.subplots_adjust(hspace=0, wspace=0, left=0.05, right=0.85)

        # define worldmap
        self.__draw_worldmap(axx, whole_globe)

        # draw image and colorbar
        img = axx.pcolormesh(gridlon, gridlat, img_data,
                             vmin=vmin, vmax=vmax,
                             cmap=self.get_cmap(),
                             transform=ccrs.PlateCarree())
        plt.draw()
        posn = axx.get_position()
        cax.set_position([posn.x0 + posn.width + 0.01,
                          posn.y0, 0.04, posn.height])

        zlabel = 'value' if self.zunit is None \
                 else f'value [{self.zunit}]'
        plt.colorbar(img, cax=cax, label=zlabel)

        # finalize figure
        self.__add_copyright(axx)
        fig_info.add('lon0', lon_0)
        self.__add_fig_box(fig, fig_info)
        self.__close_this_page(fig)

        Show measurement data projected with (better) TransverseMercator.

        Parameters
        ----------
        gridlon :  array_like
        gridlat :  array_like
           The coordinates of the quadrilateral corners, with dimensions one
           larger then data
        data :  array_like or xarray.DataArray
           Measurement data as a scalar 2-D array. The values will be
           color-mapped.
        whole_globe :  boolean
           Show the whole globe
        vrange :  list [vmin,vmax]
           Range to normalize luminance data between vmin and vmax.
        vperc :  list
           Range to normalize luminance data between percentiles min and max of
           array data. Default is [1., 99.].
           keyword 'vperc' is ignored when vrange is given
        title :  string, optional
           Title of the figure. Default is None
           [Suggestion] use attribute "title" of data-product
        sub_title :  string, optional
           Sub-title of the figure. Default is None
           [Suggestion] use attribute "comment" of data-product
        fig_info :  FIGinfo, optional
           OrderedDict holding meta-data to be displayed in the figure

        The information provided in the parameter 'fig_info' will be displayed
        in a small box. In addition, we display the creation date and the data
        (biweight) median & spread.
        
Show measurement data projected with (better) TransverseMercator.
Parameters

gridlon :  array_like
gridlat :  array_like
The coordinates of the quadrilateral corners, with dimensions one
larger then data
data :  array_like or xarray.DataArray
Measurement data as a scalar 2-D array. The values will be
color-mapped.
whole_globe :  boolean
Show the whole globe
vrange :  list [vmin,vmax]
Range to normalize luminance data between vmin and vmax.
vperc :  list
Range to normalize luminance data between percentiles min and max of
array data.

The information provided in the parameter 'fig_info' will be displayed
in a small box. In addition, we display the creation date and the data
(biweight) median & spread.
Show measurement data projected with ( better ) TransverseMercator . Parameters gridlon : array_like gridlat : array_like The coordinates of the quadrilateral corners with dimensions one larger then data data : array_like or xarray . DataArray Measurement data as a scalar 2 - D array . The values will be color - mapped . whole_globe : boolean Show the whole globe vrange : list [ vmin vmax ] Range to normalize luminance data between vmin and vmax . vperc : list Range to normalize luminance data between percentiles min and max of array data . The information provided in the parameter ' fig_info ' will be displayed in a small box . In addition we display the creation date and the data ( biweight ) median & spread .
def draw_geo_msm(self, gridlon, gridlat, data_in, *,
                     whole_globe=False, vperc=None, vrange=None,
                     title=None, sub_title=None, fig_info=None):
        if fig_info is None:
            fig_info = FIGinfo()
        if vrange is None and vperc is None:
            vperc = (1., 99.)
        elif vrange is None:
            if len(vperc) != 2:
                raise TypeError('keyword vperc requires two values')
        else:
            if len(vrange) != 2:
                raise TypeError('keyword vrange requires two values')
        try:
            check_data2d('data', data_in)
        except Exception as exc:
            raise RuntimeError('invalid input-data provided') from exc
        if isinstance(data_in, np.ndarray):
            img_data = data_in.copy()
        else:
            img_data = data_in.values.copy()
            self.set_zunit(data_in.attrs["units"])
        if vrange is None:
            vmin, vmax = np.nanpercentile(img_data, vperc)
        else:
            vmin, vmax = vrange
        if gridlon.max() - gridlon.min() > 180:
            if np.sum(gridlon > 0) > np.sum(gridlon < 0):
                gridlon[gridlon < 0] += 360
            else:
                gridlon[gridlon > 0] -= 360
        lon_0 = np.around(np.mean(gridlon), decimals=-1)
        myproj = BetterTransverseMercator(
            central_longitude=lon_0, globe=ccrs.Globe(ellipse='sphere'))
        fig, axx = plt.subplots(1, 1, figsize=(12.5, 9),
                                subplot_kw={'projection': myproj})
        if title is not None:
            ypos = 1 - 0.35 / fig.get_figheight()
            fig.suptitle(title, fontsize='x-large',
                         position=(0.5, ypos), horizontalalignment='center')
        if sub_title is not None:
            axx.set_title(sub_title, fontsize='large')
        cax = fig.add_axes([0, 0, 0.1, 0.1])
        fig.subplots_adjust(hspace=0, wspace=0, left=0.05, right=0.85)
        self.__draw_worldmap(axx, whole_globe)
        img = axx.pcolormesh(gridlon, gridlat, img_data,
                             vmin=vmin, vmax=vmax,
                             cmap=self.get_cmap(),
                             transform=ccrs.PlateCarree())
        plt.draw()
        posn = axx.get_position()
        cax.set_position([posn.x0 + posn.width + 0.01,
                          posn.y0, 0.04, posn.height])
        zlabel = 'value' if self.zunit is None \
                 else f'value [{self.zunit}]'
        plt.colorbar(img, cax=cax, label=zlabel)
        self.__add_copyright(axx)
        fig_info.add('lon0', lon_0)
        self.__add_fig_box(fig, fig_info)
        self.__close_this_page(fig)
def draw_geo_msm ( self , gridlon , gridlat , data_in , * , whole_globe = False , vperc = None , vrange = None , title = None , sub_title = None , fig_info = None ) : if fig_info is None : fig_info = FIGinfo ( ) if vrange is None and vperc is None : vperc = ( 1. , 99. ) elif vrange is None : if len ( vperc ) != 2 : raise TypeError ( 'keyword vperc requires two values' ) else : if len ( vrange ) != 2 : raise TypeError ( 'keyword vrange requires two values' ) try : check_data2d ( 'data' , data_in ) except Exception as exc : raise RuntimeError ( 'invalid input-data provided' ) from exc if isinstance ( data_in , np . ndarray ) : img_data = data_in . copy ( ) else : img_data = data_in . values . copy ( ) self . set_zunit ( data_in . attrs [ "units" ] ) if vrange is None : vmin , vmax = np . nanpercentile ( img_data , vperc ) else : vmin , vmax = vrange if gridlon . max ( ) - gridlon . min ( ) > 180 : if np . sum ( gridlon > 0 ) > np . sum ( gridlon < 0 ) : gridlon [ gridlon < 0 ] += 360 else : gridlon [ gridlon > 0 ] -= 360 lon_0 = np . around ( np . mean ( gridlon ) , decimals = - 1 ) myproj = BetterTransverseMercator ( central_longitude = lon_0 , globe = ccrs . Globe ( ellipse = 'sphere' ) ) fig , axx = plt . subplots ( 1 , 1 , figsize = ( 12.5 , 9 ) , subplot_kw = { 'projection' : myproj } ) if title is not None : ypos = 1 - 0.35 / fig . get_figheight ( ) fig . suptitle ( title , fontsize = 'x-large' , position = ( 0.5 , ypos ) , horizontalalignment = 'center' ) if sub_title is not None : axx . set_title ( sub_title , fontsize = 'large' ) cax = fig . add_axes ( [ 0 , 0 , 0.1 , 0.1 ] ) fig . subplots_adjust ( hspace = 0 , wspace = 0 , left = 0.05 , right = 0.85 ) self . __draw_worldmap ( axx , whole_globe ) img = axx . pcolormesh ( gridlon , gridlat , img_data , vmin = vmin , vmax = vmax , cmap = self . get_cmap ( ) , transform = ccrs . PlateCarree ( ) ) plt . draw ( ) posn = axx . get_position ( ) cax . set_position ( [ posn . x0 + posn . width + 0.01 , posn . y0 , 0.04 , posn . height ] ) zlabel = 'value' if self . zunit is None else f'value [{self.zunit}]' plt . colorbar ( img , cax = cax , label = zlabel ) self . __add_copyright ( axx ) fig_info . add ( 'lon0' , lon_0 ) self . __add_fig_box ( fig , fig_info ) self . __close_this_page ( fig )
Show measurement data projected with (better) TransverseMercator.
Show measurement data projected with ( better ) TransverseMercator .
"""
        Show measurement data projected with (better) TransverseMercator.

        Parameters
        ----------
        gridlon :  array_like
        gridlat :  array_like
           The coordinates of the quadrilateral corners, with dimensions one
           larger then data
        data :  array_like or xarray.DataArray
           Measurement data as a scalar 2-D array. The values will be
           color-mapped.
        whole_globe :  boolean
           Show the whole globe
        vrange :  list [vmin,vmax]
           Range to normalize luminance data between vmin and vmax.
        vperc :  list
           Range to normalize luminance data between percentiles min and max of
           array data. Default is [1., 99.].
           keyword 'vperc' is ignored when vrange is given
        title :  string, optional
           Title of the figure. Default is None
           [Suggestion] use attribute "title" of data-product
        sub_title :  string, optional
           Sub-title of the figure. Default is None
           [Suggestion] use attribute "comment" of data-product
        fig_info :  FIGinfo, optional
           OrderedDict holding meta-data to be displayed in the figure

        The information provided in the parameter 'fig_info' will be displayed
        in a small box. In addition, we display the creation date and the data
        (biweight) median & spread.
        """ # check image data # define data-range # determine central longitude # define projection # inititalize figure # Add the colorbar axes anywhere in the figure. # Its position will be re-calculated at each figure resize. # define worldmap # draw image and colorbar # finalize figure
self
gridlon
gridlat
data_in
whole_globe
vperc
vrange
title
sub_title
fig_info