gpm.io package

Contents

gpm.io package#

Submodules#

gpm.io.checks module#

This module contains functions to check the GPM-API arguments.

gpm.io.checks.check_base_dir(base_dir)[source]#

Check base directory path.

If base_dir ends with “GPM” directory, it removes it from the base_dir path. If base_dir does not end with “GPM”, the GPM directory will be created.

Parameters:

base_dir (str) – Base directory where the GPM directory is located.

Returns:

base_dir – Base directory where the GPM directory is located.

Return type:

str

gpm.io.checks.check_date(date)[source]#

Check is a datetime.date object.

gpm.io.checks.check_filepaths(filepaths)[source]#

Ensure filepaths is a list of string.

gpm.io.checks.check_full_product_level(full_product_level)[source]#

Check full_product_level validity.

gpm.io.checks.check_full_product_levels(full_product_levels)[source]#

Check full product levels list validity.

gpm.io.checks.check_groups(groups)[source]#

Ensure groups is a numpy array of string.

gpm.io.checks.check_product(product, product_type)[source]#

Check product validity.

gpm.io.checks.check_product_categories(product_categories)[source]#

Check product category list validity.

gpm.io.checks.check_product_category(product_category)[source]#

Check product_category validity.

gpm.io.checks.check_product_level(product_level)[source]#

Check product_level validity.

gpm.io.checks.check_product_levels(product_levels)[source]#

Check product levels list validity.

gpm.io.checks.check_product_type(product_type)[source]#

Check product_type validity.

gpm.io.checks.check_product_types(product_types)[source]#

Check product types list validity.

gpm.io.checks.check_product_validity(product, product_type=None)[source]#

Check product validity for the specified product_type.

gpm.io.checks.check_product_version(version, product)[source]#

Check valid version for the specified product.

gpm.io.checks.check_remote_storage(storage)[source]#

Check storage is remote.

gpm.io.checks.check_satellite(satellite)[source]#

Check satellite validity.

gpm.io.checks.check_satellites(satellites)[source]#

Check satellites list validity.

gpm.io.checks.check_scan_mode(scan_mode, product, version)[source]#

Checks scan_mode validity.

gpm.io.checks.check_sensor(sensor)[source]#

Check sensor validity.

gpm.io.checks.check_sensors(sensors)[source]#

Check sensors list validity.

gpm.io.checks.check_start_end_time(start_time, end_time)[source]#

Check start_time and end_time value validity.

gpm.io.checks.check_storage(storage)[source]#

Check storage.

gpm.io.checks.check_time(time)[source]#

Check time validity.

It returns a datetime.datetime object to seconds precision.

Parameters:

time ((datetime.datetime, datetime.date, np.datetime64, str)) – Time object. Accepted types: datetime.datetime, datetime.date, np.datetime64 or str. If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

Returns:

time

Return type:

datetime.datetime

gpm.io.checks.check_transfer_tool(transfer_tool)[source]#

Check the transfer tool.

gpm.io.checks.check_transfer_tool_availability(transfer_tool)[source]#

Check availability of a transfer_tool. Return True if available.

gpm.io.checks.check_valid_time_request(start_time, end_time, product)[source]#

Check validity of the time request.

gpm.io.checks.check_variables(variables)[source]#

Ensure variables is a numpy array of string.

gpm.io.checks.check_version(version)[source]#

Check version validity.

gpm.io.checks.check_versions(versions)[source]#

Check versions list validity.

gpm.io.data_integrity module#

This module contains functions that check the GPM files integrity.

gpm.io.data_integrity.check_archive_integrity(product, start_time, end_time, version=None, product_type='RS', remove_corrupted=True, verbose=True)[source]#

Check GPM granule file integrity over a given period.

If remove_corrupted=True, it removes the corrupted files.

Parameters:
  • product (str) – GPM product acronym.

  • start_time (datetime.datetime) – Start time.

  • end_time (datetime.datetime) – End time.

  • product_type (str, optional) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • version (int, optional) – GPM version of the data to retrieve if product_type = "RS". GPM data readers currently support version 4, 5, 6 and 7.

  • remove_corrupted (bool, optional) – Whether to remove the corrupted files. The default is True.

Returns:

List of file paths which are corrupted.

Return type:

filepaths, list

gpm.io.data_integrity.check_filepaths_integrity(filepaths, remove_corrupted=True, verbose=True)[source]#

