Utility Functions

Dates and Times

pb_gee_tools.utils.do_dates_overlap(s1_date: datetime, e1_date: datetime, s2_date: datetime, e2_date: datetime)

A function which checks if two dated periods overlap.

Parameters:
  • s1_date – start of period 1

  • e1_date – end of period 1

  • s2_date – start of period 2

  • e2_date – end of period 2

Returns:

boolean - True the two periods overlap, False otherwise

pb_gee_tools.utils.create_year_month_start_end_lst(start_year: int, start_month: int, end_year: int, end_month: int) List[Tuple[int, int]]

A function which creates a list of year and month tuples from a start and end month and year.

Parameters:
  • start_year – int with the start year

  • start_month – int with the start month

  • end_year – int with the end year

  • end_month – int with the end month

Returns:

List of tuples (year, month)

pb_gee_tools.utils.create_year_month_n_months_lst(start_year: int, start_month: int, n_months: int) List[Tuple[int, int]]

A function which creates a list of year and month tuples from a start and end month and year.

Parameters:
  • start_year – int with the start year

  • start_month – int with the start month

  • n_months – int with the number of months ahead

Returns:

List of tuples (year, month)

pb_gee_tools.utils.find_month_end_date(year: int, month: int) int

A function which returns the date of the last day of the month.

Parameters:
  • year – int for the year (e.g., 2019)

  • month – month (e.g., 9)

Returns:

last day of the month date