Raw Data I/O¶
Please have a look at the tutorial Supported radar data formats for an introduction on how to deal with different file formats.
Digital Elevation Model I/O¶
Provide surface/terrain elevation information from SRTM data
download_srtm |
Download NASA SRTM elevation data Version 3 is only available with a login and a token |
get_srtm |
Get NASA SRTM elevation data |
Raster and Vector I/O using GDAL¶
open_vector |
Open vector file, return gdal.Dataset and OGR.Layer |
open_raster |
Open raster file, return gdal.Dataset |
read_safnwc |
Read MSG SAFNWC hdf5 file into a gdal georeferenced object |
gdal_create_dataset |
Creates GDAL.DataSet object. |
write_raster_dataset |
Write raster dataset to file format |
HDF Data I/O¶
read_generic_hdf5 |
Reads hdf5 files according to their structure |
read_opera_hdf5 |
Reads hdf5 files according to OPERA conventions |
read_gamic_hdf5 |
Data reader for hdf5 files produced by the commercial GAMIC Enigma V3 MURAN software |
to_hdf5 |
Quick storage of one <data> array and a <metadata> dict in an hdf5 file |
from_hdf5 |
Loading data from hdf5 files that was stored by to_hdf5 |
read_gpm |
Reads GPM files for matching with GR |
read_trmm |
Reads TRMM files for matching with GR |
Read IRIS Data Format¶
Reads data from Vaisala’s IRIS data formats
IRIS (Vaisala Sigmet Interactive Radar Information System)
See M211318EN-F Programming Guide ftp://ftp.sigmet.com/outgoing/manuals/
To read from IRIS files numpy.memmap is used to get access to
the data. The IRIS header (PRODUCT_HDR, INGEST_HEADER) is read in any case
into dedicated OrderedDict’s. Reading sweep data can be skipped by setting
loaddata=False. By default the data is decoded on the fly.
Using rawdata=True the data will be kept undecoded.
IrisRecord |
Class holding a single record from a Sigmet IRIS file. |
IrisHeaderBase |
Base Class for Iris Headers. |
IrisStructureHeader |
Iris Structure Header class. |
IrisIngestHeader |
Iris Ingest Header class. |
IrisProductHeader |
Iris Product Header class. |
IrisIngestDataHeader |
Iris Ingest Data Header class. |
IrisFileBase |
Base class for Iris Files. |
IrisFile |
IrisFile class |
IrisIngestHeaderFile |
Iris Ingest Header File class. |
IrisIngestDataFile |
Iris Ingest Data File class. |
IrisRecordFile |
Iris Record File class |
IrisRawFile |
Iris Raw File class. |
IrisProductFile |
Class for retrieving data from Sigmet IRIS Product files. |
IrisCartesianProductFile |
Class for retrieving data from Sigmet IRIS Cartesian Product files. |
read_iris |
Read Iris file and return dictionary. |
Miscellaneous Data I/O¶
write_polygon_to_text |
Writes Polygons to a Text file which can be interpreted by ESRI ArcGIS’s “Create Features from Text File (Samples)” tool. |
to_pickle |
Pickle object <obj> to file <fpath> |
from_pickle |
Return pickled object from file <fpath> |
get_radiosonde |
Download radiosonde data from internet. |
get_membership_functions |
Reads membership function parameters from wradlib-data file. |
Read NetCDF¶
read_edge_netcdf |
Data reader for netCDF files exported by the EDGE radar software |
read_generic_netcdf |
Reads netcdf files and returns a dictionary with corresponding structure. |
Read RADOLAN and DX¶
Reading DX and RADOLAN data from German Weather Service
read_dx(filename) |
Data reader for German Weather Service DX product raw radar data files. |
read_radolan_composite(f[, missing, loaddata]) |
Read quantitative radar composite format of the German Weather Service |
get_radolan_filehandle(fname) |
Opens radolan file and returns file handle |
read_radolan_header(fid) |
Reads radolan ASCII header and returns it as string |
parse_dwd_composite_header(header) |
Parses the ASCII header of a DWD quantitative composite file |
read_radolan_binary_array(fid, size) |
Read binary data from file given by filehandle |
decode_radolan_runlength_array(binarr, attrs) |
Decodes the binary runlength coded section from DWD composite file and return decoded numpy array with correct shape |
radolan_to_xarray(data, attrs) |
Converts RADOLAN data to xarray Dataset |
Read Rainbow¶
read_rainbow |
Reads Rainbow files files according to their structure |
Xarray powered Data I/O¶
Reads data from netcdf-based CfRadial1, CfRadial2 and hdf5-based ODIM_H5 and other hdf5-flavours (GAMIC).
Writes data to CfRadial2 and ODIM_H5 files.
This reader implementation uses
Currently there are two different approaches.
In the first approach the data is claimed using netcdf4-Dataset in a diskless non-persistent mode:
nch = nc.Dataset(filename, diskless=True, persist=False)
Further the different netcdf/hdf groups are accessed via xarray open_dataset and the NetCDF4DataStore:
xr.open_dataset(xr.backends.NetCDF4DataStore(nch), mask_and_scale=True)
For hdf5 data scaling/masking properties will be added to the datasets before decoding. For GAMIC data compound data will be read via h5py.
The data structure holds one or many [‘sweep_X’] xarray datasets, holding the sweep data. The root group xarray dataset which corresponds to the CfRadial2 root-group is available via the .root-object.
The writer implementation uses xarray for CfRadial2 output and relies on h5py for the ODIM_H5 output.
The second approach reads ODIM files (metadata) into a simple accessible structure:
vol = wradlib.io.open_odim(paths, loader='netcdf4', **kwargs)
All datafiles are accessed via the given loader (‘netcdf4’, ‘h5py’, ‘h5netcdf’). Only absolutely neccessary data is actually read in this process, eg. acquisition time and elevation, to fill the structure accordingly. All subsequent metadata retrievals are cached to further improve performance. Actual data access is realised via xarray using engine ‘netcdf4’ or ‘h5netcdf’, depending on the loader.
Since for data handling xarray is utilized all xarray features can be exploited, like lazy-loading, pandas-like indexing on N-dimensional data and vectorized mathematical operations across multiple dimensions.
Examples
Warning
This implementation is considered experimental. Changes in the API should be expected.
XRadVol |
BaseClass for xarray based RadarVolumes |
CfRadial |
Class for xarray based retrieval of CfRadial data files |
OdimH5 |
Class for xarray based retrieval of ODIM_H5 data files |
to_cfradial2 |
Save XRadVol/XRadVolume to CfRadial2.0 compliant file. |
to_odim |
Save XRadVol/XRadVolume to ODIM_H5/V2_2 compliant file. |
open_odim |
Open multiple ODIM files as a XRadVolume structure. |
XRadSweep |
Class for holding one radar sweep |
XRadMoment |
Class for holding one radar moment |
XRadTimeSeries |
Class for holding a timeseries of radar sweeps |
XRadVolume |
Class for holding a volume of radar sweeps |
create_xarray_dataarray |
Deprecated since version 1.5. |