Exemplo n.º 1
0
 def get_precip_rate(self, ice_flag=False, rain_method='hidro'):
     """Calculate rain rate, add to radar object."""
     dz = self.radar.fields[self.name_dz]['data']
     dr = self.radar.fields[self.name_dr]['data']
     kd = self.radar.fields[self.name_kd]['data']
     if not self.winter_flag:
         if rain_method == 'hidro':
             fhc = self.radar.fields[self.name_fhc]['data']
             rain, method = csu_blended_rain.csu_hidro_rain(dz=dz, zdr=dr,
                                                            kdp=kd, fhc=fhc)
         else:
             if not ice_flag:
                 rain, method = csu_blended_rain.calc_blended_rain(
                     dz=dz, zdr=dr, kdp=kd)
             else:
                 rain, method, zdp, fi = csu_blended_rain.calc_blended_rain(
                     dz=dz, zdr=dr, kdp=kd, ice_flag=ice_flag)
                 self.add_field_to_radar_object(
                     zdp, field_name='ZDP', units='dB',
                     long_name='Difference Reflectivity',
                     standard_name='Difference Reflectivity')
                 self.add_field_to_radar_object(
                     fi, field_name='FI', units='',
                     long_name='Ice Fraction', standard_name='Ice Fraction')
     else:
         print('Winter precip not enabled yet, sorry!')
         return
     self.add_field_to_radar_object(rain, field_name='rain', units='mm h-1',
                                    long_name='Rainfall Rate',
                                    standard_name='Rainfall Rate')
     self.add_field_to_radar_object(method, field_name='method', units='',
                                    long_name='Rainfall Method',
                                    standard_name='Rainfall Method')
Exemplo n.º 2
0
 def get_precip_rate(
         self, ice_flag=False, rain_method='hidro', thresh_zdr=0.5,
         thresh_dz=DEFAULT_DZ_THRESH, thresh_kd=DEFAULT_KD_THRESH):
     """Calculate rain rate, add to radar object."""
     dz = self.radar.fields[self.name_dz]['data']
     dr = self.radar.fields[self.name_dr]['data']
     kd = self.radar.fields[self.name_kd]['data']
     if not self.winter_flag:
         if rain_method == 'hidro':
             fhc = self.radar.fields[self.name_fhc]['data']
             rain, method = csu_blended_rain.csu_hidro_rain(
                 dz=dz, zdr=dr, kdp=kd, fhc=fhc, band=self.band,
                 thresh_dz=thresh_dz, thresh_kdp=thresh_kd,
                 thresh_zdr=thresh_zdr, r_z_a=self.r_z_a, r_z_b=self.r_z_b,
                 r_kdp_a=self.r_kdp_a, r_kdp_b=self.r_kdp_b,
                 r_z_zdr_a=self.r_z_zdr_a, r_z_zdr_b=self.r_z_zdr_b,
                 r_z_zdr_c=self.r_z_zdr_c, r_kdp_zdr_a=self.r_kdp_zdr_a,
                 r_kdp_zdr_b=self.r_kdp_zdr_b, r_kdp_zdr_c=self.r_kdp_zdr_c)
         else:
             if not ice_flag:
                 rain, method = csu_blended_rain.calc_blended_rain(
                     dz=dz, zdr=dr, kdp=kd, band=self.band,
                     thresh_dz=thresh_dz, thresh_kdp=thresh_kd,
                     thresh_zdr=thresh_zdr, r_z_a=self.r_z_a,
                     r_z_b=self.r_z_b, r_kdp_a=self.r_kdp_a,
                     r_kdp_b=self.r_kdp_b, r_z_zdr_a=self.r_z_zdr_a,
                     r_z_zdr_b=self.r_z_zdr_b, r_z_zdr_c=self.r_z_zdr_c,
                     r_kdp_zdr_a=self.r_kdp_zdr_a,
                     r_kdp_zdr_b=self.r_kdp_zdr_b,
                     r_kdp_zdr_c=self.r_kdp_zdr_c)
             else:
                 rain, method, zdp, fi = csu_blended_rain.calc_blended_rain(
                     dz=dz, zdr=dr, kdp=kd, ice_flag=ice_flag,
                     band=self.band, thresh_dz=thresh_dz,
                     thresh_kdp=thresh_kd, thresh_zdr=thresh_zdr,
                     r_z_a=self.r_z_a, r_z_b=self.r_z_b,
                     r_kdp_a=self.r_kdp_a, r_kdp_b=self.r_kdp_b,
                     r_z_zdr_a=self.r_z_zdr_a,
                     r_z_zdr_b=self.r_z_zdr_b, r_z_zdr_c=self.r_z_zdr_c,
                     r_kdp_zdr_a=self.r_kdp_zdr_a,
                     r_kdp_zdr_b=self.r_kdp_zdr_b,
                     r_kdp_zdr_c=self.r_kdp_zdr_c)
                 self.add_field_to_radar_object(
                     zdp, field_name='ZDP', units='dB',
                     long_name='Difference Reflectivity',
                     standard_name='Difference Reflectivity')
                 self.add_field_to_radar_object(
                     fi, field_name='FI', units='',
                     long_name='Ice Fraction', standard_name='Ice Fraction')
     else:
         print('Winter precip not enabled yet, sorry!')
         return
     self.add_field_to_radar_object(rain, field_name='rain', units='mm h-1',
                                    long_name='Rainfall Rate',
                                    standard_name='Rainfall Rate')
     self.add_field_to_radar_object(method, field_name='method', units='',
                                    long_name='Rainfall Method',
                                    standard_name='Rainfall Method')
