#!/usr/bin/env python3 ############################################################################ # Copyright (C) 2024 by gempa GmbH # # # # All Rights Reserved. # # # # NOTICE: All information contained herein is, and remains # # the property of gempa GmbH and its suppliers, if any. The intellectual # # and technical concepts contained herein are proprietary to gempa GmbH # # and its suppliers. # # Dissemination of this information or reproduction of this material # # is strictly forbidden unless prior written permission is obtained # # from gempa GmbH. # ############################################################################ import numpy as np from gempa import CAPS def calculateAbsPerc(grid, percentile=99.9): grid_array = np.array(grid) result = np.percentile(np.abs(grid_array), percentile) return result def parseTime(s): formats = ["%F", "%F %T", "%F %T.%Z", "%FT%T", "%FT%T.%Z"] for fmt in formats: time = CAPS.Time.FromString(s, fmt) if time.valid(): return time return None