geoips.utils package#

Submodules#

geoips.utils.composite module#

Utilities for swath compositing in GeoIPS.

geoips.utils.composite.find_preproc_alg_files(product_time, composite_window, sector_name, product, sensor, platform, file_format='netcdf', product_db=False, db_query_plugin=None, db_schemas=None, db_tables=None)[source]#

Find pre-processed algorithm files that were saved to disk.

Parameters:
  • product_time (datetime.datetime) – Product time

  • composite_window (str) – How far back to search for pre-processed files. Window needs to be specified in iso8601 duration format (e.g. PT4H)

  • sector_name (str) – Name of sector to composite

  • product (str) – Name of product to composite

  • sensor (str) – Name of sensor to composite

  • platform (str) – Name of platform to composite

  • file_format (str, optional) – Pre-processed file format, by default “netcdf”

  • product_db (bool, optional) – Use product database to find any pre-processed file, by default False

  • db_query_plugin (str, optional) – Name of product database query plugin, by default None

  • db_schemas (list, optional) – Names of postgres schema to query, by default None

  • db_tables (list, optional) – Names of table to query under schema, by default None

Returns:

List of pre-processed algorithm files

Return type:

list

geoips.utils.composite.find_preproc_alg_netcdfs(product_time_start, product_time_end, sector_name, product, sensor, platform, product_db=False, postgres_query_plugin=None, postgres_schemas=None, postgres_tables=None)[source]#

Find pre-processed algorithm netCDF files that were saved to disk.

Parameters:
  • product_time_start (datetime.datetime) – Earliest product time to search for valid files

  • product_time_start – Latest product time to search for valid files

  • sector_name (str) – Name of sector to composite

  • product (str) – Name of product to composite

  • sensor (str) – Name of sensor to composite

  • platform (str) – Name of platform to composite

  • file_format (str, optional) – Pre-processed file format, by default “netcdf”

  • product_db (bool, optional) – Use product database to find any pre-processed file, by default False

  • db_query_plugin (str, optional) – Name of product database query plugin, by default None

  • db_schemas (list, optional) – Names of postgres schema to query, by default None

  • db_tables (list, optional) – Names of table to query under schema, by default None

Returns:

List of pre-processed netCDF algorithm files

Return type:

list

geoips.utils.context_managers module#

Module for handling optional dependencies throughout GeoIPS.

geoips.utils.context_managers.import_optional_dependencies(loglevel='info')[source]#

Attempt to import a package and log the event if the import fails.

Parameters:

loglevel (str) – Name of the log level to write to. May be any valid log level (e.g. debug, info, etc.).

geoips.utils.decorators module#

GeoIPS decorators module.

class geoips.utils.decorators.deprecated(replacement=None)[source]#

Bases: object

A decorator that deprecates a function.

When applied to a function, will cause that function to raise a DeprecationWarning when called.

geoips.utils.decorators.developmental(func)[source]#

Mark an interfaces as developmental.

When applied to a function, will prepend a “developmental” message to the beginning of that function’s docstring.

geoips.utils.memusg module#

Utilities for tracking and monitoring memory and resource usage.

class geoips.utils.memusg.PidLog(inpid, logstr='')[source]#

Bases: object

Track a PID and all children.

  • Requires psutil and threading

print_mem_usg(logstr='', verbose=False)[source]#

Print verbose resouce usage.

print_resource_usage()[source]#

Print verbose resource usage, using “resource” package.

save_csv()[source]#

Save a csv file to output.

save_exit()[source]#

Exit the thread cleanly.

track_pids()[source]#

Track pids and create a dict of values.

geoips.utils.memusg.print_mem_usage(logstr='', verbose=False)[source]#

Print memory usage to LOG.info.

  • By default include psutil output.

  • If verbose is True, include output from both psutil and resource packages.

geoips.utils.memusg.print_resource_usage(logstr='')[source]#

Print verbose resource usage, using “resource” package.

geoips.utils.memusg.single_track_pid(procpid)[source]#

Output a snapshot of a pid usage on server.

  • Requires an input pid.

Module contents#

Geoips utilities init file.