gpm package#

Subpackages#

Submodules#

gpm.checks module#

This module defines functions providing GPM-API Dataset information.

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

Check is a GPM object (GRID or ORBIT).

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

Check is a GPM GRID object.

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

Check is a GPM ORBIT object.

gpm.checks.check_is_spatial_2d(da, strict=True, squeeze=True)[source]#
gpm.checks.check_is_spatial_3d(da, strict=True, squeeze=True)[source]#
gpm.checks.check_is_transect(da, strict=True, squeeze=True)[source]#
gpm.checks.check_is_xarray(x)[source]#
gpm.checks.check_is_xarray_dataarray(x)[source]#
gpm.checks.check_is_xarray_dataset(x)[source]#
gpm.checks.get_dataset_variables(ds, sort=False)[source]#

Get list of xr.Dataset variables.

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

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

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

Get list of xr.Dataset 2D spatial variables.

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

Get list of xr.Dataset 3D spatial variables.

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

Return the name of the spatial dimensions.

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

Get list of xr.Dataset trasect variables.

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

Return the name of the vertical dimension.

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

Check whether the GPM xarray object is a grid.

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

Check whether the GPM xarray object is an orbit.

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

Check if is spatial 2d xarray object.

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

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

Check if is spatial 3d xarray object.

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

Check if is spatial profile xarray object.

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]#

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.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]#

Return the GPM base directory.

gpm.configs.get_password_earthdata()[source]#

Return the GPM-API EarthData password.

gpm.configs.get_password_pps()[source]#

Return the GPM-API PPS password.

gpm.configs.get_username_earthdata()[source]#

Return the GPM-API EarthData username.

gpm.configs.get_username_pps()[source]#

Return the GPM-API PPS username.

gpm.configs.read_configs() dict[str, str][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.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]#

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 (TYPE) – EarthData login password.

Return type:

None.

Module contents#

GPM-API Package.