wrainfo package

Submodules

wrainfo.attenuation_corr module

Attenuation correction module.

wrainfo.attenuation_corr.attenuation_correction(ds, moment)[source]

Attenuation correction with zphi method.

Parameters

ds : xarray.DataArray moment : xarray.DataArray

DBZH (clutter corrected)

Returns

: xarray.Dataset

xarray.Dataset with attenuation corrected refelctivity and recalculated variables.

wrainfo.attenuation_corr.cumulative_trapezoid(da, coord, **kwargs)[source]

Cumulative trapezoid integration.

Parameters

daxarray.DataArray

array with data to integrate

coordstr

name of coordinate to integrate over

Returns

: xarray.DataArray

DataArray with integrated values.

wrainfo.attenuation_corr.phase_zphi(phi, rng=1000.0, start_range=0.0)[source]

Preprocess of PHIDP.

Parameters

phi : xarray.DataArray rng : int

range to calculate the window to search precipitation bins

start_rangeint

distance from radar where the processing is starting

Returns

: xarray.Dataset

xarray.Dataset of preprocessed PHIDP.

wrainfo.attenuation_corr.zphi(refl, cphase, alphax=0.28, bx=0.78)[source]

Process of PHIDP, KDP and specific attenuation AH_ZPHI.

Parameter

reflxarray.DataArray

array with reflectivity

cphasexarray.DataArray

array of function phase_zphi

alphaxfloat

threshold, default for x-band: 0.28

bxfloat

threshold

Returns

: xarray.Dataset

xarray.Dataset with processed variables.

wrainfo.clutter module

Clutter detection module.

wrainfo.clutter.clutter_detection(ds, path)[source]

Set DBZH values, where clutter were identified, to NaN-values.

Parameters

ds : xarray.Dataset path : str

path to configuration file

Returns

: xarray.Dataset

xarray.Dataset with removed clutter.

wrainfo.clutter.clutter_fuzzy(obj, dat, **kwargs)[source]

Wrap fuzzy echo classification.

wrainfo.clutter.create_clutter_map_sequential(files, path_to_config_file, threshold=0, grp='sweep_0', status=False, logger=<RootLogger root (WARNING)>)[source]

Create a clutter map sequential in order to not overload the working memory.

Parameters

files : list path_to_config_file : str

path to configuration file

thresholdinteger

threshold of the reflectivity

statusbool

percent of progress

Returns

: xarray.Dataset

xarray.Dataset with clutter values.

wrainfo.clutter.fuzzy_echo_classification(ds)[source]

Fuzzy echo classification and clutter identification based on polarimetric variables.

Parameters

ds : xarray.Dataset

Returns

: xarray.Dataset

xarray.Dataset with a clutter map.

wrainfo.compression module

Compression module.

wrainfo.compression.compress_furuno_raw_data(start_time, end_time, path, delta=datetime.timedelta(days=1), delete_files=False)[source]

Create daily tar.gz files of FURUNO raw data.

Parameters

start_time : datetime.datetime end_time : datetime.datetime path : str

Path to configuration file

delta: datetime.delta

timestamp in which sequence the data will be processed

delete_filesbool

if True than files which are packed into tar.gz file were delete

Returns

: files

daily tar.gz files in output directory.

wrainfo.compression.extract_files(path, out_dir)[source]

Extract tar.gz - files.

Parameters

path : path to configuration file out_dir : dir where the extracted tar.gz files are saved

Returns

: files

Extracted tar.gz files in output directory.

wrainfo.error_flist module

Create error file list module.

wrainfo.error_flist.create_error_filelist(out_dir)[source]

Create error file list.

Parameter

out_dirstr

Output directory with filename

Return

: file

empty file in output directory.

wrainfo.error_flist.update_error_flist(start_time, end_time, path, pattern='_000.scnx.gz')[source]

Update error file list manually.

Parameter

start_time : datetime.datetime end_time : datetime.datetime path : str

Path to the configuration file

patternstr

extension of the scnx file (elevation angle 0.5° = “_000.scnx.gz”)

Return

: list

list of error files.

wrainfo.geometry module

Geometry module.

wrainfo.geometry.calculate_moments_wrapper(ds, **kwargs)[source]

Wrap function.

wrainfo.geometry.create_dataarray(ds, data, moment)[source]

Create data array.

wrainfo.geometry.create_dataset(ds, moments, xgrid, ygrid)[source]

Create xarray dataset.

wrainfo.geometry.furuno_cartesian_sweep_to_netcdf(ds, path, data_type=None)[source]

Create and save georeferenced NetCDF files.

Parameter

ds : xarray.Dataset path: str

path to configuration file

data_typestr

level of processing (Level1, Level2, or Level3)

Return

: NetCDF files

NetCDF files in output directory.

wrainfo.geometry.furuno_georeferencing(ds, path)[source]

Georeference FURUNO Dataset, Grid/Project moments to raster dataset with EPSG Code.

Parameters

ds : xarray.Dataset moments : list

list of selected data variables from the dataset

pathstr

path to configuration file

Returns

: xarray.Dataset

Georeferenced xarray.Dataset.

wrainfo.geometry.furuno_polar_sweep_to_netcdf(ds, path, data_type=None)[source]

Create and save georeferenced NetCDF files.

Parameter

ds : xarray.Dataset path: str

path to configuration file

data_typestr

level of processing (Level1, Level2, or Level3)

Return

: NetCDF files

NetCDF files in output directory.

wrainfo.geometry.get_source_coordinates(ds)[source]

Get source coordinates.

