<commit_before>import numpy as np
from climlab.utils.thermo import blackbody_emission
from climlab.radiation.transmissivity import Transmissivity
from climlab.process.energy_budget import EnergyBudget


class Radiation(EnergyBudget):
    '''Base class for all band radiation models,
    including grey and semi-grey model.

    Input argument absorptivity is band absorptivity
    (should same size as grid).

    By default emissivity = absorptivity.
    Subclasses can override this is necessary (e.g. for shortwave model)'''
    def __init__(self, absorptivity=None, reflectivity=None,
                 albedo_sfc=0, **kwargs):
        super(Radiation, self).__init__(**kwargs)
        if reflectivity is None:
            reflectivity = np.zeros_like(self.Tatm)
        if absorptivity is None:
            absorptivity = np.zeros_like(self.Tatm)
        self.absorptivity = absorptivity
        self.reflectivity = reflectivity
        self.albedo_sfc = albedo_sfc*np.ones_like(self.Ts)
        self.flux_from_space = np.zeros_like(self.Ts)
        self.flux_to_sfc = np.zeros_like(self.Ts)
        self.flux_from_sfc = np.zeros_like(self.Ts)
        self.flux_to_space = np.zeros_like(self.Ts)
        self.heating_rate['Ts'] = np.zeros_like(self.Ts)

    @property
    def absorptivity(self):
        return self.trans.absorptivity
    @absorptivity.setter
    def absorptivity(self, value):<commit_msg>modifying radiation.py to adhere better to new API, using set_input() method.<commit_after>import numpy as np
from climlab.utils.thermo import blackbody_emission
from climlab.radiation.transmissivity import Transmissivity
from climlab.process.energy_budget import EnergyBudget


class Radiation(EnergyBudget):
    '''Base class for all band radiation models,
    including grey and semi-grey model.

    Input argument absorptivity is band absorptivity
    (should same size as grid).

    By default emissivity = absorptivity.
    Subclasses can override this is necessary (e.g. for shortwave model)'''
    def __init__(self, absorptivity=None, reflectivity=None,
                 albedo_sfc=0, **kwargs):
        super(Radiation, self).__init__(**kwargs)
        if reflectivity is None:
            reflectivity = np.zeros_like(self.Tatm)
        if absorptivity is None:
            absorptivity = np.zeros_like(self.Tatm)
        self.absorptivity = absorptivity
        self.reflectivity = reflectivity
        self.set_input('albedo_sfc', albedo_sfc*np.ones_like(self.Ts))
        self.set_input('flux_from_space', 0. * self.Ts)
        self.set_input('flux_to_sfc', 0. * self.Ts)
        self.set_input('flux_from_sfc', 0. * self.Ts)
        self.set_input('flux_to_space', 0. * self.Ts)
        self.heating_rate['Ts'] = np.zeros_like(self.Ts)

    @property
    def absorptivity(self):
        return self.trans.absorptivity
    @absorptivity.setter
    def absorptivity(self, value):
{'fraction_non_alphanumeric': 0.08918732782369146, 'fraction_numerical': 0.002066115702479339, 'mean_word_length': 3.2223837209302326, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4097213', 'n_tokens_mistral': 957, 'n_tokens_neox': 903, 'n_words': 213}