swirlspy.qpf package
Submodules
swirlspy.qpf.persistence module
- swirlspy.qpf.persistence.persistence(xr2d, timesteps, timesteps_size)
Create a persistence xarray.
- Parameters
xr2d (xarray.DataArray (2-dimensional, in 'x' 'y')) – The xarray containing data to be forecasted.
timesteps (int) – Number of timesteps to be forecasted.
timesteps_size (int) – Time interval between each steps, in minutes.
- Returns
persistence_xrnd – Data values in ‘xr2d’ being copied along the ‘end_time’ axis, coordinates of ‘end_time’ axis have a unique value for each timestep.
- Return type
xarray.DataArray
swirlspy.qpf.qpftools module
- swirlspy.qpf.qpftools.flip_grid(grid)
Flip a grid vertically (in y-axis).
- Parameters
grid (numpy.ndarray) –
- Returns
flipped grid
- Return type
numpy.ndarray
- swirlspy.qpf.qpftools.grid2ascii(grid_number, gridded_flip, ncols, nrows, xllcenter, yllcenter, cellsize, nodata_value, valid_time, steps, time_step_size, start_level, end_level, rho, alpha, sigma)
Export 2 radar data grid (cartesian coordinates) in consecutive timesteps and rover parameters on a text file (.txt) in ascii format.
Text file returned by this function is the input file for “rover” for extrpolation.
- Parameters
grid_number –
gridded_flip –
ncols –
nrows –
xllcenter –
yllcenter –
cellsize –
:param : :param nodata_value: :param valid_time: :param steps: :param time_step_size: :param start_level: :param end_level: :param : :param rho: :param alpha: :param sigma:
- Returns
“rover-input.txt”,
a text file located at directory “./input”.
- swirlspy.qpf.qpftools.grid2txt(file, grid)
Export a data grid on a .txt file.
- Parameters
file (str) – Name of the output text file.
grid (numpy.ndarray) – Data grid to be exported.
- Returns
A .txt file named according to the above input parameter “file”,
where number of lines equals row number of the input grid,
number of data on each line equals column number of the input grid.
- swirlspy.qpf.qpftools.oslv_qpf(qpf_xarray, xllcenter, yllcenter, valid_time, steps, time_step_size, path, radar_output_file_path)
Call ‘rover’ at OS level.
- Parameters
qpf_xarray (xarray.DataArray) – A ‘xrnd’ (Two ‘xr2d’ concatenated) from function ‘xrnd’.
xllcenter (float) – Radar site longitude.
yllcenter (float) – Radar site latitude.
valid_time (str) – [YYYYMMDDhhmm] of the first-timestep radar file.
steps (int) – Number of timesteps to extrapolate. Default is 6.
time_step_size (int) – Seperation time between 2 input radar files in minutes.
path (str) – Hardcoded as “/builds/com-swirls/swirlspy/swirlspy/qpf/output”.
radar_output_file_path (str) – Hardcoded as ‘path+”/”+file_type+”_”+valid_time’. (where file_type is radar format, and valid_time is time of radar file).
- swirlspy.qpf.qpftools.rover_colorimage(path)
Plot radar data from “rover-output-[timestep].txt” as color images.
(“rover-output-[timestep].txt” are output files located at “./output” from the program “rover” (Default path)).
- Parameters
path (str) – Directory to look for “rover-output-[timestep].txt”.
- Returns
Color images named “rover-output-[timestep].png”, located at
”./output”(Default path).
- swirlspy.qpf.qpftools.time_update(initial, time_step_size)
Shift time by a certain amount.
- Parameters
initial (str) – Base time, in YYYYMMDDhhmm.
time_step_size (str) – Amount of time to shift, in minutes.
- Returns
end – Updated time, in YYYYMMDDhhmm.
- Return type
str
- swirlspy.qpf.qpftools.txt2image(file)
Plot a data grid in text file as a color image.
- Parameters
file (str) – Filename of text file containing data grid.
- Return type
Color image named “filename_of_input_text_file.png”