Check the integrity of GPM files.

Parameters:
  • filepaths (list) – List of file paths.

  • remove_corrupted (bool, optional) – Whether to remove the corrupted files. The default is True.

  • verbose (bool, optional) – Whether to verbose the corrupted files. The default is True.

Returns:

l_corrupted – List of corrupted file paths.

Return type:

list

gpm.io.data_integrity.get_corrupted_filepaths(filepaths)[source]#

Return the file paths of corrupted files.

gpm.io.data_integrity.remove_corrupted_filepaths(filepaths, verbose=True)[source]#

gpm.io.download module#

This module contains the routines required to download data from the NASA PPS and GES DISC servers.

gpm.io.download.check_pps_available(verbose=True)[source]#

Check PPS server is available.

gpm.io.download.check_pps_ports_are_open()[source]#

Check 64000-65000 ports are open for PPS.

gpm.io.download.check_valid_pps_credentials(verbose=True)[source]#

Check validity of PPS credentials.

gpm.io.download.curl_ges_disc_cmd(remote_filepath, local_filepath, username='dummy', password='dummy')[source]#

CURL command to download data from GES DISC.

gpm.io.download.curl_pps_cmd(remote_filepath, local_filepath, username, password)[source]#

CURL command to download data from PPS through ftps.

gpm.io.download.download_archive(product, start_time, end_time, product_type='RS', version=None, storage='PPS', n_threads=4, transfer_tool='CURL', progress_bar=False, force_download=False, check_integrity=True, remove_corrupted=True, retry=1, verbose=True)[source]#

Download GPM data from NASA servers (day by day).

Parameters:
  • product (str) – GPM product acronym. See gpm.available_products().

  • start_time ((datetime.datetime, datetime.date, np.datetime64, str)) – Start time. Accepted types: datetime.datetime, datetime.date, np.datetime64 or str. If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

  • end_time ((datetime.datetime, datetime.date, np.datetime64, str)) – End time. Accepted types: datetime.datetime, datetime.date, np.datetime64 or str. If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

  • product_type (str, optional) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • version (int, optional) – GPM version of the data to retrieve if product_type = "RS".

  • storage (str, optional) – The remote repository from where to download. Either pps or ges_disc. The default is pps.

  • n_threads (int, optional) – Number of parallel downloads. The default is set to 10.

  • progress_bar (bool, optional) – Whether to display progress. The default is True.

  • transfer_tool (str, optional) – Whether to use curl or wget for data download. The default is curl.

  • force_download (boolean, optional) – Whether to redownload data if already existing on disk. The default is False.

  • verbose (bool, optional) – Whether to print processing details. The default is False.

  • check_integrity (bool, optional) – Check integrity of the downloaded files. By default is True.

  • remove_corrupted (bool, optional) – Whether to remove the corrupted files. By default is True.

  • retry (int, optional,) – The number of attempts to redownload the corrupted files. The default is 1. Only applies if check_integrity=True!

gpm.io.download.download_files(filepaths, product_type='RS', storage='PPS', n_threads=4, transfer_tool='CURL', force_download=False, remove_corrupted=True, progress_bar=False, verbose=True, retry=1)[source]#

Download specific GPM files from NASA servers.

Parameters:
  • filepaths ((str or list)) – List of GPM file names to download.

  • product_type (str, optional) – GPM product type. Either RS (Research) or NRT (Near-Real-Time). The default is “RS”.

  • storage (str, optional) – The remote repository from where to download. Either pps or ges_disc. The default is “PPS”.

  • n_threads (int, optional) – Number of parallel downloads. The default is set to 10.

  • progress_bar (bool, optional) – Whether to display progress. The default is True.

  • transfer_tool (str, optional) – Whether to use curl or wget for data download. The default is curl.

  • verbose (bool, optional) – Whether to print processing details. The default is False.

  • force_download (boolean, optional) – Whether to redownload data if already existing on disk. The default is False.

  • remove_corrupted (boolean, optional) – Whether to remove the corrupted files. By default is True.

  • retry (int, optional,) – The number of attempts to redownload the corrupted files. The default is 1.

Returns:

l_corrupted – List of corrupted file paths. If no corrupted files, returns an empty list.

Return type:

list

gpm.io.download.filter_download_list(remote_filepaths, local_filepaths, force_download=False)[source]#

