swirlspy.rad package

Radar data loader and methods.

swirlspy.rad.calc_vii(reflectivity, h40, h10, rhoi=917, no=4000000.0)

Calculates the Vertically Integrated Ice (VII) Equation derived from Carey and Rutledge (2000).

Parameters
  • reflectivity (xarray.DataArray) – The reflectivity values in 3D at a single time. Coordinates are (‘time’, ‘height’, ‘y’, ‘x’).

  • h40 (float) – The height of the -40 u’°’C isotherm in meters.

  • h10 (float) – The height of the -10 u’° isotherm in meters.

  • rhoi (float) – The density of ice. Defaults to 917kg/m^3.

  • no (float) – The intercept parameter. Defaults to 4e6 m^-4.

Returns

vii – Vertically integrated Ice. Coordinates are (‘time’, ‘y’, ‘x’).

Return type

xarray.DataArray

swirlspy.rad.calc_vil(reflectivity)

Calculate Vertically Integrated Liquid from a 3D radar scan.

Parameters

reflectivity (xarray.DataArray) – The reflectivity data in 3D. Coordinates are [‘time’, ‘height’, ‘y’, ‘x’].

Returns

vil – The Vertically Integrated Liquid values.

Return type

xarray.DataArray

swirlspy.rad.read_ascii(file, valid_time, path='')

Reads ASCII file. The data should already be in Cartesian coodinates in Equidistant Cylindrical Projection (Plate Carree). Returns a labelled xarray.DataArray.

Parameters
  • file (str) – Name of ASCII file to read.

  • valid_time (str) – Time in [%Y%m%d%H%M] of the first timestep radar file.

  • path (str, optional) – If provided, save the result as a NetCDF file to the path specified.

Returns

xr_dataarray – A xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_cinrad_sc_data(file, site, valid_time, band, area_def=None, coord_label=['x', 'y'], radar_radius=250000, xres=500, yres=500, minutize=True, path='')

Reads old version cinrad radar data (either in c-band or s-band). Returns reflectivity data as xarray.DataArray.

Parameters
  • file (str) – Name of CINRAD file to read. Reflectivity data contained by this file should be in spherical coordinates.

  • site (tuple of floats) – (Longitude, Latitude) of radar site

  • valid_time (str) – %y%m%d%H%M of the first-timestep radar file.

  • band (str) – Band name, either “c-band” or “s-band”

  • area_def (pyresample.geometry.AreaDefinition) – Pyresample AreaDefinition of the target grid. Defaults to None.

  • coord_label (list of strings.) – [x_axis_label, y_axis_label]. Defaults to [‘x’, ‘y’].

  • radar_radius (float) – Radar radius in units of targeted projection. Default to 250000. Units in meters.

  • xres(optional) (int) – Only define if area_def is not defined. x-resolution of the default grid. Defaults to 500.

  • yres(optional) (int) – Only define if area_def is not defined. y-resolution of the default grid. Defaults to 500.

  • minutize(optional) (bool) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

  • path (str, optional) – If provided, save the result as a NetCDF file to the path specified.

Returns

reflectivity – A xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_cinrad_standard_data(file, area_def=None, coord_label=['x', 'y'], radar_radius=250000, xres=500, yres=500, minutize=True, path='')

Reads cinrad standard data. Returns reflectivity data as xarray.DataArray.

Parameters
  • file (str) – Name of CINRAD file to read. Reflectivity data contained by this file should be in spherical coordinates.

  • area_def (pyresample.geometry.AreaDefinition) – Pyresample AreaDefinition of the target grid. Defaults to None.

  • coord_label (list of strings.) – [x_axis_label, y_axis_label]. Defaults to [‘x’, ‘y’].

  • radar_radius (float, optional) – Radar radius in units of targeted projection. Default to 250000. Units in meters.

  • xres (int, optional) – Only define if area_def is not defined. x-resolution of the default grid. Defaults to 500.

  • yres (int, optional) – Only define if area_def is not defined. y-resolution of the default grid. Defaults to 500.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

  • path (str, optional) – If provided, save the result as a NetCDF file to the path specified.

Returns

reflectivity – A xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_hdf5(file, minutize=True, path='')

Reads hdf5 file. Reflectivity data should already be in Cartesian Coordinates in Azimuthal Equidistant Projection. Units are in metres for distance x and y from the radar site. Returns a labelled xarray.DataArray.

Parameters
  • file (str) – Name of the hdf5 file to read. Reflectivity data of this file should already be in Cartesian Coordinates.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

  • path (str, optional) – If provided, save output as NetCDF to the path provided.

Returns

reflectivity – A xarray.DataArray populated with radar reflectivity and metadata. Coodinate vertices of grid can be accessed through DataArray attributes.

Return type

xarray.DataArray

swirlspy.rad.read_iris_grid(file, long_name='Reflectivity', units='dBZ', NAN=[95.5], minutize=True, path='')