Exemplo n.º 3
0
def calculate_hidro_rain(radar,
                         sounding,
                         rain_field_dict=dict(field_name='rain',
                                              units='mm h-1',
                                              long_name='HIDRO Rainfall Rate',
                                              standard_name='rain_hca'),
                         method_field_dict=dict(
                             field_name='method',
                             units='',
                             long_name='HIDRO Rainfall Method',
                             standard_name='rain_estimate_method')):
    '''
    Calculate rainfall using the hidro_rain, method

    Parameters
    ----------
    radar: pyart radar object from nexrad volume scan
    sounding: SkewT sounding for the appropriate time and location

    Returns
    -------
    radar: with new rain field added according to dict
    '''
    from csu_radartools import csu_fhc, csu_blended_rain
    dz = extract_unmasked_data(radar, 'reflectivity')
    dr = extract_unmasked_data(radar, 'differential_reflectivity')
    dp = extract_unmasked_data(radar, 'differential_phase')
    rh = extract_unmasked_data(radar, 'cross_correlation_ratio')

    radar_T, radar_z = interpolate_sounding_to_radar(sounding, radar)
    if 'kdp' not in radar.fields.keys():
        radar = get_kdp(radar)
    kd = extract_unmasked_data(radar, 'kdp')
    scores = csu_fhc.csu_fhc_summer(dz=dz,
                                    zdr=dr,
                                    rho=rh,
                                    kdp=kd,
                                    band='S',
                                    use_temp=True,
                                    T=radar_T)
    fh = np.argmax(scores, axis=0) + 1

    rain, method = csu_blended_rain.csu_hidro_rain(dz=dz,
                                                   zdr=dr,
                                                   kdp=kd,
                                                   fhc=fh)
    radar = add_field_to_radar_object(rain, radar, **rain_field_dict)
    radar = add_field_to_radar_object(method, radar, **method_field_dict)
    return radar
Exemplo n.º 4
0
                                        var2='ZD',
                                        vmin2=0,
                                        vmax2=10,
                                        cmap2=cmaphid,
                                        units2='',
                                        return_flag=True,
                                        xlim=lim,
                                        ylim=lim)
display.cbs[1] = adjust_fhc_colorbar_for_pyart(display.cbs[1])

plt.show()

# ---------------------------------------------------
# test of rainfall estimation
# ---------------------------------------------------
rain, method = csu_blended_rain.csu_hidro_rain(dz=dz, zdr=dr, kdp=kd, fhc=fh)
radar = add_field_to_radar_object(rain,
                                  radar,
                                  field_name='rain',
                                  units='mm h-1',
                                  long_name='HIDRO Rainfall Rate',
                                  standard_name='Rainfall Rate')
radar = add_field_to_radar_object(method,
                                  radar,
                                  field_name='method',
                                  units='',
                                  long_name='HIDRO Rainfall Method',
                                  standard_name='Rainfall Method')

lim = [-80, 80]
fig, ax1, ax2, display = two_panel_plot(radar,