Removes filepaths of GPM file already existing on disk.

Parameters:
  • remote_filepaths (str) – GPM directory on disk for a specific product and date.

  • remote_filepaths – Filepaths on which GPM data are stored on PPS servers.

  • force_download (boolean, optional) – Whether to redownload data if already existing on disk. The default is False.

Returns:

  • remote_filepaths (list) – List of filepaths on the NASA PPS server.

  • local_filepaths (list) – List of filepaths on the local disk.

gpm.io.download.get_curl_version()[source]#

Get curl version.

gpm.io.download.get_filepath_from_filename(filename, storage, product_type)[source]#

Convert GPM file names to the <storage> file path.

gpm.io.download.get_filepaths_from_filenames(filepaths, storage, product_type)[source]#

Convert GPM file names or file paths to <storage> file paths.

Parameters:

filepaths (list) – GPM file names or file paths.

Returns:

filepaths – List of file paths on <storage> storage.

Return type:

list

gpm.io.download.run(commands, n_threads=10, progress_bar=True, verbose=True)[source]#

Run bash commands in parallel using multithreading.

Parameters:
  • commands (list) – list of commands to execute in the terminal.

  • n_threads (int, optional) – Number of parallel download. The default is 10.

Returns:

status – Download status of each file. 0=Failed. 1=Success.

Return type:

list

gpm.io.download.wget_ges_disc_cmd(remote_filepath, local_filepath, username, password='dummy')[source]#

WGET command to download data from GES DISC.

gpm.io.download.wget_pps_cmd(remote_filepath, local_filepath, username, password)[source]#

WGET command to download data from PPS through ftps.

gpm.io.filter module#

This module contains functions to filter files according to user specifics.

gpm.io.filter.filter_by_product(filepaths, product, product_type='RS')[source]#

Filter filepaths by product.

Parameters:
  • filepaths (list) – List of filepaths.

  • product (str) – GPM product name. See gpm.available_products().

  • product_type (str, optional) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

Returns:

filepaths – List of valid filepaths. If no valid filepaths, returns an empty list !

Return type:

list

gpm.io.filter.filter_by_time(filepaths, start_time=None, end_time=None)[source]#

Filter filepaths by start_time and end_time.

Parameters:
  • filepaths (list) – List of filepaths.

  • start_time (datetime.datetime) – Start time. If None, will be set to GPM start mission time (1998-01-01).

  • end_time (datetime.datetime) – End time. If None will be set to current time using datetime.datetime.utcnow().

Returns:

filepaths – List of valid filepaths. If no valid filepaths, returns an empty list !

Return type:

list

gpm.io.filter.filter_by_version(filepaths, version)[source]#

Filter filepaths by GPM product version.

Parameters:
  • filepaths (list) – List of filepaths or filenames.

  • version (int) – GPM product version.

Returns:

filepaths – List of valid filepaths. If no valid filepaths, returns an empty list !

Return type:

list

gpm.io.filter.filter_filepaths(filepaths, product=None, product_type=None, version=None, start_time=None, end_time=None)[source]#

Filter the GPM filepaths based on specific parameters.

Parameters:
  • filepaths (list) – List of filepaths.

  • product (str) – GPM product name. See gpm.available_products(). The default is None.

  • product_type (str, optional) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • start_time (datetime.datetime) – Start time The default is None.

  • end_time (datetime.datetime) – End time. The default is None.

  • version (int) – GPM product version. The default is None.

Returns:

filepaths – Returns the filepaths subset. If no valid filepaths, return an empty list.

Return type:

list

gpm.io.filter.is_granule_within_time(start_time, end_time, file_start_time, file_end_time)[source]#

Check if a granule is within start_time and end_time.

gpm.io.find module#

This module contains functions to find data on local and NASA servers.

gpm.io.find.find_associated_filepath(filepath, product, storage='LOCAL', product_type='RS', version=7)[source]#

Return filepath of another product associated to the input filepath.

Please specify a product derived from the same sensor !

gpm.io.find.find_daily_filepaths(storage, date, product, product_type, version, start_time=None, end_time=None, verbose=False)[source]#

Retrieve GPM data filepaths for a specific day and product.

