pylag.processing.utils module
PyLag utility functions
- pylag.processing.utils.get_grid_bands(array_in)[source]
Return grid bands for data on a regular 1D grid
- Parameters:
array (1D NumPy array) – 1D array of regularly spaced data
- Returns:
1D array with size len(array) + 1, corresponding to the grid edges
- Return type:
1D NumPy Array
- pylag.processing.utils.get_time_index(dates, ref_date, tol=60)[source]
Get array index that best matches ref_date
- Parameters:
dates (ndarray, Datetime)
ref_date (Datetime)
- pylag.processing.utils.round_time(datetime_raw, rounding_interval=3600)[source]
Apply rounding to datetime objects
Rounding is sometimes required when simulation times are written to file with limited precision.
- Parameters:
datetime_raw (List, Datetime) – List of datetime objects to which rounding should be applied
rounding_interval (int, optional) – No. of seconds to round to (default 3600, or one hour)
Returns
--------
datetime_rounded (List, Datetime) – List of rounded datetime objects