def ghi_observation_metadata(site_metadata): ghi_meta = datamodel.Observation(name='Albuquerque Baseline GHI', variable='ghi', interval_value_type='instantaneous', interval_length=pd.Timedelta('5min'), interval_label='instant', site=site_metadata, uncertainty=1) return ghi_meta
def ac_power_observation_metadata_label(request, powerplant_metadata): ac_power_meta = datamodel.Observation(name='Albuquerque Baseline AC Power', variable='ac_power', interval_value_type='mean', interval_length=pd.Timedelta('5min'), interval_label=request.param, site=powerplant_metadata, uncertainty=1) return ac_power_meta
def ac_power_observation_metadata(powerplant_metadata): ac_power_meta = datamodel.Observation(name='Albuquerque Baseline AC Power', variable='ac_power', interval_value_type='instantaneous', interval_length=pd.Timedelta('5min'), interval_label='instant', site=powerplant_metadata, uncertainty=1) return ac_power_meta
def test_invalid_variable(single_site): with pytest.raises(ValueError): datamodel.Observation( name='test', variable='noway', interval_value_type='mean', interval_length=pd.Timedelta('1min'), interval_label='beginning', site=single_site, uncertainty=0.1, )
def f(obs_dict): return datamodel.Observation( name=obs_dict['name'], variable=obs_dict['variable'], interval_value_type=obs_dict['interval_value_type'], interval_length=pd.Timedelta(f'{obs_dict["interval_length"]}min'), interval_label=obs_dict['interval_label'], site=get_site(obs_dict['site_id']), uncertainty=obs_dict['uncertainty'], observation_id=obs_dict.get('observation_id', ''), extra_parameters=obs_dict.get('extra_parameters', ''))
def default_observation(site_metadata, name='Albuquerque Baseline', variable='ghi', interval_value_type='mean', uncertainty=1, interval_length='1h', interval_label='beginning'): """ Helpful when you want to test a couple of parameters and don't need to worry about the rest. """ obs = datamodel.Observation(site=site_metadata, name=name, variable=variable, interval_value_type=interval_value_type, uncertainty=uncertainty, interval_length=pd.Timedelta(interval_length), interval_label=interval_label) return obs