""" Quantitative Precipitation Forecast (QPF) ==================================================== This example demonstrates how to perform QPF using radar data """ import xarray as xr import swirlspy.qpf.qpfrover as rov import numpy as np import os from swirlspy.rad.cinrad import read_cinrad from swirlspy.rad.xrnd import xrnd import os.path try: THIS_DIR = os.path.dirname(os.path.abspath(__file__)) except NameError: import sys THIS_DIR = os.path.dirname(os.path.abspath(sys.argv[0])) ############################################################# # Initialising # --------------------------------------------------- # # Read data from files (in this example, the files are # in cinrad format) and storing data as xarrays. file_type = 'cinrad-cband' valid_time = '201805150624' xllcenter = 113.35 yllcenter = 23.0 steps = 6 time_step_size = 5 # radar_radius = 256 os.chdir(THIS_DIR + "/../tests/test_qpf") file_name1 = "Z_RADR_I_Z9290_20180515062400_O_DOR_CB_CAP.bin" file_name2 = "Z_RADR_I_Z9290_20180515062900_O_DOR_CB_CAP.bin" # Reading file data, storing as xarray xarray1 = read_cinrad(file_name1, 113.35, 23.0, 480, 480, '201805150624', 5, 'aeqd', 256, 'c-band') xarray2 = read_cinrad(file_name2, 113.35, 23.0, 480, 480, '201805150629', 5, 'aeqd', 256, 'c-band') qpf_xarray = xrnd(xarray1, xarray2) os.chdir(THIS_DIR) #################################### # Extrapolation # ------------------------------ # Perform rover extrapolation # Calling rover motion_u, motion_v, reflectivity = rov.rover_qpf(qpf_xarray, xllcenter, yllcenter, valid_time, steps, time_step_size, THIS_DIR) ################################################### # Generating radar plots # ------------------------ # # Here we generate radar colour-images based on forecasted # data over the next six timesteps. rov.rover_map(reflectivity, THIS_DIR)