Reads Vaisala Sigmet IRIS REF data file. Data already in Cartesian Coordinates in Centered Azimuthal Projection. Returns a labelled xarray.DataArray.

Parameters
  • file (str) – Name of IRIS REF file to read.

  • long_name (str or NoneType) – Name of the xarray.DataArray. Defaults to “Reflectivity”. If argument is NoneType, the product name will be used as the long name.

  • units (str) – The units of the data in the xarray.DataArray. Defaults to dBZ.

  • NAN (list of floats) – List of values to be considered NAN. Defaults to 95.5. The null values provided should already be decoded. For example, for reflectivity, undecoded value is 255, therefore (255-64)/2 = 95.5 is provided.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

  • path (str, optional) – If provided, save the result as a NetCDF file to the path specified.

Returns

reflectivity – A xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_iris_raw(file, area_def=None, coord_label=['x', 'y'], indicator='deg_ppi', elevation=None, ipol=<class 'wradlib.ipol.Idw'>, radar_radius=250000, xres=500, yres=500, minutize=True, path='')

Reads Vaisala Sigmet IRIS RAW data file. Regrid radar reflectivity data from Spherical coordinates to Cartesian coordinates, in a projection specified with pyresample’s AreaDefinition. Returns a labelled xarray.DataArray.

Parameters
  • file (str or list of strings) – Name of IRIS RAW file(s) to read.

  • area_def (pyresample.geometry.AreaDefinition) – Pyresample AreaDefinition of the target grid. Defaults to None.

  • coord_label (list of strings.) – [x_axis_label, y_axis_label]. Defaults to [‘x’, ‘y’].

  • indicator (str) – Plan position indicator to be visualised. Defaults to ‘deg_ppi’. Alternative is ‘cappi’.

  • elevation (float) – The elevation level in degrees to choose from. Related with parameter ‘indicator’. Units are in degrees if indicator = ‘deg_ppi’ and in km if indicator = cappi. Defaults to None, where the minimum elevation in degrees will be taken. A nearest interpolation is used, hence it is assumed that elevation specified here does not differ much from those available in the data.

  • ipol (wradlib.ipol, optional) – An interpolation class from wradlib.ipol. Enables the specification of interpolation method for conversion from spherical to cartesian coordinates.

  • radar_radius (float, optional) – Radar radius in units of targeted projection. Default to 250000. Units in meters.

  • xres (int, optional) – Only define if area_def is not defined. x-resolution of the default grid. Defaults to 500.

  • yres (int, optional) – Only define if area_def is not defined. y-resolution of the default grid. Defaults to 500.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

  • path (str, optional) – If provided, save the result as a NetCDF file to the path specified.

Returns

reflectivity – A xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_iris_raw_3d(files, area_def=None, elevs=array([0.1, 0.9, 1.8, 2.7, 3.6, 5.4]), elevs_precision=0.1, heights=array([    0.,  1000.,  2000.,  3000.,  4000.,  5000.,  6000.,  7000.,         8000.,  9000., 10000., 11000., 12000., 13000., 14000., 15000.]), coord_label=['x', 'y', 'height'], ipol=<class 'wradlib.ipol.Idw'>, radar_radius=250000, xres=500, yres=500, minutize=True, path='')

Reads Vaisala Sigmet IRIS RAW data file. Regrid radar reflectivity data from Spherical coordinates to Cartesian coordinates, in a projection specified with pyresample’s AreaDefinition. Returns a labelled xarray.DataArray in 3D.

Parameters
  • files (list of str) – Name of IRIS RAW files to read.

  • area_def (pyresample.geometry.AreaDefinition) – Pyresample AreaDefinition of the target grid. Defaults to None.

  • elevs (numpy.1darray) – The elevation degree bins. The elevation degrees in the data are binned to solve the small discrepancies between them. Defaults to np.array([0.1, 0.9, 1.8, 2.7, 3.6, 5.4]).

  • elevs_precision (float) – The precision of elevs (in degrees). Defaults to 0.1.

  • heights (numpy.1darray) – Array of heights in metres. Defaults to np.linspace(0., 15000., 16).

  • coord_label (list of strings) – [x_axis_label, y_axis_label, z_axis_label]. Defaults to [‘x’, ‘y’, ‘height’].

  • ipol (wradlib.ipol, optional) – An interpolation class from wradlib.ipol. Enables the specification of interpolation method for conversion from spherical to cartesian coordinates.

  • radar_radius (float, optional) – Radar radius in units of targeted projection. Default to 250000. Units in meters.

  • xres (int, optional) – Only define if area_def is not defined. x-resolution of the default grid. Defaults to 500.

  • yres (int, optional) – Only define if area_def is not defined. y-resolution of the default grid. Defaults to 500.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

  • path (str, optional) – If provided, save the result as a NetCDF file to the path specified.

Returns