wrainfo.geometry.get_target_coordinates(grid)[source]

Get target coordinates.

wrainfo.geometry.get_target_grid(ds, nb_pixels)[source]

Get target grid.

wrainfo.geometry.ip_near_wrapper(ds, ygrid=None, xgrid=None, ip=None)[source]

Wrap function for interpolation.

wrainfo.precipitation module

Precipitation estimation module.

wrainfo.precipitation.qpe_zr(ds, moment, path, a=200, b=1.6)[source]

Qualitative precipitation estimation with z-R conversion.

Parameters

ds : xarray.Dataset moment : str

name of the clutter and attenuation corrected data array in the dataset.

pathstr

path to configuration file

ainteger

parameter for the z-R-conversion

(Marschall Palmer default value: a = 200, German Weather Service = 256)

bfloat

parameter for the z-R-conversion

(Marschall Palmer default value: b = 1.6, German Weather Service = 1.42)

Returns

: xarray.Dataset

xarray.Dataset with a data array of derived precipitation amounts.

wrainfo.process_chains module

Process chains module.

wrainfo.process_chains.clutter_chain(start_time, path, elevation_angle='dataset1', days=90, threshold=0, status=True, pattern='_000.scnx.gz', data_type='cmap', logger=<RootLogger root (WARNING)>)[source]

Create a ground clutter map and save NetCDF-file.

Parameters

start_timedatetime.datetime

start time which files will be read

pathstr

path to configuration file

elevation_anglestr

choose dataset of one elevation angle (for example: dataset 1 is elevation angle 0.5°)

daysinteger

Number of days for which a cmap is created

thresholdfloat

this is a threshold for the DBZH it should not be negative

statusbool

percentage of the finished clutter map

patternstr

extension of the scnx files (scnx file: elevation angle 0.5° = “_000.scnx”)

data_typestr

the clutter map (cmap) were created

loggerfile

writing status messages to a file

Returns

: files

NetCDF - files in output directory.

wrainfo.process_chains.static_cmap(path, pattern='_elev_0.5_cmap.nc')[source]

Create a static ground clutter map and save NetCDF-file.

Parameters

pathstr

path to configuration file

patternstr

extension of the netcdf file (cmaps for different elevation angles)

Returns

: files

NetCDF - files in output directory.

wrainfo.process_chains.wr_routine_furuno(starttime, endtime, delta, path, data_type='Level2a', elevation_angle='sweep_0', pattern='_000.scnx.gz', logger=<RootLogger root (WARNING)>)[source]

Process of Furuno raw data.

Parameters

starttime : datetime.datetime endtime : datetime.datetime delta : datetime.delta path : str

path to configuration file

data_typestr

Level of processing

patternextension of the scnx file

(scnx file: elevation angle 0.5° = “_000.scnx”)

elevation_anglestr

group of hdf5 dataset

loggerfile

writing status messages to a file

Returns

: files

NetCDF - files in output directory

wrainfo.reader module

Reader module.

wrainfo.reader.create_filelist(starttime, endtime, path_to_config_file, pattern='_000.scnx.gz')[source]

Create filelist from path_glob and filename dates.

Parameters

starttimedt.datetime

start time

endtimedt.datetime

end time

path_to_config_filestr

Path to configuration file

patternstr

extension of the scnx/netcdf file (scnx file: elevation angle 0.5° = “_000.scnx.gz”)

Returns

: list

list of files

wrainfo.reader.get_cmap(starttime, endtime, path, elev='0.5', timestr='%Y%m%d')[source]

Read processed cluttermap from Furuno.

Parameters

starttimedatetime.datetime

datetime - object to select correct files for list

endtimedatetime.datetime

datetime - object to select correct files for list

pathstr

Path to configuration file

elevstr

selected elevation angle of cmap

Returns

: xarray.Dataset

clutter map as xarray.Dataset.

wrainfo.reader.get_datetime_from_filename(filename, regex)[source]

Get datetime from filename.

wrainfo.reader.get_file_date_regex(filename)[source]

Get regex from filename.

wrainfo.reader.get_furuno_path(path, start_time=datetime.datetime(2024, 3, 20, 11, 4, 46, 396589))[source]

Create path of Furuno radar data files.

Parameters

pathstr

Path to configuration file

start_timedatetime.datetime

datetime object to select correct folder

Returns

radar_pathstr

Path to radar data

wrainfo.reader.load_error_flist(path)[source]

Load error file list.

Parameter

pathstr

Path to configuration file

Returns

: list

list of error files.

wrainfo.reader.read_config_file(path, selection=None)[source]

Read wr_furuno config file in json format.

Parameter

pathstr

Path to config file in json format.

selectionstr

select setting parameter

Return

: dict

configured directories in the configuration file.

wrainfo.reader.read_multiple_scnx_files(starttime, endtime, path, pattern)[source]

Read multiple files, reindexes and returns a dataset object.

Parameters

starttimedt.datetime

start time

endtimedt.datetime

end time

pathstr

path to configuration file

patternstr

extension of the scnx/netcdf file (scnx file: elevation angle 0.5° = “_000.scnx.gz”)

Returns

: xarray Dataset

xarray Dataset with variables.

wrainfo.reader.read_single_file(file, path, grp='sweep_0')[source]

Read a single file, reindexes and returns a dataset object.

Parameters

filestr

path to file as string

pathstr

path to configuration file

grpstr

hdf5 group (elevation angle)

Returns

: xarray Dataset

xarray Dataset with variables.

wrainfo.version module

Version module for WRaINfo.

Module contents

Top-level package for WRaINfo.