Parameters:
  • date (datetime.date) – Single date for which to retrieve the data.

  • product (str) – GPM product acronym. See gpm.available_products().

  • start_time (datetime.datetime) – Filtering start time.

  • end_time (datetime.datetime) – Filtering end time.

  • product_type (str, optional) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • version (int, optional) – GPM version of the data to retrieve if product_type = "RS".

  • verbose (bool, optional) – Default is False.

Returns:

  • pps_filepaths (list) – List of file paths on the NASA PPS server.

  • available_version (list) – List of available versions.

gpm.io.find.find_filepaths(storage, product, start_time, end_time, product_type='RS', version=None, verbose=True, parallel=True)[source]#

Retrieve GPM data filepaths on local disk for a specific time period and product.

Parameters:
  • product (str) – GPM product acronym. See gpm.available_products().

  • start_time (datetime.datetime) – Start time.

  • end_time (datetime.datetime) – End time.

  • product_type (str, optional) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • version (int, optional) – GPM version of the data to retrieve if product_type = "RS".

  • verbose (bool, optional) – Whether to print processing details. The default is True.

  • parallel (bool, optional) – Whether to loop over dates in parallel. The default is True.

Returns:

filepaths – List of GPM filepaths.

Return type:

list

gpm.io.ges_disc module#

Routines required to search data on the NASA GES DISC servers.

gpm.io.ges_disc.define_ges_disc_filepath(product, product_type, date, version, filename)[source]#

Define GES DISC filepath from filename.

This function is called by get_filepath_from_filename(filename, storage, product_type).

Parameters:
  • product (str) – GPM product acronym. See gpm.available_products().

  • product_type (str) – GPM product type. Not used for GES DISC.

  • date (datetime) – Single date for which to retrieve the data.

  • version (int) – GPM version of the data to retrieve if product_type = "RS".

  • filename (str) – Name of the GPM file.

gpm.io.ges_disc.get_ges_disc_daily_filepaths(product, product_type, date, version, verbose=True)[source]#

Retrieve the NASA GES DISC file paths available at a given date.

Parameters:
  • product (str) – GPM product acronym. See gpm.available_products().

  • date (datetime) – Single date for which to retrieve the data.

  • product_type (str) – GPM product type. Not used for GES DISC.

  • version (int) – GPM version of the data to retrieve.

  • verbose (bool, optional) – Whether to specify when data are not available for a specific date. The default is True.

gpm.io.ges_disc.get_ges_disc_product_directory(product, date, version)[source]#

Retrieve the NASA GES DISC server product directory path at a specific date.

The data list is retrieved using https.

Parameters:
  • product (str) – GPM product name. See gpm.available_products().

  • date (datetime.date) – Single date for which to retrieve the data.

  • version (int) – GPM version of the data to retrieve.

Returns:

url_data_list – url of the NASA GES DISC server where the data are stored.

Return type:

str

gpm.io.ges_disc.get_ges_disc_product_directory_tree(product, date, version)[source]#

Return the GES DISC product directory tree.

The directory tree structure is

  • <product directory>/YYYY/DOY for L1 and L2 products (and IMERG half hourly)

  • <product directory>/YYYY/MM for L3 daily products

  • <product directory>/YYYY or <product directory>/YYYY/MM for L3 monthly products

Parameters:
  • product (str) – GPM product name. See gpm.available_products().

  • date (datetime.date) – Single date for which to retrieve the data.

  • version (int) – GPM version of the data to retrieve.

Returns:

directory_tree – DIrectory tree on the NASA GESC DISC server where the data are stored.

Return type:

str

gpm.io.info module#

This module provide tools to extraction information from the granules’ filenames.

gpm.io.info.get_end_time_from_filepaths(filepaths)[source]#

Infer granules end_time from file paths.

gpm.io.info.get_granule_from_filepaths(filepaths)[source]#

Infer GPM Granule IDs from file paths.

gpm.io.info.get_info_from_filepath(filepath)[source]#

Retrieve file information dictionary from filepath.

gpm.io.info.get_key_from_filepath(filepath, key)[source]#

Extract specific key information from a list of filepaths.

gpm.io.info.get_key_from_filepaths(filepaths, key)[source]#

Extract specific key information from a list of filepaths.

gpm.io.info.get_product_from_filepath(filepath)[source]#

Infer granules product from file path.

gpm.io.info.get_product_from_filepaths(filepaths)[source]#

Infer granules product from file paths.

