Esempio n. 1
0
                                   mydirection, target)
    myradar.fields.update({'corrected_mean_doppler_velocity': my_new_field})
    interp_sonde.close()

    # process phase
    gates = myradar.range['data'][1] - myradar.range['data'][0]
    rge = 10.0 * 1000.0
    ng = rge / gates
    mydatetime = netCDF4.num2date(
        myradar.time['data'][0], myradar.time['units'],
        calendar=myradar.time['calendar'])  # append a datetime object
    mydict = dt_to_dict(mydatetime)
    mydict.update({'scanmode': {'ppi': 'sur', 'rhi': 'rhi'}
                  [myradar.sweep_mode[0]], 'fac': fac})
    ofilename = outdir + '%(scanmode)scmac%(fac)s.c0.%(year)04d%(month)02d%(day)02d.%(hour)02d%(minute)02d%(second)02d.nc' % mydict
    reproc_phase, sob_kdp = phase_proc.phase_proc(myradar, offset, debug=True,
                                                  nowrap)
    myradar.fields.update({'recalculated_diff_phase': sob_kdp,
                           'proc_dp_phase_shift': reproc_phase})

    # attenuation correction
    spec_at, cor_z = attenuation.calculate_attenuation(
        myradar, offset, debug=True, a_coef=0.17)
    myradar.fields.update({'specific_attenuation': spec_at})
    myradar.fields.update({'corrected_reflectivity_horizontal': cor_z})
    R = 51.3 * (myradar.fields['specific_attenuation']['data']) ** 0.81
    rainrate = copy.deepcopy(myradar.fields['diff_phase'])
    rainrate['data'] = R
    rainrate['valid_min'] = 0.0
    rainrate['valid_max'] = 400.0
    rainrate['standard_name'] = 'rainfall_rate'
    rainrate['long_name'] = 'rainfall_rate'
    interp_sonde.close()

    # process Phase
    gates = myradar.range['data'][1] - myradar.range['data'][0]
    rge = 10.0 * 1000.0
    ng = rge / gates
    # append a datetime object
    mydatetime = netCDF4.num2date(myradar.time['data'][0],
                                  myradar.time['units'],
                                  calendar=myradar.time['calendar'])
    mydict = dt_to_dict(mydatetime)
    mydict.update({'scanmode': {'ppi': 'sur', 'rhi': 'rhi'}
                  [myradar.sweep_mode[0]], 'fac': metadata['facility']})
    ofilename = outdir + '%(scanmode)scmac%(fac)s.c0.%(year)04d%(month)02d%(day)02d.%(hour)02d%(minute)02d%(second)02d.nc' % mydict
    reproc_phase, sob_kdp = phase_proc.phase_proc(
        myradar, params['reflectivity_offset'], sys_phase=params['sys_phase'],
        overide_sys_phase=params['overide_sys_phase'], debug=True, nowrap=ng)
    myradar.fields.update({'recalculated_diff_phase': sob_kdp,
                          'proc_dp_phase_shift': reproc_phase})

    #attenuation correction
    spec_at, cor_z = attenuation.calculate_attenuation(
        myradar, params['reflectivity_offset'], debug=True, a_coef=0.17)
    myradar.fields.update({'specific_attenuation': spec_at})
    myradar.fields.update({'corrected_reflectivity_horizontal': cor_z})
    R = 51.3 * (myradar.fields['specific_attenuation']['data']) ** 0.81
    rainrate = copy.deepcopy(myradar.fields['diff_phase'])
    rainrate['data'] = R
    rainrate['valid_min'] = 0.0
    rainrate['valid_max'] = 400.0
    rainrate['standard_name'] = 'rainfall_rate'
Esempio n. 3
0
    outdir = sys.argv[2]

    # open the radar file
    my_mdv_object = py_mdv.read_mdv(filename, debug=True)
    myradar = radar.Radar(my_mdv_object)

    gates = myradar.range['data'][1] - myradar.range['data'][0]
    rge = 10.0 * 1000.0
    ng = rge / gates
    #append a datetime object
    mydatetime = netCDF4.num2date(myradar.time['data'][0],
                                  myradar.time['units'],
                                  calendar=myradar.time['calendar'])
    mydict = dt_to_dict(mydatetime)
    mydict.update({'scanmode': {'ppi': 'sur', 'rhi': 'rhi'}
                   [myradar.sweep_mode[0]]})

    ofilename = outdir + '%(scanmode)scmacI7.c0.%(year)04d%(month)02d%(day)02d.%(hour)02d%(minute)02d%(second)02d.nc' % mydict

    reproc_phase, sob_kdp = phase_proc.phase_proc(myradar, -2.0, debug=True, 
                                                  nowrap=ng)
    myradar.fields.update({'recalculated_diff_phase': sob_kdp,
                           'proc_dp_phase_shift': reproc_phase})
    spec_at, cor_z = attenuation.calculate_attenuation(
        myradar, -2.0, debug=True)
    myradar.fields.update({'specific_attenuation': spec_at})
    myradar.fields.update({'corrected_reflectivity_horizontal': cor_z})
    netcdf_obj = netCDF4.Dataset(ofilename, 'w', format='NETCDF4')
    nc_utils.write_radar4(netcdf_obj, myradar)
    netcdf_obj.close()