Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

radolan_to_netcdf

Build Status Code Coverage Binder DOI

A Python package to parse RADOLAN binary data files to NetCDF

Features

  • create CF-conform NetCDFs for RADOLAN data and parse RADOLAN binary files
  • write back to RADOLAN-binary format
  • supported products:
    • RADOLAN-RW (gauge adjusted hourly rainfall sum)
    • RADOLAN-RY (5-minute unadjusted rainfall sum), example notebook also available on mybinder
    • RADKLIM-YW (5-minute rainfall sum with "climatological" corrections), example notebook also available on mybinder

Example usage

Assuming that you have some RADOLAN binary files on your hard drive it only takes some lines of code using radolan_to_netcdf to create a CF-conform NetCDF:

import tqdm
import radolan_to_netcdf as rtn

fn_netcdf = 'radolan_ry.nc'
rtn.create_empty_netcdf(fn=fn_netcdf, product_name='RY')

for fn in tqdm.tqdm(fn_list):
    data, metadata = rtn.read_in_one_bin_file(fn)
    rtn.append_to_netcdf(fn_netcdf, data_list=[data, ], metadata_list=[metadata, ],)

Create RADOLAN-RY NetCDF

For the full example using RADOLAN-RY data (5-minute radar rainfall composite for Germany), see the notebook here or open it on mybinder

The content of the created NetCDF can easily be plotted on a dynamic map thanks to xarray and hvplot with a time-slider:

import xarray as xr
import hvplot.xarray

ds = xr.open_dataset(fn_netcdf)
plot = ds.rainfall_amount.hvplot.quadmesh(
    x='longitudes', 
    y='latitudes',
    frame_width=500, 
    rasterize=True,
    tiles='ESRI', 
    project=True, 
    geo=True, 
    clim=(0.1, 2), 
    cmap='rainbow', 
    clabel='rainfall amount (mm)')

plot.opts('Image', clipping_colors={'min': 'transparent', 'NaN': 'gray'}, alpha=0.5, toolbar='above')

RADOLAN-RY map animation

Credits

About

Python package to convert RADOLAN binary files to NetCDF

Resources

License

Packages

No packages published