Missing_data#

Hydrological_model_validator.Processing.Missing_data.check_missing_days(T_orig: ndarray, data_orig: ndarray, desired_start_date: datetime = datetime.datetime(2000, 1, 1, 0, 0)) Tuple[ndarray, ndarray][source]#

Fill missing days in a time series based on expected daily intervals. Automatically shifts the time series so the first timestamp corresponds to desired_start_date.

Parameters:
  • T_orig (np.ndarray) – 1D array of timestamps (in seconds since epoch).

  • data_orig (np.ndarray) – 3D array with shape (time, lat, lon), matching T_orig in the first dimension.

  • desired_start_date (datetime, optional) – The desired start date to align the time series to (default is 2000-01-01).

Returns:

  • Ttrue (np.ndarray) – Complete array of timestamps with daily spacing, shifted to desired_start_date.

  • data_complete (np.ndarray) – Data array with NaNs inserted where gaps were detected.

Raises:
  • TypeError – If input types are incorrect.

  • ValueError – If input shapes are invalid or time step is non-positive.

  • AssertionError – If time series is out of order or length mismatch occurs.

Hydrological_model_validator.Processing.Missing_data.eliminate_empty_fields(data_complete: ndarray) ndarray[source]#

Replace empty chlorophyll fields (days where all values are NaN or zero) with NaNs.

Parameters:

data_complete (np.ndarray) – 3D array of chlorophyll data with shape (days, lat, lon).

Returns:

Modified array with empty daily fields set entirely to NaN.

Return type:

np.ndarray

Raises:
  • TypeError – If input is not a NumPy array.

  • ValueError – If input array does not have 3 dimensions.

Examples

>>> data = np.random.rand(10, 5, 5)
>>> data[3] = 0  # simulate empty day
>>> data[7] = np.nan
>>> result = eliminate_empty_fields(data)
Hydrological_model_validator.Processing.Missing_data.find_missing_observations(data_complete: ndarray) Tuple[int, List[int]][source]#

Identify days with no satellite observations (all NaN or zero).

Parameters:

data_complete (np.ndarray) – 3D array of shape (days, lat, lon) with satellite data.

Returns:

  • cnan (int) – Number of days with no satellite observations.

  • satnan (List[int]) – Indices of days with no valid observations.

Raises:
  • TypeError – If input is not a NumPy array.

  • ValueError – If input array does not have 3 dimensions.