gpm package#

Subpackages#

Submodules#

gpm.checks module#

This module defines functions providing GPM-API Dataset information.

gpm.checks.check_has_along_track_dim(xr_obj, dim='along_track')[source][source]#
gpm.checks.check_has_cross_track_dim(xr_obj, dim='cross_track')[source][source]#
gpm.checks.check_has_frequency_dim(xr_obj, strict=False, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset has a frequency dimension.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=False (default), the xarray.DataArray can also have additional dimensions. If strict=True , the xarray.DataArray must have just the spatial dimensions.

gpm.checks.check_has_spatial_dim(xr_obj, strict=False, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset has at least one spatial horizontal dimension.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=False (default), the xarray.DataArray can also have additional dimensions. If strict=True , the xarray.DataArray must have just the spatial dimensions.

gpm.checks.check_has_vertical_dim(xr_obj, strict=False, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset have a vertical dimension.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=False (default), the xarray.DataArray can also have additional dimensions. If strict=True , the xarray.DataArray must have just the vertical dimension.

gpm.checks.check_is_cross_section(xr_obj, strict=True, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset is a cross-section.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True (default), the xarray.DataArray must have just the vertical dimension and a horizontal dimension. If strict=False , the xarray.DataArray can also have additional dimensions, but only a single vertical and horizontal dimension.

gpm.checks.check_is_gpm_object(xr_obj)[source][source]#

Check is a GPM object (GRID or ORBIT).

gpm.checks.check_is_grid(xr_obj)[source][source]#

Check is a GPM GRID object.

gpm.checks.check_is_orbit(xr_obj)[source][source]#

Check is a GPM ORBIT object.

gpm.checks.check_is_spatial_2d(xr_obj, strict=True, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset is a spatial 2D field.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True (default), the xarray.DataArray must have just the 2D spatial dimensions. If strict=False , the xarray.DataArray can also have additional dimensions (except vertical).

gpm.checks.check_is_spatial_3d(xr_obj, strict=True, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset is a spatial 3D field.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True (default), the xarray.DataArray must have just the 3D spatial dimensions. If strict=False , the xarray.DataArray can also have additional dimensions.

gpm.checks.check_is_transect(xr_obj, strict=True, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset is a transect.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True (default), the xarray.DataArray must have just an horizontal dimension. If strict=False , the xarray.DataArray can also have additional dimensions, but only an horizontal dimension.

gpm.checks.get_bin_variables(ds)[source][source]#

Get list of xarray.Dataset radar product variables with name starting with bin or ending with Bin.

In CMB products, bin variables end with the Bin suffix. In L1 and L2 RADAR products, bin variables starts with the bin prefix.

gpm.checks.get_cross_section_variables(ds, strict=False, squeeze=True)[source][source]#

Get list of xarray.Dataset cross-section variables.

If strict=False (default), the potential variables for which a strict cross-section can be derived. If strict=True, the variables that are already a cross-section.

gpm.checks.get_frequency_dimension(xr_obj)[source][source]#

Return the name of the available frequency dimension.

gpm.checks.get_frequency_variables(ds)[source][source]#

Get list of xarray.Dataset variables with frequency-related dimension.

gpm.checks.get_spatial_2d_variables(ds, strict=False, squeeze=True)[source][source]#

Get list of xarray.Dataset 2D spatial variables.

If strict=False (default), the potential variables for which a 2D spatial field can be derived. If strict=True, the variables that are already a 2D spatial field.

gpm.checks.get_spatial_3d_variables(ds, strict=False, squeeze=True)[source][source]#

Get list of xarray.Dataset 3D spatial variables.

If strict=False (default), the potential variables for which a 3D spatial field can be derived. If strict=True, the variables that are already a 3D spatial field.

gpm.checks.get_spatial_dimensions(xr_obj)[source][source]#

Return the name of the available spatial dimensions.

gpm.checks.get_vertical_dimension(xr_obj)[source][source]#

Return the name of the available vertical dimension.

gpm.checks.get_vertical_variables(ds)[source][source]#

Get list of xarray.Dataset variables with vertical dimension.

gpm.checks.has_frequency_dim(xr_obj, strict=False, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset have a frequency dimension.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True , the xarray.DataArray must have just the frequency dimension. If strict=False (default), the xarray.DataArray can also have additional dimensions.

gpm.checks.has_spatial_dim(xr_obj, strict=False, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset have a spatial dimension.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True , the xarray.DataArray can have only spatial dimensions. If strict=False (default), the xarray.DataArray can also have other dimensions.

gpm.checks.has_vertical_dim(xr_obj, strict=False, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset have a vertical dimension.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True , the xarray.DataArray must have just the vertical dimension. If strict=False (default), the xarray.DataArray can also have additional dimensions.

gpm.checks.is_cross_section(xr_obj, strict=True, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset is a cross-section object.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True (default), the xarray.DataArray must have just the vertical dimension and a horizontal dimension. If strict=False , the xarray.DataArray can have additional dimensions but only a single horizontal and vertical dimension.

gpm.checks.is_grid(xr_obj)[source][source]#

Check whether the xarray object is a GPM GRID.

A GRID slice is not considered a GRID object ! An GRID object must have the coordinates available !

gpm.checks.is_orbit(xr_obj)[source][source]#

Check whether the xarray object is a GPM ORBIT.

An ORBIT cross-section (nadir view) or transect is considered ORBIT. An ORBIT object must have the coordinates available.

gpm.checks.is_spatial_2d(xr_obj, strict=True, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset is a spatial 2D object.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True (default), the xarray.DataArray must have just the 2D spatial dimensions. If strict=False , the xarray.DataArray can have additional dimensions (except vertical).

gpm.checks.is_spatial_3d(xr_obj, strict=True, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset i as spatial 3d object.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True (default), the xarray.DataArray must have just the 3D spatial dimensions. If strict=False , the xarray.DataArray can also have additional dimensions.

gpm.checks.is_transect(xr_obj, strict=True, squeeze=True)[source][source]#

Check if the xarray.DataArray or xarray.Dataset is a transect object.

If squeeze=True (default), dimensions of size=1 are removed prior testing. If strict=True (default), the xarray.DataArray must have just an horizontal dimension. If strict=False , the xarray.DataArray can have additional dimensions but only a single horizontal dimension.

gpm.configs module#

GPM-API configurations settings.

gpm.configs.define_configs(base_dir: str | None = None, username_pps: str | None = None, password_pps: str | None = None, username_earthdata: str | None = None, password_earthdata: str | None = None)[source][source]#

Defines the GPM-API configuration file with the given credentials and base directory.

Parameters:
  • base_dir (str) – The base directory where GPM data are stored.

  • username_pps (str, optional) – The username for the NASA GPM PPS account.

  • password_pps (str, optional) – The password for the NASA GPM PPS account.

  • username_earthdata (str, optional) – The username for the NASA EarthData account.

  • password_earthdata (str, optional) – The password for the NASA EarthData account.

Notes

This function writes a YAML file to the user’s home directory at ~/.config_gpm_api.yaml with the given GPM-API credentials and base directory. The configuration file can be used for authentication when making GPM-API requests.

gpm.configs.get_base_dir(base_dir=None)[source][source]#

Return the GPM base directory.

gpm.configs.get_password_earthdata()[source][source]#

Return the GPM-API EarthData password.

gpm.configs.get_password_pps()[source][source]#

Return the GPM-API PPS password.

gpm.configs.get_username_earthdata()[source][source]#

Return the GPM-API EarthData username.

gpm.configs.get_username_pps()[source][source]#

Return the GPM-API PPS username.

gpm.configs.read_configs() dict[str, str][source][source]#

Reads the GPM-API configuration file and returns a dictionary with the configuration settings.

Returns:

A dictionary containing the configuration settings for the GPM-API, including the username, password, and GPM base directory.

Return type:

dict

Raises:

ValueError – If the configuration file has not been defined yet. Use gpm.define_configs() to specify the configuration file path and settings.

Notes

This function reads the YAML configuration file located at ~/.config_gpm_api.yaml, which should contain the GPM-API credentials and base directory specified by gpm.define_configs().

gpm.configs.set_ges_disc_authentification(username, password)[source][source]#

Create authentication files for access to the GES DISC Data Archive.

Follow the additional steps detailed at https://disc.gsfc.nasa.gov/earthdata-login to enable access to the GES DISC HTTPS Data Archive.

The code snippet is taken from https://disc.gsfc.nasa.gov/information/howto?title=How%20to%20Generate%20Earthdata%20Prerequisite%20Files

Parameters:
  • username (str) – EarthData login username.

  • password (str) – EarthData login password.

Module contents#

GPM-API Package.