gpm.io.info.get_start_end_time_from_filepaths(filepaths)[source]#

Infer granules start_time and end_time from file paths.

gpm.io.info.get_start_time_from_filepaths(filepaths)[source]#

Infer granules start_time from file paths.

gpm.io.info.get_version_from_filepath(filepath, integer=True)[source]#

Infer granule version from file path.

gpm.io.info.get_version_from_filepaths(filepaths, integer=True)[source]#

Infer granules version from file paths.

gpm.io.local module#

This module contains functions defining where to download GPM data on the local machine.

gpm.io.local.define_local_filepath(product, product_type, date, version, filename, base_dir=None)[source]#

Define local file path.

This function is called by get_filepath_from_filename(filename, storage, product_type).

gpm.io.local.get_local_daily_filepaths(product, product_type, date, version, base_dir=None)[source]#

Retrieve GPM data filepaths on the local disk directory of a specific day and product.

Parameters:
  • product (str) – GPM product acronym. See gpm.available_products().

  • product_type (str) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • date (datetime) – Single date for which to retrieve the data.

  • version (int) – GPM version of the data to retrieve if product_type = "RS".

gpm.io.local.get_local_dir_tree_from_filename(filepath, product_type='RS', base_dir=None)[source]#

Return directory tree from a GPM filename or filepath.

gpm.io.local.get_local_filepath_from_filename(filepath, product_type='RS', base_dir=None)[source]#

Return the local filepath of a GPM file or filepath.

gpm.io.local.get_local_filepaths(product, version=7, product_type='RS', base_dir=None, group=None)[source]#

Retrieve all GPM filepaths on the local disk directory for a specific product.

Parameters:
  • product (str) – GPM product acronym. See gpm.available_products().

  • version (int) – GPM version of the data to retrieve if product_type = "RS". The default is version 7.

  • product_type (str, optional) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • group (str, optional) – Whether to group the filepaths in a dictionary by year, month, doy or version. The default is None.

gpm.io.local.get_local_product_directory(base_dir, product, product_type, version, date)[source]#

Provide the local repository path where the requested daily GPM data are stored/need to be saved.

Parameters:
  • base_dir (str) – The base directory where to store GPM data.

  • product (str) – GPM product name. See gpm.available_products().

  • product_type (str) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • version (int) – GPM version of the data to retrieve if product_type = "RS".

  • date (datetime.date) – Single date for which to retrieve the data.

Returns:

product_dir_path – Directory path where daily GPM data are located.

  • If product_type == "RS": <base_dir>/GPM/RS/V0<version>/<product_category>/<product>/<YYYY>/<MM>/<DD>

  • If product_type == "NRT": <base_dir>/GPM/NRT/<product_category>/<product>/<YYYY>/<MM>/<DD>

Valid product_category are RADAR, PMW, CMB, IMERG.

Return type:

str

gpm.io.local.get_time_tree(date)[source]#

Get time tree path <YYYY>/<MM>/<DD>.

gpm.io.local.group_filepaths_by_time_group(filepaths, group)[source]#
gpm.io.local.list_files(dir_path, glob_pattern, recursive=False)[source]#

Return a list of filepaths (exclude directory paths).

gpm.io.local.list_paths(dir_path, glob_pattern, recursive=False)[source]#

Return a list of filepaths and directory paths.

gpm.io.pps module#

This module contains the routines required to search data on the NASA PPS servers.

gpm.io.pps.define_pps_filepath(product, product_type, date, version, filename)[source]#

Define PPS filepath from filename.

This function is called by get_filepath_from_filename(filename, storage, product_type).

gpm.io.pps.find_first_pps_granule_filepath(product: str, product_type: str, version: int) str[source]#

Return the PPS filepath of the first available granule.

gpm.io.pps.get_pps_daily_filepaths(product, product_type, date, version, verbose=True)[source]#

Retrieve the complete url to the files available on the NASA PPS server for a specific day and product.

Parameters:
  • product (str) – GPM product acronym. See gpm.available_products().

  • date (datetime) – Single date for which to retrieve the data.

  • product_type (str, optional) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • version (int, optional) – GPM version of the data to retrieve if product_type = "RS".

  • verbose (bool, optional) – Whether to specify when data are not available for a specific date. The default is True.

gpm.io.pps.get_pps_product_directory(product, product_type, date, version, server_type)[source]#

