wm-ytakano / jmardr_cfradial

気象庁レーダー毎極座標 GPV の GRIB を netCDF (CF/Radial 規約) に変換する
MIT License
2 stars 0 forks source link

list index out of range #3

Open yhp92 opened 10 months ago

yhp92 commented 10 months ago

Hi Mr. Takano,

Thank you for building this tool. grib2.bin file is one of my headaches so I try to use your program.

But I met this issue, do you know how to fix that? Thanks!

`(env_cfgrib) ➜ jmardr_cfradial git:(main) ✗ sh convert_nc.sh ../ZC_RJTD_20231028211000_RDR_JMAGPV_N5_grib2.tar x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47582_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47415_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x Z__C_RJTD_20231028211000_RDR_JMAGPV_RS47920_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47659_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47611_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x Z__C_RJTD_20231028211000_RDR_JMAGPV_RS47432_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47909_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47869_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x Z__C_RJTD_20231028211000_RDR_JMAGPV_RS47899_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47937_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47419_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x Z__C_RJTD_20231028211000_RDR_JMAGPV_RS47791_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47705_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47806_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x Z__C_RJTD_20231028211000_RDR_JMAGPV_RS47792_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47773_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47636_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x Z__C_RJTD_20231028211000_RDR_JMAGPV_RS47590_Gar0p5km0p7deg_Pze_ANAL_grib2.bin x ZC_RJTD_20231028211000_RDR_JMAGPV_RS47695_Gar0p5km0p7deg_Pze_ANAL_grib2.bin Traceback (most recent call last): File "/Users/a/Documents/japan_hail_radar_data/jp_hail_test/jmardr_cfradial/../jmardr_cfradial/marge_netcdf_v1.py", line 124, in main() File "/Users/a/Documents/japan_hail_radar_data/jp_hail_test/jmardr_cfradial/../jmardr_cfradial/marge_netcdf_v1.py", line 18, in main converter.convert(args) File "/Users/a/Documents/japan_hail_radar_data/jp_hail_test/jmardr_cfradial/../jmardr_cfradial/marge_netcdf_v1.py", line 24, in convert self.create_output() File "/Users/a/Documents/japan_hail_radar_data/jp_hail_test/jmardr_cfradial/../jmardr_cfradial/marge_netcdf_v1.py", line 27, in create_output self.create_base() File "/Users/a/Documents/japan_hail_radar_data/jp_hail_test/jmardr_cfradial/../jmardr_cfradial/marge_netcdf_v1.py", line 34, in create_base infile = self.files[0]


IndexError: list index out of range`
wm-ytakano commented 10 months ago

Thank you for reaching out and using the tool. I apologize for the confusion you've encountered. The convert_nc.sh script you mentioned was actually designed for data in a different format than the file you're working with.

For converting a GRIB file to a netCDF file, please use the following command instead:

in_grib=Z__C_RJTD_20231028211000_RDR_JMAGPV_RS47582_Gar0p5km0p7deg_Pze_ANAL_grib2.bin
out_nc=Z__C_RJTD_20231028211000_RDR_JMAGPV_RS47582_Gar0p5km0p7deg_Pze_ANAL.nc
python convert_1hempa.py ${in_grib} ${out_nc}

I hope this helps.

yhp92 commented 10 months ago

Hi Mr. Takano,

Thank you for your prompt response! That works and I can finally see some information in those grib2 files.

image

However, do you by any chance know how I can convert this to a PPI format? I would like to visualize it through Py-ART, https://arm-doe.github.io/pyart/.

Thank you for your knowledge!

wm-ytakano commented 10 months ago

I'm glad to hear that the previous solution worked for you!

Regarding your question about converting to a PPI format and visualizing it with Py-ART, here's a sample code snippet that should help you get started:

import matplotlib.pyplot as plt
import pyart

radar = pyart.io.read_cfradial(
    "./Z__C_RJTD_20240116160000_RDR_JMAGPV_RS47582_Gar0p5km0p7deg_Pze_ANAL.nc"
)
display = pyart.graph.RadarDisplay(radar)
display.plot("DBZ", sweep=1)
plt.savefig("image.png")

For more detailed information or specific use cases of Py-ART, I recommend reaching out in the Py-ART community or their dedicated forums.