reflectivity – A xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_netcdf_id(file_path, max_elevation_index: Optional[int] = None)

Reads Indonesia netCDF file and returns reflectivity data in xarray.DataArray. Units are in metres for distances x and y away from the radar site. Returns a labelled xarray.DataArray.

Parameters
  • file_path (str) – File path of Indonesia EEC radar data file to read (CFRadial format).

  • max_elevation_index (int) – Maximum elevation index to be used.

Returns

reflectivity – A labelled xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_netcdf_ph(file, minutize=True)

Reads Philippine netCDF file and returns reflectivity data in xarray.DataArray. Reflectivity data should be in Cartesian Coordinates in Azimuthal Equidistant Projection. Units are in metres for distances x and y away from the radar site. Returns a labelled xarray.DataArray.

Parameters
  • file (str) – Name of Philippine netCDF file to read. Reflectivity should already be in Cartesian Coordinates. in Azimuthal Equidistant Projection.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

Returns

reflectivity – A labelled xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_netcdf_th_precip(file, minutize=True)

Reads Thailand netCDF file. Data is already in LatLon Cartesian Coordinates. Returns an xarray.DataArray.

Parameters
  • file (str) – Name of netCDF file to read.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

Returns

precipitation – A labelled xarray populated with hourly precipitation and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_netcdf_vn_dh(file, minutize=True)

Reads Vietnamese netCDF file (file name begins with “DH”). Data is already in LatLon Cartesian Coordinates. Returns an xarray.DataArray.

Parameters
  • file (str) – Name of netCDF file to read.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

Returns

reflectivity – A labelled xarray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_netcdf_vn_don(file, area_def=None, coord_label=['x', 'y'], radar_radius=250000, xres=500, yres=500, minutize=True)

Reads Vietnamese netCDF file (file name begins with “DON”). Regrid reflectivity data from Polar coordinates to Cartesian coordinates in projection specified by AreaDefinition. Returns a labelled xarray.DataArray.

Parameters
  • file (str) – Name of netCDF file to read

  • area_def (pyresample.geometry.AreaDefinition) – Pyresample AreaDefinition of the target grid. Defaults to None.

  • coord_label (list of strings) – [x_axis_label, y_axis_label]. Defaults to [‘x’, ‘y’].

  • radar_radius (float, optional) – Radar radius in units of targeted projection. Defaults to 250000

  • xres (int, optional) – Only define if area_def is not defined. x-resolution of the default grid. Defaults to 500.

  • yres (int, optional) – Only define if area_def is not defined. y-resolution of the default grid. Defaults to 500.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

Returns

reflectivity – A xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

swirlspy.rad.read_uf_ph_3d(file, area_def=None, elevs=array([0.5, 1.5, 2.4, 3.4, 4.3, 5.3, 6.2]), heights=array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10., 11., 12.,        13., 14., 15.]), coord_label=['x', 'y', 'height'], ipol=<class 'wradlib.ipol.Idw'>, radar_radius=250000, xres=500, yres=500, minutize=True, path='')

Reads Philippine UF file. Regrid reflectivity data from Polar coordinates to Cartesian coordinates in projection specified by AreaDefinition. Returns a labelled xarray.DataArray.

Parameters
  • file (list of str) – Name of IRIS RAW file to read.

  • area_def (pyresample.geometry.AreaDefinition) – Pyresample AreaDefinition of the target grid. Defaults to None.

  • elevs (numpy.1darray) – The elevation degree bins. The elevation degrees in the data are binned to solve the small discrepancies between them. Defaults to np.array([0.5, 1.5, 2.4, 3.4, 4.3, 5.3, 6.2]).

  • heights (numpy.1darray) – Array of heights in kilometres. Defaults to np.linspace(0., 15., 16).

  • coord_label (list of strings.) – [x_axis_label, y_axis_label, z_axis_label]. Defaults to [‘x’, ‘y’, ‘height’].

  • radar_radius (float, optional) – Radar radius in units of targeted projection. Default to 250000. Units in meters.

  • xres (int, optional) – Only define if area_def is not defined. x-resolution of the default grid. Defaults to 500.

  • yres (int, optional) – Only define if area_def is not defined. y-resolution of the default grid. Defaults to 500.

  • minutize (bool, optional) – If True, pandas.Timestamps are rounded down to the nearest minute. Defaults to True.

  • path (str, optional) – If provided, save the result as a NetCDF file to the path specified.

Returns

reflectivity – A xarray.DataArray populated with radar reflectivity and metadata.

Return type

xarray.DataArray

Submodules

swirlspy.rad.ascii module

swirlspy.rad.cinrad module

swirlspy.rad.hdf5 module

swirlspy.rad.iris module

swirlspy.rad.netcdf_id module

swirlspy.rad.netcdf_ph module

swirlspy.rad.netcdf_vn_dh module

swirlspy.rad.netcdf_vn_don module

swirlspy.rad.uf_ph module