Retrieve the NASA PPS server product directory path at specific date.

The data list is retrieved using https. The data stored are retrieved using ftps.

Parameters:
  • product (str) – GPM product name. See gpm.available_products().

  • product_type (str) – GPM product type. Either RS (Research) or NRT (Near-Real-Time).

  • date (datetime.date) – Single date for which to retrieve the data.

  • version (int) – GPM version of the data to retrieve if product_type = "RS".

  • server_type (str) – Either text or data

Returns:

url_product_dir – url of the NASA PPS server where the data are listed.

Return type:

str

gpm.io.products module#

This module contains functions to obtain GPM products information.

gpm.io.products.available_product_categories(satellites=None, sensors=None, product_types=None, versions=None, product_levels=None, full_product_levels=None)[source]#

Provide a list of available GPM product categories.

Parameters:
  • product_types ((str or list), optional) – If None (default), provide all products (RS and NRT). If RS, provide a list of all GPM RS products available for download. If NRT, provide a list of all GPM NRT products available for download.

  • product_levels ((str or list), optional) – If None (default), provide products from all product levels. If str, must be a valid product level. Valid product levels are: 1A, 1B, 1C, 2A, 2B, 3B. The list of available sensors also be retrieved using available_product_levels().

  • versions ((int or list), optional) – If None (default), provide products from all versions. If int, must be a valid version. Valid product levels are: 4, 5, 6, 7. The list of available sensors can also be retrieved using available_versions().

  • satellites ((str or list), optional) – If None (default), provide products from all satellites. If str, must be a valid satellites. The list of available satellites can be retrieved using available_satellites().

  • sensors ((str or list), optional) – If None (default), provide products from all sensors. If str, must be a valid sensor. The list of available sensors can be retrieved using available_sensors().

Returns:

List of available GPM product categories.

Return type:

List

gpm.io.products.available_product_levels(satellites=None, sensors=None, product_categories=None, product_types=None, versions=None, full=False)[source]#

Provide a list of available GPM product levels.

Parameters:
  • product_types ((str or list), optional) – If None (default), provide all products (RS and NRT). If RS, provide a list of all GPM RS products available for download. If NRT, provide a list of all GPM NRT products available for download.

  • product_categories ((str or list), optional) – If None (default), provide products from all product categories. If str, must be a valid product category. Valid product categories are: PMW, RADAR, IMERG, CMB. The list of available sensors can also be retrieved using available_product_categories().

  • versions ((int or list), optional) – If None (default), provide products from all versions. If int, must be a valid version. Valid product levels are: 4, 5, 6, 7. The list of available sensors can also be retrieved using available_versions().

  • satellites ((str or list), optional) – If None (default), provide products from all satellites. If str, must be a valid satellites. The list of available satellites can be retrieved using available_satellites().

  • sensors ((str or list), optional) – If None (default), provide products from all sensors. If str, must be a valid sensor. The list of available sensors can be retrieved using available_sensors().

Returns:

List of available GPM product levels.

Return type:

List

gpm.io.products.available_product_versions(product)[source]#

Provides a list with the available product versions.

gpm.io.products.available_products(satellites=None, sensors=None, product_categories=None, product_types=None, versions=None, product_levels=None, full_product_levels=None, start_time=None, end_time=None)[source]#

Provide a list of available GPM products for download.

Parameters:
  • product_types ((str or list), optional) – If None (default), provide all products (RS and NRT). If RS, provide a list of all GPM RS products available for download. If NRT, provide a list of all GPM NRT products available for download.

  • product_categories ((str or list), optional) – If None (default), provide products from all product categories. If str, must be a valid product category. Valid product categories are: PMW, RADAR, IMERG, CMB. The list of available sensors can also be retrieved using available_product_categories().

  • product_levels ((str or list), optional) – If None (default), provide products from all product levels. If str, must be a valid product level. Valid product levels are: 1A, 1B, 1C, 2A, 2B, 3B. The list of available sensors also be retrieved using available_product_levels().

  • versions ((int or list), optional) – If None (default), provide products from all versions. If int, must be a valid version. Valid product levels are: 4, 5, 6, 7. The list of available sensors can also be retrieved using available_versions().

  • satellites ((str or list), optional) – If None (default), provide products from all satellites. If str, must be a valid satellites. The list of available satellites can be retrieved using available_satellites().

  • sensors ((str or list), optional) – If None (default), provide products from all sensors. If str, must be a valid sensor. The list of available sensors can be retrieved using available_sensors().

  • start_time ((datetime.datetime, datetime.date, np.datetime64, str)) – Start time period over which to search for available products. The default is None (start of the GPM mission). Accepted types: datetime.datetime, datetime.date, np.datetime64 or str. If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

  • end_time ((datetime.datetime, datetime.date, np.datetime64, str)) – End time period over which to search for available products. The default is None (current time). Accepted types: datetime.datetime, datetime.date, np.datetime64 or str. If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

