def calculate(self, vintages, years):
     self.vintages = vintages
     self.years = years
     if self._has_data and self.raw_values is not None:
         self.remap(time_index_name='vintage',  converted_geography=GeoMapper.supply_primary_geography)
         util.convert_age(self, vintages=self.vintages, years=self.years, attr_from='values', attr_to='values', reverse=True)
     elif not self._has_data:
         index = pd.MultiIndex.from_product([GeoMapper.geography_to_gau[GeoMapper.supply_primary_geography],self.vintages], names=[GeoMapper.supply_primary_geography,'vintage'])
         self.values = util.empty_df(index,columns=years,fill_value=0.0)
         self._has_data = True
Пример #2
0
 def calculate(self, vintages, years):
     self.vintages = vintages
     self.years = years
     if self.data and self.raw_values is not None:
         self.remap(time_index_name='vintage')
         util.convert_age(self, vintages=self.vintages, years=self.years, attr_from='values', attr_to='values', reverse=True)
     elif self.data is False:
         index = pd.MultiIndex.from_product([cfg.geo.geographies[cfg.cfgfile.get('case','primary_geography')],self.vintages], names=[cfg.cfgfile.get('case', 'primary_geography'),'vintage'])
         self.values = util.empty_df(index,columns=years,fill_value=0.0)    
         self.data = True
Пример #3
0
 def make_flat_load_shape(index, column='value'):
     assert 'weather_datetime' in index.names
     flat_shape = util.empty_df(fill_value=1.,
                                index=index,
                                columns=[column])
     group_to_normalize = [
         n for n in flat_shape.index.names if n != 'weather_datetime'
     ]
     flat_shape = flat_shape.groupby(level=group_to_normalize).transform(
         lambda x: x / x.sum()) * Shapes.get_instance().num_active_years
     return flat_shape
Пример #4
0
 def calculate(self, vintages, years):
     self.vintages = vintages
     self.years = years
     if self.data and self.empty is False:
         self.remap()
         util.convert_age(self, vintages=self.vintages, years=self.years, attr_from='values', attr_to='values', reverse=True)
     elif self.data is False:
         index =  pd.MultiIndex.from_product([cfg.geo.geographies[cfg.cfgfile.get('case','primary_geography')],self.vintages], names=[cfg.cfgfile.get('case', 'primary_geography'),'vintage'])
         self.values = util.empty_df(index,columns=years,fill_value=1.0)    
         self.data = True
         self.empty = False
         setattr(self, 'converted', False)
     else:
         self.converted = False
         # adds fixed output shapes for technologies which are not dispatchable
     if self.empty is True:
         # if the class is empty, then there is no data for conversion, so the class is considered converted
         self.converted = True
     else:
         self.empty = False   
Пример #5
0
 def make_flat_load_shape(self, index, column='value'):
     assert 'weather_datetime' in index.names
     flat_shape = util.empty_df(fill_value=1., index=index, columns=[column])
     group_to_normalize = [n for n in flat_shape.index.names if n!='weather_datetime']
     flat_shape = flat_shape.groupby(level=group_to_normalize).transform(lambda x: x / x.sum())*self.num_active_years
     return flat_shape