# Wradlib zonalstats with dataset with rotated WGS84 CRS

**URL:** <https://openradar.discourse.group/t/wradlib-zonalstats-with-dataset-with-rotated-wgs84-crs/542>\
**Category:** Python\
**Tags:** wradlib\
**Created:** [December 4, 2024, 4:10pm UTC](https://openradar.discourse.group/t/wradlib-zonalstats-with-dataset-with-rotated-wgs84-crs/542 "2024-12-04T16:10:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![plvoit](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/plvoit/32/62_2.png) [@plvoit](https://openradar.discourse.group/u/plvoit)\
**Post date:** [December 4, 2024, 4:10pm UTC](https://openradar.discourse.group/t/wradlib-zonalstats-with-dataset-with-rotated-wgs84-crs/542/1 "2024-12-04T16:10:36Z")

</div>

Hello,  
I usually use wradlib to extraxt precipitation from the RADKLIM and RADOLAN dataset (DWD). Now I want to do the same but with the output of a climate model, which has a rotated WGS84 as CRS. I am struggling to set it up. I was following my usual workflow based on this tutorial:  
[Recipe 5: Zonal Statistics - Cartesian Grid — wradlib](https://docs.wradlib.org/en/2.0.0/notebooks/workflow/recipe5.html), Approach 2, Zonal Stats - Rectangular Grid - Polygons, but somehow I cannot reproject the grid correctly with this: proj4\_string = “+proj=ob\_tran +o\_proj=latlon +o\_lat\_p=39.25 +o\_lon\_p=162.0”  
The Climate model has information about the latitude and longitude of the rotated pole. In the tutorial it says, that the grid can just be generated from native RADOLAN coordinates. However, in the function description of wradlib.zonalstats.grid\_centers\_to\_vertices it says that it should happen in “native” grid projection. So basically I am wondering, if I am using the right approach, and whether I can use wradlib.zonalstats.grid\_centers\_to\_vertices also for a grid that stems from rotated WGS84. Any suggestions how else I can solve the problem are welcome. I am using wradlib for the extraction of precipitation for polygons (subbasins) because the method there seems most accurate. Thank you!

---

<div class="post-metadata">

**Author:** ![kmuehlbauer](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/kmuehlbauer/32/439_2.png) [@kmuehlbauer](https://openradar.discourse.group/u/kmuehlbauer)\
**Post date:** [December 5, 2024, 9:54am UTC](https://openradar.discourse.group/t/wradlib-zonalstats-with-dataset-with-rotated-wgs84-crs/542/2 "2024-12-05T09:54:50Z")

</div>

Hi @plvoit,

in the tutorial the native RADOLAN coordinates are used, because `wradlib.zonalstats.grid_centers_to_vertices` only works for cartesian coordinates (1D x and y).

So I’m assuming that you can create the vertices in the rotated pole coordinates and afterwards project these vertice coordinates into your target projection.

Can be more specific on your climate model and the problems with reprojection?

Best,  
Kai

---

<div class="post-metadata">

**Author:** ![plvoit](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/plvoit/32/62_2.png) [@plvoit](https://openradar.discourse.group/u/plvoit)\
**Post date:** [December 5, 2024, 11:13am UTC](https://openradar.discourse.group/t/wradlib-zonalstats-with-dataset-with-rotated-wgs84-crs/542/3 "2024-12-05T11:13:09Z")

</div>

Dear @kmuehlbauer,  
thank you for your reply. This answers my question, I did it exactly as you said. The main problem and partly reason for my uncertainty was that the proj string in the metadata of my files was wrong, so the vertice coordinates were in the wrong location after reprojecting. After contacting the creators (DWD) they send me the correct proj4 string and now everything works as expected. Best, Paul

---

<div class="post-metadata">

**Author:** ![kmuehlbauer](https://yyz2.discourse-cdn.com/free1/user_avatar/openradar.discourse.group/kmuehlbauer/32/439_2.png) [@kmuehlbauer](https://openradar.discourse.group/u/kmuehlbauer)\
**Post date:** [December 5, 2024, 11:55am UTC](https://openradar.discourse.group/t/wradlib-zonalstats-with-dataset-with-rotated-wgs84-crs/542/4 "2024-12-05T11:55:12Z")

</div>

Hi @plvoit, thanks for the follow-up. Great it works for you now.