Returns:

List of available GPM products.

Return type:

List

gpm.io.products.available_satellites(sensors=None, product_categories=None, product_types=None, versions=None, product_levels=None, full_product_levels=None, start_time=None, end_time=None, prefix_with_sensor=False)[source]#

Provide a list of available GPM satellites.

If prefix_with_sensor=True, it prefixes the satellite name with the satellite name: {sensor}-{satellite}.

Parameters:
  • product_types ((str or list), optional) – If None (default), provide all products (RS and NRT). If RS, provide a list of all GPM RS products available for download. If NRT, provide a list of all GPM NRT products available for download.

  • product_categories ((str or list), optional) – If None (default), provide products from all product categories. If str, must be a valid product category. Valid product categories are: PMW, RADAR, IMERG, CMB. The list of available sensors can also be retrieved using available_product_categories().

  • product_levels ((str or list), optional) – If None (default), provide products from all product levels. If str, must be a valid product level. Valid product levels are: 1A, 1B, 1C, 2A, 2B, 3B. The list of available sensors also be retrieved using available_product_levels().

  • versions ((int or list), optional) – If None (default), provide products from all versions. If int, must be a valid version. Valid product levels are: 4, 5, 6, 7. The list of available sensors can also be retrieved using available_versions().

  • sensors ((str or list), optional) – If None (default), provide products from all sensors. If str, must be a valid sensor. The list of available sensors can be retrieved using available_sensors().

  • start_time ((datetime.datetime, datetime.date, np.datetime64, str)) – Start time period over which to search for available products. The default is None (start of the GPM mission). Accepted types: datetime.datetime, datetime.date, np.datetime64 or str. If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

  • end_time ((datetime.datetime, datetime.date, np.datetime64, str)) – End time period over which to search for available products. The default is None (current time). Accepted types: datetime.datetime, datetime.date, np.datetime64 or str. If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

  • prefix_with_sensor (bool, optional) – If True, it prefixes the satellite name with the satellite name: {sensor}-{satellite}. If False (the default), it just return the name of the satellite.

Returns:

List of available GPM satellites.

Return type:

List

gpm.io.products.available_scan_modes(product, version)[source]#

Return the available scan_modes for a given product (and specific version).

gpm.io.products.available_sensors(satellites=None, product_categories=None, product_types=None, versions=None, product_levels=None, full_product_levels=None, start_time=None, end_time=None, suffix_with_satellite=False)[source]#

Provide a list of available GPM sensors.

If suffix_with_satellite=True, it suffixes the sensor name with the satellite name: {sensor}-{satellite}.

Parameters:
  • product_types ((str or list), optional) – If None (default), provide all products (RS and NRT). If RS, provide a list of all GPM RS products available for download. If NRT, provide a list of all GPM NRT products available for download.

  • product_categories ((str or list), optional) – If None (default), provide products from all product categories. If str, must be a valid product category. Valid product categories are: PMW, RADAR, IMERG, CMB. The list of available sensors can also be retrieved using available_product_categories().

  • product_levels ((str or list), optional) – If None (default), provide products from all product levels. If str, must be a valid product level. Valid product levels are: 1A, 1B, 1C, 2A, 2B, 3B. The list of available sensors also be retrieved using available_product_levels().

  • versions ((int or list), optional) – If None (default), provide products from all versions. If int, must be a valid version. Valid product levels are: 4, 5, 6, 7. The list of available sensors can also be retrieved using available_versions().

  • satellites ((str or list), optional) – If None (default), provide products from all satellites. If str, must be a valid satellites. The list of available satellites can be retrieved using available_satellites().

  • start_time ((datetime.datetime, datetime.date, np.datetime64, str)) – Start time period over which to search for available products. The default is None (start of the GPM mission). Accepted types: datetime.datetime, datetime.date, np.datetime64 or str. If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

  • end_time ((datetime.datetime, datetime.date, np.datetime64, str)) – End time period over which to search for available products. The default is None (current time). Accepted types: datetime.datetime, datetime.date, np.datetime64 or str. If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

  • suffix_with_satellite (bool, optional) – If True, it suffixes the sensor name with the satellite name: {sensor}-{satellite}. If False (the default), it just return the name of the sensor.

