# How can I able to access RADOLAN binary data for specific region for example Lübeck

**URL:** <https://openradar.discourse.group/t/how-can-i-able-to-access-radolan-binary-data-for-specific-region-for-example-lubeck/248>\
**Category:** General\
**Created:** [June 6, 2023, 3:05pm UTC](https://openradar.discourse.group/t/how-can-i-able-to-access-radolan-binary-data-for-specific-region-for-example-lubeck/248 "2023-06-06T15:05:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahidh](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@shahidh](https://openradar.discourse.group/u/shahidh)\
**Post date:** [June 6, 2023, 3:05pm UTC](https://openradar.discourse.group/t/how-can-i-able-to-access-radolan-binary-data-for-specific-region-for-example-lubeck/248/1 "2023-06-06T15:05:35Z")

</div>

![radolan_sample_plot_2007](https://global.discourse-cdn.com/free1/uploads/openradar/original/1X/c3269680a44b248a87beaf725207deaaf713854b.jpeg)  
 ![Region_Luebeck](https://global.discourse-cdn.com/free1/uploads/openradar/original/1X/7aee68c6a760554fbe30a04117675dc1a070f590.jpeg)

I can be able to add Wradlib environment, Data that I am using is from DWD which refers to Germany. data type is Radolan binary data. I can able to read the data and able to plot it using Matplotlib.  
I am attaching the graph and also shapefile of my region just for an overview. How can I extract data for specific region and also can I be able to look into the values with in the grids?

the code that I used to plot this is,

import glob  
import os  
import wradlib as wrl  
import warnings

warnings.filterwarnings(“ignore”)  
import matplotlib.pyplot as pl  
import numpy as np  
import xarray as xr  
from mpl\_toolkits import mplot3d

import time  
import os  
from os import listdir  
from os.path import isfile, join  
mypath = os.getcwd()  
mypath = mypath + ‘\combine\_test’  
print(mypath)  
os.environ[“WRADLIB\_DATA”] = mypath  
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]  
onlyfiles.pop(0)  
onlyfiles.pop(0)

def plot\_radolan(data, attrs, grid, clabel=None):  
fig = pl.figure(figsize=(10,8))  
ax = fig.add\_subplot(111, aspect=‘equal’)  
x = grid[:,:,0]  
y = grid[:,:,1]  
pm = ax.pcolormesh(x, y, data, cmap=‘viridis’)  
cb = fig.colorbar(pm, shrink=0.75)  
cb.set\_label(clabel)  
pl.xlabel(“x [km]”)  
pl.ylabel(“y [km]”)  
pl.title(‘{0} Product\n{1}’.format(attrs[‘producttype’],  
attrs[‘datetime’].isoformat()))  
pl.xlim((x[0,0],x[-1,-1]))  
pl.ylim((y[0,0],y[-1,-1]))  
pl.grid(color=‘r’)  
radolan\_grid\_xy = wrl.georef.get\_radolan\_grid(900,900)  
radolan\_egrid\_xy = wrl.georef.get\_radolan\_grid(1500,1400)  
radolan\_wgrid\_xy = wrl.georef.get\_radolan\_grid(1100, 900)  
x = radolan\_grid\_xy[:,:,0]  
y = radolan\_grid\_xy[:,:,1]

xe = radolan\_egrid\_xy[:,:,0]  
ye = radolan\_egrid\_xy[:,:,1]

xw = radolan\_wgrid\_xy[:,:,0]  
yw = radolan\_wgrid\_xy[:,:,1]

fpath = “raa01-rw\_10000-0701010050-dwd—bin.gz”  
f = wrl.util.get\_wradlib\_data\_file(fpath)  
img,meta = wrl.io.read\_radolan\_composite(f)  
#print(onlyfiles)

flist = [wrl.util.get\_wradlib\_data\_file(f) for f in onlyfiles]

comp3 = wrl.io.open\_radolan\_mfdataset(flist)

# comp3.RW.plot(col=‘time’)

latitude = 54.307857

# Replace with the desired latitude value

longitude = 10.117256 # Replace with the desired longitude value

# radolan\_location = wrl.georef.get\_radolan\_location()

x, y = wrl.georef.reproject(latitude, longitude,  
projection\_source=wrl.georef.epsg\_to\_osr(4326), # EPSG 4326 is WGS84  
projection\_target=wrl.georef.create\_osr(“dwd-radolan”))

# Find the nearest grid point in the Radolan data

# x, y = wrl.util.find\_nearest(polar\_coords[…, 0], polar\_coords[…, 1], radolan\_coords[…, 0], radolan\_coords[…, 1])

x = int(np.round(x))  
y = int(np.round(y))  
x = max(0, min(x, img.shape[1] - 1))  
y = max(0, min(y, img.shape[0] - 1))  
data = np.ma.masked\_equal(img, -9999)

# Extract the Radolan data value at the specific location

radolan\_value = img[y, x]  
plot\_radolan(data, meta, radolan\_grid\_xy, clabel=‘mm \* h-1’)

---

<div class="post-metadata">

**Author:** ![jorahu](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/jorahu/32/19_2.png) [@jorahu](https://openradar.discourse.group/u/jorahu)\
**Post date:** [June 8, 2023, 6:22am UTC](https://openradar.discourse.group/t/how-can-i-able-to-access-radolan-binary-data-for-specific-region-for-example-lubeck/248/2 "2023-06-08T06:22:30Z")

</div>

Hey

Sorry, can’t give you any working code, but you could begin by searching for “Zonal Statistics” in wradlib or look at this tutorial: [Zonal Statistics - Quickstart — wradlib](https://docs.wradlib.org/en/latest/notebooks/zonalstats/wradlib_zonalstats_quickstart.html)  
Seems to be the thing you want to achieve.

---

<div class="post-metadata">

**Author:** ![shahidh](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@shahidh](https://openradar.discourse.group/u/shahidh)\
**Post date:** [June 8, 2023, 10:05am UTC](https://openradar.discourse.group/t/how-can-i-able-to-access-radolan-binary-data-for-specific-region-for-example-lubeck/248/3 "2023-06-08T10:05:02Z")

</div>

Hello Jorahu,  
Thank you very much for your reply. I know how to use zonal statistics in QGIS software but never tried it in python will try that.

Best Regards,  
shahidh

---

<div class="post-metadata">

**Author:** ![SandeepAllampalli](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/sandeepallampalli/32/17_2.png) [@SandeepAllampalli](https://openradar.discourse.group/u/SandeepAllampalli)\
**Post date:** [June 11, 2023, 11:40am UTC](https://openradar.discourse.group/t/how-can-i-able-to-access-radolan-binary-data-for-specific-region-for-example-lubeck/248/4 "2023-06-11T11:40:53Z")

</div>

Hey Shahid,

Try to use shape file of Lübeck and clip it. You can get shape files for German states from here. [Verwaltungsgebiete (bund.de)](https://gdz.bkg.bund.de/index.php/default/digitale-geodaten/verwaltungsgebiete.html)

---

<div class="post-metadata">

**Author:** ![shahidh](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@shahidh](https://openradar.discourse.group/u/shahidh)\
**Post date:** [June 11, 2023, 12:41pm UTC](https://openradar.discourse.group/t/how-can-i-able-to-access-radolan-binary-data-for-specific-region-for-example-lubeck/248/5 "2023-06-11T12:41:08Z")

</div>

Thank you for your reply bro, I have already found the solution regarding this question.

Best regards,  
shahidh shaik
