예제 #1
0
def save_emission_data(emission_fields):
    """
    Save the data field(s) of to one or more given emission fields
    to their assigned file.

    Not yet implemented.

    """
    raise exceptions.NotYetImplementedError()
예제 #2
0
    def compute_emissions(self, time, grid):
        """
        Call here the Python-wrapped FORTRAN routine to calculate emissions
        at particular time(s) and with a given grid.

        Returns
        -------
        datafield object

        """
        raise exceptions.NotYetImplementedError()
예제 #3
0
def gen_time_slices(emission_field):
    """
    Generate the data field time slices of interest for an emission field.

    Parameters
    ----------
    emission_field : emission field object
        :class:`EmissionBase`, :class:`EmissionScale` or :class:`EmissionMask`
        objects. :prop:`timeslicer` is used to generate the time slices.

    Returns
    -------
    generator
        sub-data field time slices.

    Not yet implemented.

    """
    raise exceptions.NotYetImplementedError()
예제 #4
0
def load_emission_data(emission_fields, return_data=False):
    """
    Load the data field(s) corresponding to one or more given emission
    fields (base emission, scale factors and/or masks).

    Parameters
    ----------
    emission_fields : (sequence of) emission field object(s)
        load data fields for these emission fields (:class:`EmissionBase`,
        :class:`EmissionScale` or :class:`EmissionMask` objects).
    return_data : bool
        if True, it will return the loaded data fields, in addition to
        assign it to the corresponding emission fields (:prop:`datafield`).

    Notes
    -----
    The metadata and emission fields (:prop:`var_name` and :prop:`filename`)
    is used to load the data fields.

    """
    # TODO: make it work for any dataset backend
    raise exceptions.NotYetImplementedError()

    if isinstance(emission_fields, (EmissionBase, EmissionScale, EmissionMask)):
        emission_fields = [emission_fields]
    data_fields = []

    # TODO: load data fields at once for emission fields with the same filename
    for efield in emission_fields:
        constraint = datasets.Constraint(
            cube_func=lambda cube: efield.var_name == efield.var_name
        )
        if efield.filename is not None:
            dfield = datasets.load(efield.filename, constraint)
        else:
            dfield = None
        efield.datafield = dfield
        data_fields.append(dfield)

    if return_data:
        return data_fields