[PYTHON] Convert GRIB of Japan Meteorological Agency radar polar coordinates GPV to netCDF (CF / Radial standard)

TL;DR

The conversion program is placed on GitHub, so please do so at your own risk. Please refer to this article for the conversion of dual polarization weather radar polar coordinate data.

Introduction

You may want to use the Japan Meteorological Agency (JMA) radar data when investigating precipitation phenomena. Normally, 1km mesh national synthetic radar echo intensity GPV and [analyzed rainfall](https://www. You will often use spatial two-dimensional data of precipitation created by processing information from multiple radars such as data.jma.go.jp/add/suishin/shiyou/pdf/no11601)). However, when doing elaborate things such as investigating the three-dimensional spatial distribution of precipitation, the reflection intensity is stored in the polar coordinate grid for each elevation angle centered on the radar [Radar polar coordinate data](https://www.data. It is necessary to handle jma.go.jp/add/suishin/shiyou/pdf/no13702).

This data is stored in GRIB2 format like the data of other Japan Meteorological Agency, and it is characterized by using JMA's original template such as template 3.50120 and 4.51022 ([Specification No.13702 regarding distribution materials]( See https://www.data.jma.go.jp/add/suishin/shiyou/pdf/no13702). Therefore, read and draw as it is with drawing software such as NCL or GrADS. You can not.

One way to draw is to use the sample program in NICT Japan Meteorological Agency Polar Coordination Radar Data Download Site. For this sample program, I used a patch and patched wgrib2 that made it possible to read JMA's own template at wgrib2. Includes a C program that converts the converted plain binary to Cartesian coordinates centered on the radar site, and a GrADS script that draws the converted data.

On the other hand, recently, radar data in Python such as PyART and wradlib Analysis tools have been enhanced. Of course, these tools should not read the GRIB of their own template, but convert the data to NetCDF format etc. of the CF / Radial convention and read it. I need to let you. It seems that no one has published such a conversion program, so I created it.

What are CF / Radial Terms

Before explaining the CF / Radial Terms, you need to know about the CF Terms. Regarding the CF rules, the explanation of Toyota's NetCDF CF rules Japanese translation site I will quote it because it is concise.

NetCDF defines the framework of the data format (just like XML). You can give a dataset a name-value pair called an attribute, but you can write any information according to your agreement, so you need to promise how to use it, which is called the NetCDF convention. I will. This is a Japanese translation of the CF Convention, which is becoming the de facto standard in the convention.

As you can see from the official name of the CF / Radial convention being "CF-compliant netCDF Format for Moments Data for RADAR and LIDAR in Radial Coordinates", the CF convention was not fully supported, so that it is expressed in polar coordinates. It is a convention that expresses the observation data of various radars and riders.

There are two types of CF / Radial conventions, version 1.x series (CfRadial1) and 2.x series (CfRadial2). CfRadial1 is based on NetCDF's classic data model. The first version 1.1 was developed in 2011, and the latest version 1.4 version 1.4 was developed in 2016. It will be a version. On the other hand, CfRadial2 uses NetCDF4 and group, and is not backward compatible with CfRadial1. The current latest version of Version 2.0 was formulated in 2017 and will be partly in 2019. Updates have been added. Also, the draft stage Version 2.1 will be released in 2019.

Since CfRadial2 was recently created, it seems that the support status differs depending on the tool. Regarding PyART, Issue Reading CF / Radial 2.0 Files # 858 As far as I read 858), there seems to be some problems with CfRadial2 in the official version, and it seems that volunteers and compatible readers have been created. For wradlib, as far as you can see wradlib.io.xarray.CfRadial , It seems to be compatible with CfRadial2. (Neither was actually confirmed)

Creating a converter

Basically, all you have to do is read Specifications related to distribution materials No.13702 and write the code to convert. This time, since there are many environments that can be used and the structure is simple, it is converted to CF / Radial Version 1.4. I decided to do it. I used Python's netCDF4 package to create NetCDF. Here are some points.

--GRIB's Section 1 (Identification Section), Section 3 (Lattice System Definition Section), and Section 4 (Product Definition Section) read the binary with Python. For the run-length compressed data in Section 5 (Material Expression Section) and Section 7 (Material Section), it is troublesome to write code to decompress with Python, so convert it to plain binary with wgrib2 and read it. is. Since the output to plain binary is not related to JMA original template, normal wgrib2 does not cause an error. Of course, if you are concerned about the dependence on external programs, you can also write run-length decompression in Python.

-As you can see from section 2.3 of CfRadial Data File Format, the data storage method is Regular. There are two types: 2-D storage and Staggered 2-D storage. The former is the case where the number of bins in the range direction is constant regardless of time, and variables such as reflection intensity are stored as a two-dimensional array of range and time. The latter is the case where the number of bins in the range direction is variable with time, variables such as reflection intensity are stored in a one-dimensional array, and the number and position of bins in the range direction at each time are stored in ray_n_gates and ray_start_index. In the case of polar coordinate data for each radar, the number of bins in the range direction is variable depending on the elevation angle, so I decided to use Staggered 2-D storage at first. However, the output netCDF could not be read well by PyART, so I made it Regular 2-D storage and filled in the part with no value with _FillValue.

--The Japan Meteorological Agency's radar has been updated sequentially since 2020, and at the time of writing, Tokyo Radar has been updated it was done. The highlight of this update is double polarization, but a hidden improvement is that the volume scan (three-dimensional scanning at all elevations from top to bottom) takes 10 to 5 minutes. Can be done. Since GRIB2 data continues to be one in 10 minutes, one file will contain two volume scans. If you read the CF / Radial convention, it looks like one volume per file (I'm not sure if it's true), so you may want to generate two netCDFs from one GRIB. Therefore, I made it possible to cut out by specifying the number of the data stored in GRIB (corresponding to the elevation angle).

Place the created conversion program on GitHub under the MIT license.

Drawing of converted data

Although it is out of the main subject, if you draw a diagram of the output data with PyART, it will look like this. It is convenient to be able to draw a minimum figure with 4 lines.

draw.py


import matplotlib.pyplot as plt
import pyart

radar = pyart.io.read_cfradial('./work/RS47695.nc')
display = pyart.graph.RadarDisplay(radar)
display.plot('DBZ', sweep=29)
plt.show()

RS47695_29.png

Acknowledgments

--Kazuya Yamazaki (Graduate School of Science, The University of Tokyo) referred to how to read GRIB in Python. --Mr. Shuhei Matsugishi (Atmosphere and Ocean Research Institute, University of Tokyo) provided us with information on the Python radar analysis package. --The Japan Meteorological Agency radar polar coordinates GPV was acquired via the Meteorological Agency Support Center.

Recommended Posts

Convert GRIB of Japan Meteorological Agency radar polar coordinates GPV to netCDF (CF / Radial standard)
Convert GRIB of Japan Meteorological Agency radar polar coordinates GPV to netCDF (CF / Radial standard)
Download the wind data of the Japan Meteorological Agency
Read the GRIB2 file of the Japan Meteorological Agency with pygrib
Download the wind data of the Japan Meteorological Agency