Returns:

List of available GPM sensors.

Return type:

List

gpm.io.products.available_versions(satellites=None, sensors=None, product_types=None, product_categories=None, product_levels=None, full_product_levels=None)[source]#

Provide a list of available GPM versions.

Parameters:
  • product_types ((str or list), optional) – If None (default), provide all products (RS and NRT). If RS, provide a list of all GPM RS products available for download. If NRT, provide a list of all GPM NRT products available for download.

  • product_categories ((str or list), optional) – If None (default), provide products from all product categories. If str, must be a valid product category. Valid product categories are: PMW, RADAR, IMERG, CMB. The list of available sensors can also be retrieved using available_product_categories().

  • product_levels ((str or list), optional) – If None (default), provide products from all product levels. If str, must be a valid product level. Valid product levels are: 1A, 1B, 1C, 2A, 2B, 3B. The list of available sensors also be retrieved using available_product_levels().

  • satellites ((str or list), optional) – If None (default), provide products from all satellites. If str, must be a valid satellites. The list of available satellites can be retrieved using available_satellites().

  • sensors ((str or list), optional) – If None (default), provide products from all sensors. If str, must be a valid sensor. The list of available sensors can be retrieved using available_sensors().

Returns:

List of available GPM versions.

Return type:

List

gpm.io.products.filter_info_dict_by_time(info_dict, start_time, end_time)[source]#

Filter info_dict by start_time and end_time.

Assume that either start_time or end_time are not None.

Parameters:
  • start_time ((datetime.datetime, datetime.date, np.datetime64, str)) – Start time. Accepted types: datetime.datetime, datetime.date, np.datetime64 or str If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

  • end_time ((datetime.datetime, datetime.date, np.datetime64, str)) – Start time. Accepted types: datetime.datetime, datetime.date, np.datetime64 or str If string type, it expects the isoformat YYYY-MM-DD hh:mm:ss.

gpm.io.products.get_available_product_categories()[source]#

Get the list of all available product categories.

gpm.io.products.get_available_product_levels(full=False)[source]#

Get the list of all available product levels.

gpm.io.products.get_available_product_types()[source]#

Get the list of available product types.

gpm.io.products.get_available_products()[source]#

Get the list of all available products.

gpm.io.products.get_available_satellites(prefix_with_sensor=False)[source]#

Get the list of all available satellites.

gpm.io.products.get_available_sensors(suffix_with_satellite=False)[source]#

Get the list of all available sensors.

gpm.io.products.get_available_versions()[source]#

Get the list of available versions.

gpm.io.products.get_info_dict()[source]#

Get product info dictionary.

gpm.io.products.get_info_dict_subset(sensors=None, satellites=None, product_categories=None, product_types=None, versions=None, full_product_levels=None, product_levels=None)[source]#

Retrieve info dictionary filtered by keys.

gpm.io.products.get_last_product_version(product)[source]#

Provide the most recent product version.

gpm.io.products.get_product_category(product)[source]#

Get the product_category of a GPM product.

The product_category is used to organize file on disk.

gpm.io.products.get_product_end_time(product)[source]#

Provide the product end_time.

gpm.io.products.get_product_info(product)[source]#

Provide the product info dictionary.

gpm.io.products.get_product_level(product, full=False)[source]#

Get the product_level of a GPM product.

gpm.io.products.get_product_pattern(product)[source]#

Return the filename pattern associated to GPM product.

gpm.io.products.get_product_start_time(product)[source]#

Provide the product start_time.

gpm.io.products.get_products_pattern_dict()[source]#

Return the filename pattern* associated to all GPM products.

gpm.io.products.is_gpm_api_product(product)[source]#

Check if the product arises from the GPM satellite.

gpm.io.products.is_trmm_product(product)[source]#

Check if the product arises from the TRMM satellite.

Module contents#

This directory contains functions to search and download GPM products.