def validate_grid_districts(self):
        #TODO: check docstring
        """ Tests MV grid districts for validity concerning imported data such as:
            
            i) Uno            
            ii) Dos
        
        Invalid MV grid districts are subsequently deleted from Network.
        """

        msg_invalidity = []
        invalid_mv_grid_districts = []

        for grid_district in self.mv_grid_districts():

            # there's only one node (MV station) => grid is empty
            if len(grid_district.mv_grid._graph.nodes()) == 1:
                invalid_mv_grid_districts.append(grid_district)
                msg_invalidity.append('MV Grid District {} seems to be empty ' \
                                      'and ' \
                                      'was removed'.format(grid_district))
            # there're only aggregated load areas
            elif all([lvla.is_aggregated for lvla in
                      grid_district.lv_load_areas()]):
                invalid_mv_grid_districts.append(grid_district)
                msg_invalidity.append("MV Grid District {} contains only " \
                                 "aggregated Load Areas and was removed" \
                                 "".format(grid_district))

        for grid_district in invalid_mv_grid_districts:
            self._mv_grid_districts.remove(grid_district)

        logger.warning("\n".join(msg_invalidity))
        logger.info('=====> MV Grids validated')
        return msg_invalidity
def validate_grid_districts ( self ) : msg_invalidity = [ ] invalid_mv_grid_districts = [ ] for grid_district in self . mv_grid_districts ( ) : if len ( grid_district . mv_grid . _graph . nodes ( ) ) == 1 : invalid_mv_grid_districts . append ( grid_district ) msg_invalidity . append ( 'MV Grid District {} seems to be empty ' 'and ' 'was removed' . format ( grid_district ) ) elif all ( [ lvla . is_aggregated for lvla in grid_district . lv_load_areas ( ) ] ) : invalid_mv_grid_districts . append ( grid_district ) msg_invalidity . append ( "MV Grid District {} contains only " "aggregated Load Areas and was removed" "" . format ( grid_district ) ) for grid_district in invalid_mv_grid_districts : self . _mv_grid_districts . remove ( grid_district ) logger . warning ( "\n" . join ( msg_invalidity ) ) logger . info ( '=====> MV Grids validated' ) return msg_invalidity
Tests MV grid districts for validity concerning imported data such as:
            
            i) Uno            
            ii) Dos
        
        Invalid MV grid districts are subsequently deleted from Network.