Ejemplo n.º 1
0
    def get_VPROF(self):
        '''
        Simulates a 90° elevation profile based on the user configuration

        Returns:
            A vertical profile at 90° elevation, in the form of a PyART
            class
        '''
        # Check if model file has been loaded
        if self.dic_vars == {}:
            print('No model file has been loaded! Aborting...')
            return

        # Needs to be done in order to deal with Multiprocessing's annoying limitations
        global dic_vars, N, lut_sz, output_variables
        dic_vars, N, lut_sz, output_variables = self.define_globals()
        # Define list of angles that need to be resolved

        # Define  ranges
        rranges = constants.RANGE_RADAR

        # Initialize computing pool
        list_GH_pts = get_interpolated_radial(dic_vars, 0., 90., N=N)

        beam = get_radar_observables(list_GH_pts, lut_sz)

        # Threshold at given sensitivity
        beam = cut_at_sensitivity(beam, self.config['radar']['sensitivity'])

        if output_variables == 'all':
            beam = combine_subradials((beam, integrate_radials(list_GH_pts)))

        del dic_vars
        del N
        del lut_sz
        gc.collect()

        simulated_sweep = {
            'ranges': rranges,
            'pos_time': self.get_pos_and_time(),
            'data': beam
        }

        pyrad_instance = PyartRadop(simulated_sweep)
        return pyrad_instance
Ejemplo n.º 2
0
        def worker(event, elev, azimuth):  #
            print(azimuth)
            try:
                if not event.is_set():
                    list_subradials = get_interpolated_radial(
                        dic_vars, azimuth, elev, N)
                    if output_variables in ['all', 'only_radar']:
                        output = get_radar_observables(list_subradials, lut_sz)
                    if output_variables == 'only_model':
                        output = integrate_radials(list_subradials)
                    elif output_variables == 'all':
                        output = combine_subradials(
                            (output, integrate_radials(list_subradials)))

                    return output
            except:
                # Throw signal back
                raise
                event.set()
Ejemplo n.º 3
0
        def worker(event, params):
            try:
                if not event.is_set():
                    azimuth = params[0]
                    elev = params[1]
                    """ For some reason modifying self.config instead of
                    cfg.CONFIG throws in error about not being able to pickle
                    the pycosmo variables. This is indeed very weird and I
                    have not been able to figure out why...However since
                    self.config is just a shallow copy of cfg.CONFIG, it doesn't
                    really matter...
                    """

                    # Update GPM position and range vector
                    cfg.CONFIG['radar']['range'] = params[2]
                    cfg.CONFIG['radar']['coords'] = [
                        params[3], params[4], params[5]
                    ]

                    list_subradials = get_interpolated_radial(dic_vars,
                                                              azimuth,
                                                              elev,
                                                              N=N)

                    output = get_radar_observables(list_subradials, lut_sz)

                    if output_variables in ['all', 'only_radar']:
                        output = get_radar_observables(list_subradials, lut_sz)
                    if output_variables == 'only_model':
                        output = integrate_radials(list_subradials)
                    elif output_variables == 'all':
                        output = combine_subradials(
                            (output, integrate_radials(list_subradials)))

                    return output
            except:
                # Throw signal back
                raise
                event.set()