#!/usr/bin/env python3 import netCDF4 as nc4 import matplotlib.pyplot as plt import numpy as np import sys import os from mpl_toolkits.axes_grid1.inset_locator import inset_axes filename = "ECA_J_CPR_ECO_2AS_20250313T0150_20250313T0201_04483C_vBa.h5" if(len(sys.argv) <= 1): exit() filename = sys.argv[1] filename_basename = os.path.basename(filename) name = os.path.splitext(os.path.basename(filename))[0] pngfile = name + "_PRE.png" ncdata = nc4.Dataset(filename,"r", format="NETCDF4") #print(ncdata.groups) scdata = ncdata.groups["ScienceData"] geodata = scdata.groups["Geo"] ecodata = scdata.groups["Data"] nray2 = ecodata.dimensions["phony_dim_3"].size nbin2 = ecodata.dimensions["phony_dim_4"].size #snr_one_km = ecodata["signal_to_noise_ratio_1km"][:,:] #snr_ten_km = ecodata["signal_to_noise_ratio_10km"][:,:] zm_one_km = ecodata["integrated_radar_reflectivity_1km"][:,:] zm_ten_km = ecodata["integrated_radar_reflectivity_10km"][:,:] vd_one_km = ecodata["integrated_doppler_velocity_1km"][:,:] vd_ten_km = ecodata["integrated_doppler_velocity_10km"][:,:] wd_one_km = ecodata["spectrum_width_1km"][:,:] wd_ten_km = ecodata["spectrum_width_10km"][:,:] binRealSurface_one_km = ecodata["surface_bin_number_1km"][:] binRealSurface_ten_km = ecodata["surface_bin_number_10km"][:] fig = plt.figure(figsize=(16,9)) ax1 = fig.add_subplot(6,1,1) ax2 = fig.add_subplot(6,1,2) ax3 = fig.add_subplot(6,1,3) ax4 = fig.add_subplot(6,1,4) ax5 = fig.add_subplot(6,1,5) ax6 = fig.add_subplot(6,1,6) label_one_km = "$Z_m$(1km) [dBZ]" label_ten_km = "$Z_m$(10km) [dBZ]" #ax1.set_facecolor('lightgray') #cmap1 = plt.cm.rainbow cmap1 = plt.cm.get_cmap("rainbow").copy() #cmap1 = plt.colormaps.get_cmap("rainbow").copy() cmap1.set_under("lightgray") cmap2 = cmap1 #cmap3 = plt.cm.bwr cmap3 = plt.cm.get_cmap("bwr").copy() #cmap3 = plt.colormaps.get_cmap("bwr").copy() cmap3.set_under("lightgray") cmap4 = cmap3 #cmap5 = plt.cm.rainbow cmap5 = plt.cm.get_cmap("rainbow").copy() #cmap5 = plt.colormaps.get_cmap("rainbow").copy() cmap5.set_under("lightgray") cmap6 = cmap5 im1=ax1.imshow(zm_one_km[:,:].T, aspect=2.0, cmap=cmap1,vmin=-40,vmax=20) ax1.set_ylabel("Range #") ax1.set_title(filename_basename, fontsize=10) axins1 = inset_axes(ax1, width="20%", # width = 50% of parent_bbox width height="10%", # height : 5% loc='upper right') fig.colorbar(im1,cax=axins1, orientation="horizontal").set_label(label_one_km,size=8) im2=ax2.imshow(zm_ten_km[:].T, aspect=2.0, cmap=cmap2,vmin=-40,vmax=20) ax2.set_ylabel("Range #") axins2 = inset_axes(ax2, width="20%", # width = 50% of parent_bbox width height="10%", # height : 5% loc='upper right') fig.colorbar(im2,cax=axins2, orientation="horizontal").set_label(label_ten_km,size=8) im3=ax3.imshow(vd_one_km[:].T, aspect=2.0, cmap=cmap3,vmin=-6,vmax=6) ax3.set_ylabel("Range #") axins3 = inset_axes(ax3,width="20%",height="10%",loc='upper right') fig.colorbar(im3,cax=axins3, orientation="horizontal").set_label("vd(1km) [m/s]",size=8) im4=ax4.imshow(vd_ten_km[:].T, aspect=2.0, cmap=cmap4,vmin=-6,vmax=6) ax4.set_ylabel("Range #") axins4 = inset_axes(ax4,width="20%",height="10%",loc='upper right') fig.colorbar(im4,cax=axins4, orientation="horizontal").set_label("vd(10km) [m/s]",size=8) im5=ax5.imshow(wd_one_km[:].T, aspect=2.0, cmap=cmap5,vmin=0,vmax=5) ax5.set_ylabel("Range #") axins5 = inset_axes(ax5,width="20%",height="10%",loc='upper right') fig.colorbar(im5,cax=axins5, orientation="horizontal").set_label("wd(1km) [m/s]",size=8) im6=ax6.imshow(wd_ten_km[:].T, aspect=2.0, cmap=cmap6,vmin=0,vmax=5) ax6.set_ylabel("Range #") axins6 = inset_axes(ax6,width="20%",height="10%",loc='upper right') fig.colorbar(im6,cax=axins6, orientation="horizontal").set_label("wd(10km) [m/s]",size=8) plt.savefig(pngfile)