gpm.accessor package#
Submodules#
gpm.accessor.methods module#
This module defines GPM-API xarray accessors.
- class gpm.accessor.methods.GPM_Base_Accessor(xarray_obj)[source][source]#
Bases:
object
- collocate(product, product_type='RS', version=None, scan_modes=None, variables=None, groups=None, verbose=True, decode_cf=True, chunks={})[source][source]#
Collocate a product on the provided dataset.
It assumes that along all the input dataset, there is an approximate collocated product.
- extract_transect_around_point(point, azimuth, distance, steps=100, method='linear', new_dim='transect')[source][source]#
- extract_transect_between_points(start_point, end_point, steps=100, method='linear', new_dim='transect')[source][source]#
- get_slices_contiguous_granules(min_size=2)[source][source]#
Return a list of slices ensuring contiguous granules.
The minimum size of the output slices is
2
.Note: for GRID (i.e. IMERG) products, it checks for regular timesteps ! Note: No
granule_id
is provided for GRID products.- Parameters:
xr_obj (xarray.DataArray or xarray.Dataset) – GPM xarray object.
min_size (int) – Minimum size for a slice to be returned.
- Returns:
list_slices – List of slice object to select contiguous granules. Output format:
[slice(start,stop), slice(start,stop),...]
- Return type:
- get_slices_contiguous_scans(min_size=2, min_n_scans=3, x='lon', y='lat', along_track_dim='along_track', cross_track_dim='cross_track')[source][source]#
Return a list of slices ensuring contiguous scans (and granules).
It checks for contiguous scans only in the middle of the cross-track ! If a scan geolocation is NaN, it will be considered non-contiguous.
An input with less than 3 scans (along-track) returns an empty list, since scan contiguity can’t be verified. Consecutive non-contiguous scans are discarded and not included in the outputs. The minimum size of the output slices is
2
.- Parameters:
xr_obj (xarray.DataArray or xarray.Dataset) – GPM xarray object.
min_size (int) – Minimum size for a slice to be returned.
- Returns:
list_slices – List of slice object to select contiguous scans. Output format:
[slice(start,stop), slice(start,stop),...]
- Return type:
- get_slices_regular(min_size=None, min_n_scans=3, x='lon', y='lat', along_track_dim='along_track', cross_track_dim='cross_track')[source][source]#
Return a list of slices to select regular GPM objects.
For GPM ORBITS, it returns slices to select contiguous scans with valid geolocation. For GPM GRID, it returns slices to select periods with regular timesteps.
For more information, read the documentation of: -
gpm.utils.checks.get_slices_contiguous_scans
-gpm.utils.checks.get_slices_regular_time
- Parameters:
xr_obj (xarray.DataArray or xarray.Dataset) – GPM xarray object.
min_size (int) – Minimum size for a slice to be returned. If
None
, default to1
for GRID objects,2
for ORBIT objects.min_n_scans (int) – Minimum number of scans to be able to check for scan contiguity. For visualization purpose, this value might want to be set to
2
. This parameter applies only to ORBIT objects.
- Returns:
list_slices – List of slice object to select regular portions. Output format:
[slice(start,stop), slice(start,stop),...]
- Return type:
- get_slices_regular_time(tolerance=None, min_size=1)[source][source]#
Return a list of slices ensuring timesteps to be regular.
Output format: [slice(start,stop), slice(start,stop),…]
Consecutive non-regular timesteps leads to slices of size 1. An xarray object with a single timestep leads to a slice of size 1. If min_size=1 (the default), such slices are returned.
- Parameters:
xr_obj (xarray.DataArray or xarray.Dataset) – GPM xarray object.
tolerance (numpy.timedelta64, optional) – The timedelta tolerance to define regular vs. non-regular timesteps. The default is
None
. If GPM GRID object, it uses the first 2 timesteps to derive the tolerance timedelta. If GPM ORBIT object, it uses theORBIT_TIME_TOLERANCE
.min_size (int) – Minimum size for a slice to be returned.
- Returns:
list_slices – List of slice object to select regular time intervals. Output format:
[slice(start,stop), slice(start,stop),...]
- Return type:
- get_slices_valid_geolocation(min_size=2, x='lon', y='lat', along_track_dim='along_track', cross_track_dim='cross_track')[source][source]#
Return a list of GPM ORBIT along-track slices with valid geolocation.
The minimum size of the output slices is
2
.If at a given cross-track index, there are always wrong geolocation, it discards such cross-track index(es) before identifying the along-track slices.
- Parameters:
xr_obj (xarray.DataArray or xarray.Dataset) – GPM ORBIT xarray object.
min_size (int) – Minimum size for a slice to be returned. The default is
2
.
- Returns:
list_slices – List of slice object with valid geolocation. Output format:
[slice(start,stop), slice(start,stop),...]
- Return type:
- isel(indexers=None, drop=False, **indexers_kwargs)[source][source]#
Perform index-based dimension selection.
- plot_map_mesh(x=None, y=None, ax=None, edgecolors='k', linewidth=0.1, add_background=True, fig_kwargs=None, subplot_kwargs=None, **plot_kwargs)[source][source]#
- plot_map_mesh_centroids(x=None, y=None, ax=None, c='r', s=1, add_background=True, fig_kwargs=None, subplot_kwargs=None, **plot_kwargs)[source][source]#
Plot GPM orbit granule mesh centroids in a cartographic map.
- plot_swath(ax=None, facecolor='orange', edgecolor='black', alpha=0.4, add_background=True, fig_kwargs=None, subplot_kwargs=None, **plot_kwargs)[source][source]#
Plot GPM orbit granule.
- plot_swath_lines(ax=None, x='lon', y='lat', linestyle='--', color='k', add_background=True, subplot_kwargs=None, fig_kwargs=None, **plot_kwargs)[source][source]#
Plot GPM orbit granule swath lines.
- plot_transect_line(ax=None, add_direction=True, add_background=True, fig_kwargs=None, subplot_kwargs=None, text_kwargs=None, line_kwargs=None, **common_kwargs)[source][source]#
- quadmesh_centroids(crs=None, origin='bottom')[source][source]#
Return quadmesh x and y centroids of shaope (N,M).
- quadmesh_vertices(crs=None, ccw=True, origin='bottom')[source][source]#
Return the quadmesh vertices array with shape (N, M, 4, 2).
- remap_on(dst_ds, radius_of_influence=20000, fill_value=nan)[source][source]#
Remap dataset to another one using nearest-neighbour.
- sel(indexers=None, drop=False, **indexers_kwargs)[source][source]#
Perform value-based coordinate selection.
Slices are treated as inclusive of both the start and stop values, unlike normal Python indexing. The gpm sel method is empowered to:
slice by gpm-id strings !
slice by any xarray coordinate value !
You can use string shortcuts for datetime coordinates (e.g., ‘2000-01’ to select all values in January 2000).
- subset_by_time(start_time=None, end_time=None)[source][source]#
Filter a GPM xarray object by start_time and end_time.
- Parameters:
xr_obj – A xarray object.
start_time (datetime.datetime) – Start time. By default is
None
end_time (datetime.datetime) – End time. By default is
None
- Returns:
xr_obj – GPM xarray object
- Return type:
- class gpm.accessor.methods.GPM_DataArray_Accessor(xarray_obj)[source][source]#
Bases:
GPM_Base_Accessor
- get_slices_var_between(dim, vmin=-inf, vmax=inf, criteria='all')[source][source]#
Return a list of slices along the dim dimension where values are between the interval.
If the xarray.DataArray has additional dimensions, the
criteria
parameter is used to determine whether all values within each slice index must be between the interval (if set to"all"
) or if at least one value within the slice index must be between the interval (if set to"any"
).
- get_slices_var_equals(dim, values, union=True, criteria='all')[source][source]#
Return a list of slices along the dim dimension where values occurs.
The function is applied recursively to each value in values. If the xarray.DataArray has additional dimensions, the “criteria” parameter is used to determine whether all values within each slice index must be equal to value (if set to
"all"
) or if at least one value within the slice index must be equal to value (if set to"any"
).If values are a list of values: - if
union=True
, it return slices corresponding to the sequence of consecutive values. - ifunion=False
, it return slices for each value in values.If
union=False
[0,0, 1, 1]
withvalues=[0,1]
will return[slice(0,2), slice(2,4)]
Ifunion=True
[0,0, 1, 1] withvalues=[0,1]
will return[slice(0,4)]
union matters when multiple values are specified criteria matters when the xarray.DataArray has multiple dimensions.
- plot_cross_section(x=None, y=None, ax=None, add_colorbar=True, zoom=True, interpolation='nearest', fig_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot GPM cross-section.
If RGB DataArray, all other plot_kwargs are ignored !
- plot_image(x=None, y=None, ax=None, add_colorbar=True, interpolation='nearest', fig_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot data using imshow.
- Parameters:
da (xarray.DataArray) – xarray DataArray.
x (str, optional) – X dimension name. If
None
, takes the second dimension. The default isNone
.y (str, optional) – Y dimension name. If
None
, takes the first dimension. The default isNone
.ax (cartopy.mpl.geoaxes.GeoAxes, optional) – The matplotlib axes where to plot the image. If
None
, a figure is initialized using the specifiedfig_kwargs
. The default isNone
.add_colorbar (bool, optional) – Whether to add a colorbar. The default is
True
.interpolation (str, optional) – Argument to be passed to imshow. The default is
"nearest"
.fig_kwargs (dict, optional) – Figure options to be passed to
matplotlib.pyplot.subplots
. The default isNone
. Only used ifax
isNone
.subplot_kwargs (dict, optional) – Subplot options to be passed to
matplotlib.pyplot.subplots
. The default isNone
. Only used if`ax`
isNone
.cbar_kwargs (dict, optional) – Colorbar options. The default is
None
.**plot_kwargs – Additional arguments to be passed to the plotting function. Examples include
cmap
,norm
,vmin
,vmax
,levels
, … For FacetGrid plots, specifyrow
,col
andcol_wrap
. Withrgb
you can specify the name of the xarray.DataArray RGB dimension.
- plot_map(x=None, y=None, ax=None, add_colorbar=True, add_swath_lines=True, add_background=True, interpolation='nearest', fig_kwargs=None, subplot_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot data on a geographic map.
- Parameters:
da (xarray.DataArray) – xarray DataArray.
x (str, optional) – Longitude coordinate name. If
None
, takes the second dimension. The default isNone
.y (str, optional) – Latitude coordinate name. If
None
, takes the first dimension. The default isNone
.ax (cartopy.mpl.geoaxes.GeoAxes, optional) – The cartopy GeoAxes where to plot the map. If
None
, a figure is initialized using the specifiedfig_kwargs
andsubplot_kwargs
. The default isNone
.add_colorbar (bool, optional) – Whether to add a colorbar. The default is
True
.add_swath_lines (bool, optional) – Whether to plot the swath sides with a dashed line. The default is
True
. This argument only applies for ORBIT objects.add_background (bool, optional) – Whether to add the map background. The default is
True
.interpolation (str, optional) – Argument to be passed to
matplotlib.axes.Axes.imshow
. Only applies for GRID objects. The default is"nearest"
.fig_kwargs (dict, optional) – Figure options to be passed to matplotlib.pyplot.subplots. The default is
None
. Only used ifax
isNone
.subplot_kwargs (dict, optional) – Dictionary of keyword arguments for
matplotlib.pyplot.subplots
. Must contain the Cartopy CRS `projection
key if specified. The default isNone
. Only used ifax
isNone
.cbar_kwargs (dict, optional) – Colorbar options. The default is
None
.**plot_kwargs – Additional arguments to be passed to the plotting function. Examples include
cmap
,norm
,vmin
,vmax
,levels
, … For FacetGrid plots, specifyrow
,col
andcol_wrap
. Withrgb
you can specify the name of the xarray.DataArray RGB dimension.
- title(prefix_product=True, add_timestep=True, time_idx=None, resolution='m', timezone='UTC')[source][source]#
Generate the plot title for a GPM xarray.DataArray.
- Parameters:
da (xarray.DataArray) – GPM xarray DataArray.
prefix_product (bool, optional) – Whether to add the GPM product as prefix. The default is
True
.add_timestep (bool, optional) – Whether to add time information to the title. The default is
True
. For GRID objects (like IMERG), the timestep is added only if the xarray.DataArray has 1 timestep.time_idx (int, optional) – Index of timestep to select, instead of selecting the middle. The default is
None
.resolution (str, optional) – The maximum temporal resolution to display. The default is “m” (for minutes).
timezone (str, optional) – The timezone of the time to display. The default is “UTC” (as the reference timezone of the dataset).
- Returns:
title_str – Title of the xarray.DataArray.
- Return type:
- class gpm.accessor.methods.GPM_Dataset_Accessor(xarray_obj)[source][source]#
Bases:
GPM_Base_Accessor
- extract_l2_dataset(bin_ellipsoid='binEllipsoid', new_range_size=None, shortened_range=True)[source][source]#
- plot_cross_section(x=None, y=None, ax=None, add_colorbar=True, zoom=True, interpolation='nearest', fig_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot GPM cross-section.
If RGB DataArray, all other plot_kwargs are ignored !
- plot_image(x=None, y=None, ax=None, add_colorbar=True, interpolation='nearest', fig_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot data using imshow.
- Parameters:
da (xarray.DataArray) – xarray DataArray.
x (str, optional) – X dimension name. If
None
, takes the second dimension. The default isNone
.y (str, optional) – Y dimension name. If
None
, takes the first dimension. The default isNone
.ax (cartopy.mpl.geoaxes.GeoAxes, optional) – The matplotlib axes where to plot the image. If
None
, a figure is initialized using the specifiedfig_kwargs
. The default isNone
.add_colorbar (bool, optional) – Whether to add a colorbar. The default is
True
.interpolation (str, optional) – Argument to be passed to imshow. The default is
"nearest"
.fig_kwargs (dict, optional) – Figure options to be passed to
matplotlib.pyplot.subplots
. The default isNone
. Only used ifax
isNone
.subplot_kwargs (dict, optional) – Subplot options to be passed to
matplotlib.pyplot.subplots
. The default isNone
. Only used if`ax`
isNone
.cbar_kwargs (dict, optional) – Colorbar options. The default is
None
.**plot_kwargs – Additional arguments to be passed to the plotting function. Examples include
cmap
,norm
,vmin
,vmax
,levels
, … For FacetGrid plots, specifyrow
,col
andcol_wrap
. Withrgb
you can specify the name of the xarray.DataArray RGB dimension.
- plot_map(x=None, y=None, ax=None, add_colorbar=True, add_swath_lines=True, add_background=True, interpolation='nearest', fig_kwargs=None, subplot_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot data on a geographic map.
- Parameters:
da (xarray.DataArray) – xarray DataArray.
x (str, optional) – Longitude coordinate name. If
None
, takes the second dimension. The default isNone
.y (str, optional) – Latitude coordinate name. If
None
, takes the first dimension. The default isNone
.ax (cartopy.mpl.geoaxes.GeoAxes, optional) – The cartopy GeoAxes where to plot the map. If
None
, a figure is initialized using the specifiedfig_kwargs
andsubplot_kwargs
. The default isNone
.add_colorbar (bool, optional) – Whether to add a colorbar. The default is
True
.add_swath_lines (bool, optional) – Whether to plot the swath sides with a dashed line. The default is
True
. This argument only applies for ORBIT objects.add_background (bool, optional) – Whether to add the map background. The default is
True
.interpolation (str, optional) – Argument to be passed to
matplotlib.axes.Axes.imshow
. Only applies for GRID objects. The default is"nearest"
.fig_kwargs (dict, optional) – Figure options to be passed to matplotlib.pyplot.subplots. The default is
None
. Only used ifax
isNone
.subplot_kwargs (dict, optional) – Dictionary of keyword arguments for
matplotlib.pyplot.subplots
. Must contain the Cartopy CRS `projection
key if specified. The default isNone
. Only used ifax
isNone
.cbar_kwargs (dict, optional) – Colorbar options. The default is
None
.**plot_kwargs – Additional arguments to be passed to the plotting function. Examples include
cmap
,norm
,vmin
,vmax
,levels
, … For FacetGrid plots, specifyrow
,col
andcol_wrap
. Withrgb
you can specify the name of the xarray.DataArray RGB dimension.
- title(add_timestep=True, time_idx=None, resolution='m', timezone='UTC')[source][source]#
Generate the GPM Dataset title.
- Parameters:
ds (xarray.Dataset) – GPM xarray Dataset.
add_timestep (bool, optional) – Whether to add time information to the title. The default is
True
. For GRID objects (like IMERG), the timestep is added only if the xarray.DataArray has 1 timestep.time_idx (int, optional) – Index of timestep to select, instead of selecting the middle. The default is
None
.resolution (str, optional) – The maximum temporal resolution to display. The default is “m” (for minutes).
timezone (str, optional) – The timezone of the time to display. The default is “UTC” (as the reference timezone of the dataset).
- Returns:
title_str – Title of the Dataset.
- Return type:
- to_dask_dataframe()[source][source]#
Convert an xarray.Dataset to a
dask.dataframe.DataFrame
.
- to_pandas_dataframe()[source][source]#
Convert an xarray.Dataset to a
pandas.DataFrame
.
- gpm.accessor.methods.auto_wrap_docstring(func)[source][source]#
Decorator to add the source function docstring to the accessor method.
Module contents#
This directory defines GPM-API xarray accessors.
- class gpm.accessor.GPM_DataArray_Accessor(xarray_obj)[source][source]#
Bases:
GPM_Base_Accessor
- get_slices_var_between(dim, vmin=-inf, vmax=inf, criteria='all')[source][source]#
Return a list of slices along the dim dimension where values are between the interval.
If the xarray.DataArray has additional dimensions, the
criteria
parameter is used to determine whether all values within each slice index must be between the interval (if set to"all"
) or if at least one value within the slice index must be between the interval (if set to"any"
).
- get_slices_var_equals(dim, values, union=True, criteria='all')[source][source]#
Return a list of slices along the dim dimension where values occurs.
The function is applied recursively to each value in values. If the xarray.DataArray has additional dimensions, the “criteria” parameter is used to determine whether all values within each slice index must be equal to value (if set to
"all"
) or if at least one value within the slice index must be equal to value (if set to"any"
).If values are a list of values: - if
union=True
, it return slices corresponding to the sequence of consecutive values. - ifunion=False
, it return slices for each value in values.If
union=False
[0,0, 1, 1]
withvalues=[0,1]
will return[slice(0,2), slice(2,4)]
Ifunion=True
[0,0, 1, 1] withvalues=[0,1]
will return[slice(0,4)]
union matters when multiple values are specified criteria matters when the xarray.DataArray has multiple dimensions.
- plot_cross_section(x=None, y=None, ax=None, add_colorbar=True, zoom=True, interpolation='nearest', fig_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot GPM cross-section.
If RGB DataArray, all other plot_kwargs are ignored !
- plot_image(x=None, y=None, ax=None, add_colorbar=True, interpolation='nearest', fig_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot data using imshow.
- Parameters:
da (xarray.DataArray) – xarray DataArray.
x (str, optional) – X dimension name. If
None
, takes the second dimension. The default isNone
.y (str, optional) – Y dimension name. If
None
, takes the first dimension. The default isNone
.ax (cartopy.mpl.geoaxes.GeoAxes, optional) – The matplotlib axes where to plot the image. If
None
, a figure is initialized using the specifiedfig_kwargs
. The default isNone
.add_colorbar (bool, optional) – Whether to add a colorbar. The default is
True
.interpolation (str, optional) – Argument to be passed to imshow. The default is
"nearest"
.fig_kwargs (dict, optional) – Figure options to be passed to
matplotlib.pyplot.subplots
. The default isNone
. Only used ifax
isNone
.subplot_kwargs (dict, optional) – Subplot options to be passed to
matplotlib.pyplot.subplots
. The default isNone
. Only used if`ax`
isNone
.cbar_kwargs (dict, optional) – Colorbar options. The default is
None
.**plot_kwargs – Additional arguments to be passed to the plotting function. Examples include
cmap
,norm
,vmin
,vmax
,levels
, … For FacetGrid plots, specifyrow
,col
andcol_wrap
. Withrgb
you can specify the name of the xarray.DataArray RGB dimension.
- plot_map(x=None, y=None, ax=None, add_colorbar=True, add_swath_lines=True, add_background=True, interpolation='nearest', fig_kwargs=None, subplot_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot data on a geographic map.
- Parameters:
da (xarray.DataArray) – xarray DataArray.
x (str, optional) – Longitude coordinate name. If
None
, takes the second dimension. The default isNone
.y (str, optional) – Latitude coordinate name. If
None
, takes the first dimension. The default isNone
.ax (cartopy.mpl.geoaxes.GeoAxes, optional) – The cartopy GeoAxes where to plot the map. If
None
, a figure is initialized using the specifiedfig_kwargs
andsubplot_kwargs
. The default isNone
.add_colorbar (bool, optional) – Whether to add a colorbar. The default is
True
.add_swath_lines (bool, optional) – Whether to plot the swath sides with a dashed line. The default is
True
. This argument only applies for ORBIT objects.add_background (bool, optional) – Whether to add the map background. The default is
True
.interpolation (str, optional) – Argument to be passed to
matplotlib.axes.Axes.imshow
. Only applies for GRID objects. The default is"nearest"
.fig_kwargs (dict, optional) – Figure options to be passed to matplotlib.pyplot.subplots. The default is
None
. Only used ifax
isNone
.subplot_kwargs (dict, optional) – Dictionary of keyword arguments for
matplotlib.pyplot.subplots
. Must contain the Cartopy CRS `projection
key if specified. The default isNone
. Only used ifax
isNone
.cbar_kwargs (dict, optional) – Colorbar options. The default is
None
.**plot_kwargs – Additional arguments to be passed to the plotting function. Examples include
cmap
,norm
,vmin
,vmax
,levels
, … For FacetGrid plots, specifyrow
,col
andcol_wrap
. Withrgb
you can specify the name of the xarray.DataArray RGB dimension.
- title(prefix_product=True, add_timestep=True, time_idx=None, resolution='m', timezone='UTC')[source][source]#
Generate the plot title for a GPM xarray.DataArray.
- Parameters:
da (xarray.DataArray) – GPM xarray DataArray.
prefix_product (bool, optional) – Whether to add the GPM product as prefix. The default is
True
.add_timestep (bool, optional) – Whether to add time information to the title. The default is
True
. For GRID objects (like IMERG), the timestep is added only if the xarray.DataArray has 1 timestep.time_idx (int, optional) – Index of timestep to select, instead of selecting the middle. The default is
None
.resolution (str, optional) – The maximum temporal resolution to display. The default is “m” (for minutes).
timezone (str, optional) – The timezone of the time to display. The default is “UTC” (as the reference timezone of the dataset).
- Returns:
title_str – Title of the xarray.DataArray.
- Return type:
- class gpm.accessor.GPM_Dataset_Accessor(xarray_obj)[source][source]#
Bases:
GPM_Base_Accessor
- extract_l2_dataset(bin_ellipsoid='binEllipsoid', new_range_size=None, shortened_range=True)[source][source]#
- plot_cross_section(x=None, y=None, ax=None, add_colorbar=True, zoom=True, interpolation='nearest', fig_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot GPM cross-section.
If RGB DataArray, all other plot_kwargs are ignored !
- plot_image(x=None, y=None, ax=None, add_colorbar=True, interpolation='nearest', fig_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot data using imshow.
- Parameters:
da (xarray.DataArray) – xarray DataArray.
x (str, optional) – X dimension name. If
None
, takes the second dimension. The default isNone
.y (str, optional) – Y dimension name. If
None
, takes the first dimension. The default isNone
.ax (cartopy.mpl.geoaxes.GeoAxes, optional) – The matplotlib axes where to plot the image. If
None
, a figure is initialized using the specifiedfig_kwargs
. The default isNone
.add_colorbar (bool, optional) – Whether to add a colorbar. The default is
True
.interpolation (str, optional) – Argument to be passed to imshow. The default is
"nearest"
.fig_kwargs (dict, optional) – Figure options to be passed to
matplotlib.pyplot.subplots
. The default isNone
. Only used ifax
isNone
.subplot_kwargs (dict, optional) – Subplot options to be passed to
matplotlib.pyplot.subplots
. The default isNone
. Only used if`ax`
isNone
.cbar_kwargs (dict, optional) – Colorbar options. The default is
None
.**plot_kwargs – Additional arguments to be passed to the plotting function. Examples include
cmap
,norm
,vmin
,vmax
,levels
, … For FacetGrid plots, specifyrow
,col
andcol_wrap
. Withrgb
you can specify the name of the xarray.DataArray RGB dimension.
- plot_map(x=None, y=None, ax=None, add_colorbar=True, add_swath_lines=True, add_background=True, interpolation='nearest', fig_kwargs=None, subplot_kwargs=None, cbar_kwargs=None, **plot_kwargs)[source][source]#
Plot data on a geographic map.
- Parameters:
da (xarray.DataArray) – xarray DataArray.
x (str, optional) – Longitude coordinate name. If
None
, takes the second dimension. The default isNone
.y (str, optional) – Latitude coordinate name. If
None
, takes the first dimension. The default isNone
.ax (cartopy.mpl.geoaxes.GeoAxes, optional) – The cartopy GeoAxes where to plot the map. If
None
, a figure is initialized using the specifiedfig_kwargs
andsubplot_kwargs
. The default isNone
.add_colorbar (bool, optional) – Whether to add a colorbar. The default is
True
.add_swath_lines (bool, optional) – Whether to plot the swath sides with a dashed line. The default is
True
. This argument only applies for ORBIT objects.add_background (bool, optional) – Whether to add the map background. The default is
True
.interpolation (str, optional) – Argument to be passed to
matplotlib.axes.Axes.imshow
. Only applies for GRID objects. The default is"nearest"
.fig_kwargs (dict, optional) – Figure options to be passed to matplotlib.pyplot.subplots. The default is
None
. Only used ifax
isNone
.subplot_kwargs (dict, optional) – Dictionary of keyword arguments for
matplotlib.pyplot.subplots
. Must contain the Cartopy CRS `projection
key if specified. The default isNone
. Only used ifax
isNone
.cbar_kwargs (dict, optional) – Colorbar options. The default is
None
.**plot_kwargs – Additional arguments to be passed to the plotting function. Examples include
cmap
,norm
,vmin
,vmax
,levels
, … For FacetGrid plots, specifyrow
,col
andcol_wrap
. Withrgb
you can specify the name of the xarray.DataArray RGB dimension.
- title(add_timestep=True, time_idx=None, resolution='m', timezone='UTC')[source][source]#
Generate the GPM Dataset title.
- Parameters:
ds (xarray.Dataset) – GPM xarray Dataset.
add_timestep (bool, optional) – Whether to add time information to the title. The default is
True
. For GRID objects (like IMERG), the timestep is added only if the xarray.DataArray has 1 timestep.time_idx (int, optional) – Index of timestep to select, instead of selecting the middle. The default is
None
.resolution (str, optional) – The maximum temporal resolution to display. The default is “m” (for minutes).
timezone (str, optional) – The timezone of the time to display. The default is “UTC” (as the reference timezone of the dataset).
- Returns:
title_str – Title of the Dataset.
- Return type:
- to_dask_dataframe()[source][source]#
Convert an xarray.Dataset to a
dask.dataframe.DataFrame
.
- to_pandas_dataframe()[source][source]#
Convert an xarray.Dataset to a
pandas.DataFrame
.