コード例 #1
0
ファイル: IN_CT.py プロジェクト: alfurey/electricitymap
def fetch_production(country_code='IN-CT', session=None):
    """Fetch Chhattisgarh production"""
    countrycode.assert_country_code(country_code, 'IN-CT')

    html = web.get_response_soup(country_code, 'http://117.239.199.203/csptcl/GEN.aspx', session)

    india_date_time = IN.read_datetime_from_span_id(html, 'L37', 'hh:m DD-MM-YY')

    korba_east_value = IN.read_value_from_span_id(html, 'L7')

    korba_west_value = IN.read_value_from_span_id(html, 'L13')

    dsmp_value = IN.read_value_from_span_id(html, 'L16')

    marwa_value = IN.read_value_from_span_id(html, 'L23')

    coal_value = round(korba_east_value + korba_west_value + dsmp_value + marwa_value, 2)

    bango_value = IN.read_value_from_span_id(html, 'L20')

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'production': {
            'coal': coal_value,
            'hydro': bango_value
        },
        'source': 'cspc.co.in',
    }

    return data
コード例 #2
0
ファイル: IN_CT.py プロジェクト: yuanzy97/electricitymap
def fetch_production(country_code='IN-CT', session=None):
    """Fetch Chhattisgarh production"""
    countrycode.assert_country_code(country_code, 'IN-CT')

    html = web.get_response_soup(country_code, 'http://117.239.199.203/csptcl/GEN.aspx', session)

    india_date_time = IN.read_datetime_from_span_id(html, 'L37', 'hh:m DD-MM-YY')

    korba_east_value = IN.read_value_from_span_id(html, 'L7')

    korba_west_value = IN.read_value_from_span_id(html, 'L13')

    dsmp_value = IN.read_value_from_span_id(html, 'L16')

    marwa_value = IN.read_value_from_span_id(html, 'L23')

    coal_value = round(korba_east_value + korba_west_value + dsmp_value + marwa_value, 2)

    bango_value = IN.read_value_from_span_id(html, 'L20')

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'production': {
            'coal': coal_value,
            'hydro': bango_value
        },
        'source': 'cspc.co.in',
    }

    return data
コード例 #3
0
ファイル: IN_DL.py プロジェクト: alfurey/electricitymap
def fetch_consumption(country_code='IN-DL', session=None):
    """Fetch Delhi consumption"""
    countrycode.assert_country_code(country_code, 'IN-DL')
    html = web.get_response_soup(country_code, 'http://www.delhisldc.org/Redirect.aspx', session)

    india_date_time = IN.read_datetime_from_span_id(html, 'DynamicData1_LblDate', 'DD-MMM-YYYY hh:mm:ss A')

    demand_value = IN.read_value_from_span_id(html, 'DynamicData1_LblLoad')

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'consumption': demand_value,
        'source': 'delhisldc.org'
    }

    return data
コード例 #4
0
ファイル: IN_CT.py プロジェクト: alfurey/electricitymap
def fetch_consumption(country_code='IN-CT', session=None):
    """Fetch Chhattisgarh consumption"""
    countrycode.assert_country_code(country_code, 'IN-CT')
    html = web.get_response_soup(country_code, 'http://117.239.199.203/csptcl/GEN.aspx', session)

    india_date_time = IN.read_datetime_from_span_id(html, 'L37', 'hh:m DD-MM-YY')

    demand_value = IN.read_value_from_span_id(html, 'L29')

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'consumption': demand_value,
        'source': 'cspc.co.in'
    }

    return data
コード例 #5
0
ファイル: IN_CT.py プロジェクト: yuanzy97/electricitymap
def fetch_consumption(country_code='IN-CT', session=None):
    """Fetch Chhattisgarh consumption"""
    countrycode.assert_country_code(country_code, 'IN-CT')
    html = web.get_response_soup(country_code, 'http://117.239.199.203/csptcl/GEN.aspx', session)

    india_date_time = IN.read_datetime_from_span_id(html, 'L37', 'hh:m DD-MM-YY')

    demand_value = IN.read_value_from_span_id(html, 'L29')

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'consumption': demand_value,
        'source': 'cspc.co.in'
    }

    return data
コード例 #6
0
ファイル: IN_KA.py プロジェクト: alfurey/electricitymap
def fetch_consumption(country_code='IN-KA', session=None):
    """Fetch Karnataka consumption"""
    countrycode.assert_country_code(country_code, 'IN-KA')
    html = web.get_response_soup(country_code, 'http://kptclsldc.com/Default.aspx', session)

    india_date_time = IN.read_datetime_from_span_id(html, 'Label6', 'DD/MM/YYYY HH:mm')

    demand_value = IN.read_value_from_span_id(html, 'Label5')

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'consumption': demand_value,
        'source': 'kptclsldc.com'
    }

    return data
コード例 #7
0
ファイル: IN_AP.py プロジェクト: alfurey/electricitymap
def fetch_consumption(country_code='IN-AP', session=None):
    """Fetch Andhra Pradesh consumption"""
    countrycode.assert_country_code(country_code, 'IN-AP')

    html = web.get_response_soup(country_code,
                                 'http://www.core.ap.gov.in/CMDashBoard/UserInterface/Power/PowerReport.aspx', session)
    india_date = IN.read_datetime_from_span_id(html, 'lblPowerStatusDate', 'DD-MM-YYYY HH:mm')

    demand_value = IN.read_value_from_span_id(html, 'lblGridDemand')

    data = {
        'countryCode': country_code,
        'datetime': india_date.datetime,
        'consumption': demand_value,
        'source': 'core.ap.gov.in'
    }

    return data
コード例 #8
0
ファイル: IN_AP.py プロジェクト: yuanzy97/electricitymap
def fetch_consumption(country_code='IN-AP', session=None):
    """Fetch Andhra Pradesh consumption"""
    countrycode.assert_country_code(country_code, 'IN-AP')

    html = web.get_response_soup(country_code,
                                 'http://www.core.ap.gov.in/CMDashBoard/UserInterface/Power/PowerReport.aspx', session)
    india_date = IN.read_datetime_from_span_id(html, 'lblPowerStatusDate', 'DD-MM-YYYY HH:mm')

    demand_value = IN.read_value_from_span_id(html, 'lblGridDemand')

    data = {
        'countryCode': country_code,
        'datetime': india_date.datetime,
        'consumption': demand_value,
        'source': 'core.ap.gov.in'
    }

    return data
コード例 #9
0
def fetch_consumption(country_code='IN-KA', session=None):
    """Fetch Karnataka consumption"""
    countrycode.assert_country_code(country_code, 'IN-KA')
    html = web.get_response_soup(country_code,
                                 'http://kptclsldc.com/Default.aspx', session)

    india_date_time = IN.read_datetime_from_span_id(html, 'Label6',
                                                    'DD/MM/YYYY HH:mm')

    demand_value = IN.read_value_from_span_id(html, 'Label5')

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'consumption': demand_value,
        'source': 'kptclsldc.com'
    }

    return data
コード例 #10
0
ファイル: IN_AP.py プロジェクト: subodhchhabra/electricitymap
def fetch_production(country_code='IN-AP', session=None):
    """Fetch Andhra Pradesh  production"""
    countrycode.assert_country_code(country_code, 'IN-AP')

    html = web.get_response_soup(
        country_code,
        'http://www.core.ap.gov.in/CMDashBoard/UserInterface/Power/PowerReport.aspx',
        session)
    india_date = IN.read_datetime_from_span_id(html, 'lblPowerStatusDate',
                                               'DD-MM-YYYY HH:mm')

    hydro_value = IN.read_value_from_span_id(html, 'lblHydel')
    gas_value = IN.read_value_from_span_id(html, 'lblGas')
    wind_value = IN.read_value_from_span_id(html, 'lblWind')
    solar_value = IN.read_value_from_span_id(html, 'lblSolar')

    # All thermal centrals are considered coal based production
    # https://en.wikipedia.org/wiki/Power_sector_of_Andhra_Pradesh
    thermal_value = IN.read_value_from_span_id(html, 'lblThermal')

    cgs_value = IN.read_value_from_span_id(html, 'lblCGS')
    ipp_value = IN.read_value_from_span_id(html, 'lblIPPS')

    data = {
        'countryCode': country_code,
        'datetime': india_date.datetime,
        'production': {
            'biomass': 0.0,
            'coal': thermal_value,
            'gas': gas_value,
            'hydro': hydro_value,
            'nuclear': 0.0,
            'oil': 0.0,
            'solar': solar_value,
            'wind': wind_value,
            'geothermal': 0.0,
            'unknown': round(cgs_value + ipp_value, 2)
        },
        'storage': {
            'hydro': 0.0
        },
        'source': 'core.ap.gov.in',
    }

    return data
コード例 #11
0
def fetch_consumption(country_code='IN-DL', session=None):
    """Fetch Delhi consumption"""
    countrycode.assert_country_code(country_code, 'IN-DL')
    html = web.get_response_soup(country_code,
                                 'http://www.delhisldc.org/Redirect.aspx',
                                 session)

    india_date_time = IN.read_datetime_from_span_id(html,
                                                    'DynamicData1_LblDate',
                                                    'DD-MMM-YYYY hh:mm:ss A')

    demand_value = IN.read_value_from_span_id(html, 'DynamicData1_LblLoad')

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'consumption': demand_value,
        'source': 'delhisldc.org'
    }

    return data
コード例 #12
0
ファイル: IN_AP.py プロジェクト: alfurey/electricitymap
def fetch_production(country_code='IN-AP', session=None):
    """Fetch Andhra Pradesh  production"""
    countrycode.assert_country_code(country_code, 'IN-AP')

    html = web.get_response_soup(country_code,
                                 'http://www.core.ap.gov.in/CMDashBoard/UserInterface/Power/PowerReport.aspx', session)
    india_date = IN.read_datetime_from_span_id(html, 'lblPowerStatusDate', 'DD-MM-YYYY HH:mm')

    hydro_value = IN.read_value_from_span_id(html, 'lblHydel')
    gas_value = IN.read_value_from_span_id(html, 'lblGas')
    wind_value = IN.read_value_from_span_id(html, 'lblWind')
    solar_value = IN.read_value_from_span_id(html, 'lblSolar')

    # All thermal centrals are considered coal based production
    # https://en.wikipedia.org/wiki/Power_sector_of_Andhra_Pradesh
    thermal_value = IN.read_value_from_span_id(html, 'lblThermal')

    cgs_value = IN.read_value_from_span_id(html, 'lblCGS')
    ipp_value = IN.read_value_from_span_id(html, 'lblIPPS')

    data = {
        'countryCode': country_code,
        'datetime': india_date.datetime,
        'production': {
            'biomass': 0.0,
            'coal': thermal_value,
            'gas': gas_value,
            'hydro': hydro_value,
            'nuclear': 0.0,
            'oil': 0.0,
            'solar': solar_value,
            'wind': wind_value,
            'geothermal': 0.0,
            'unknown': round(cgs_value + ipp_value, 2)
        },
        'storage': {
            'hydro': 0.0
        },
        'source': 'core.ap.gov.in',
    }

    return data
コード例 #13
0
ファイル: test_IN.py プロジェクト: alfurey/electricitymap
 def test_read_value_from_span_id(self):
     html_span = '<span id="lblcgs" style="font-weight:bold;">2998</span>'
     html = BeautifulSoup(html_span, 'html.parser')
     cgs_value = IN.read_value_from_span_id(html, 'lblcgs')
     self.assertIsNotNone(cgs_value)
     self.assertEquals(cgs_value, 2998.0)
コード例 #14
0
ファイル: test_IN.py プロジェクト: antifa-ev/electro
 def test_read_value_from_span_id(self):
     html_span = '<span id="lblcgs" style="font-weight:bold;">2998</span>'
     html = BeautifulSoup(html_span, 'html.parser')
     cgs_value = IN.read_value_from_span_id(html, 'lblcgs')
     self.assertIsNotNone(cgs_value)
     self.assertEqual(cgs_value, 2998.0)
コード例 #15
0
def fetch_production(country_code='IN-KA', session=None):
    """Fetch Karnataka  production"""
    countrycode.assert_country_code(country_code, 'IN-KA')

    html = web.get_response_soup(country_code,
                                 'http://kptclsldc.com/StateGen.aspx', session)

    india_date_time = IN.read_datetime_from_span_id(html, 'lbldate',
                                                    'M/D/YYYY h:mm:ss A')

    # RTPS Production: https://en.wikipedia.org/wiki/Raichur_Thermal_Power_Station
    rtps_value = IN.read_value_from_span_id(html, 'lblrtptot')

    # BTPS Production: https://en.wikipedia.org/wiki/Bellary_Thermal_Power_station
    btps_value = IN.read_value_from_span_id(html, 'lblbtptot')

    # YTPS Production: https://en.wikipedia.org/wiki/Yermarus_Thermal_Power_Station
    ytps_value = IN.read_value_from_span_id(html, 'ytptot')

    # UPCL Production: https://en.wikipedia.org/wiki/Udupi_Power_Plant
    upcl_value = IN.read_value_from_span_id(html, 'lblupctot')

    # JINDAl Production: https://en.wikipedia.org/wiki/JSW_Vijayanagar_Power_Station
    jindal_value = IN.read_value_from_span_id(html, 'lbljintot')

    # Coal Production
    coal_value = rtps_value + btps_value + ytps_value + upcl_value + jindal_value

    # Sharavati Production: Sharavati  Hydroelectric
    sharavati_value = IN.read_value_from_span_id(html, 'lblshvytot')

    # Nagjhari Production: Kalinadi-Nagjhari Hydroelectric
    nagjhari_value = IN.read_value_from_span_id(html, 'lblngjtot')

    # Varahi Production: https://en.wikipedia.org/wiki/Varahi_River#Varahi_Hydro-electric_Project
    varahi_value = IN.read_value_from_span_id(html, 'lblvrhtot')

    # Kodsalli Production: Kalinadi Kodasalli Hydroelectric
    kodsalli_value = IN.read_value_from_span_id(html, 'lblkdsltot')

    # Kadra Production: https://en.wikipedia.org/wiki/Kadra_Dam
    kadra_value = IN.read_value_from_span_id(html, 'lblkdrtot')

    # GERUSOPPA production: Gerusoppa Dam
    gerusoppa_value = IN.read_value_from_span_id(html, 'lblgrsptot')

    # JOG production: https://en.wikipedia.org/wiki/Jog_Falls
    jog_value = IN.read_value_from_span_id(html, 'lbljogtot')

    # LPH Production: Linganamakki Dam
    lph_value = IN.read_value_from_span_id(html, 'lbllphtot')

    # Supa production: https://en.wikipedia.org/wiki/Supa_Dam
    supa_value = IN.read_value_from_span_id(html, 'lblsupatot')

    # SHIMSHA: https://en.wikipedia.org/wiki/Shimsha#Power_generation
    shimsha_value = IN.read_value_from_span_id(html, 'lblshimtot')

    # SHIVASAMUDRA: https://en.wikipedia.org/wiki/Shivanasamudra_Falls#Power_generation
    shivasamudra_value = IN.read_value_from_span_id(html, 'lblshivtot')

    # MANIDAM: Mani Dam Hydroelectric
    manidam_value = IN.read_value_from_span_id(html, 'lblmanitot')

    # MUNRABAD: Munirabad Hydroelectric
    munrabad_value = IN.read_value_from_span_id(html, 'lblmbdtot')

    # BHADRA: https://en.wikipedia.org/wiki/Bhadra_Dam
    bhadra_value = IN.read_value_from_span_id(html, 'lblbdratot')

    # GHATAPRABHA: Ghataprabha Hydroelectric
    ghataprabha_value = IN.read_value_from_span_id(html, 'lblgtprtot')

    # ALMATTI: https://en.wikipedia.org/wiki/Almatti_Dam
    almatti_value = IN.read_value_from_span_id(html, 'lblalmttot')

    # CGS (Central Generating Stations) Production
    # TODO: Search CGS production type
    cgs_value = IN.read_value_from_span_id(html, 'lblcgs')

    # NCEP (Non-Conventional Energy Production)
    ncep_html = web.get_response_soup(country_code,
                                      'http://kptclsldc.com/StateNCEP.aspx',
                                      session)
    ncep_date_time = IN.read_datetime_from_span_id(ncep_html, 'Label1',
                                                   'DD/MM/YYYY HH:mm:ss')

    # Check ncep date is similar than state gen date
    if abs(india_date_time.timestamp - ncep_date_time.timestamp) > 600:
        raise ParserException('IN-KA', 'NCEP or State datetime is not valid')

    biomass_value = IN.read_value_from_span_id(ncep_html, 'lbl_tb')

    # TODO: Cogeneration value production type?
    cogen_value = IN.read_value_from_span_id(ncep_html, 'lbl_tc')

    mini_hydro_value = IN.read_value_from_span_id(ncep_html, 'lbl_tm')

    wind_value = IN.read_value_from_span_id(ncep_html, 'lbl_tw')

    solar_value = IN.read_value_from_span_id(ncep_html, 'lbl_ts')

    # Hydro production
    hydro_value = sharavati_value + nagjhari_value + varahi_value + kodsalli_value \
                  + kadra_value + gerusoppa_value + jog_value + lph_value + supa_value \
                  + shimsha_value + shivasamudra_value + manidam_value + munrabad_value \
                  + bhadra_value + ghataprabha_value + almatti_value + mini_hydro_value

    # Unknown production
    unknown_value = cgs_value + cogen_value

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'production': {
            'biomass': biomass_value,
            'coal': coal_value,
            'gas': 0.0,
            'hydro': hydro_value,
            'nuclear': 0.0,
            'oil': 0.0,
            'solar': solar_value,
            'wind': wind_value,
            'geothermal': 0.0,
            'unknown': unknown_value
        },
        'storage': {
            'hydro': 0.0
        },
        'source': 'kptclsldc.com',
    }

    return data
コード例 #16
0
ファイル: IN_KA.py プロジェクト: alfurey/electricitymap
def fetch_production(country_code='IN-KA', session=None):
    """Fetch Karnataka  production"""
    countrycode.assert_country_code(country_code, 'IN-KA')

    html = web.get_response_soup(country_code, 'http://kptclsldc.com/StateGen.aspx', session)

    india_date_time = IN.read_datetime_from_span_id(html, 'lbldate', 'M/D/YYYY h:mm:ss A')

    # RTPS Production: https://en.wikipedia.org/wiki/Raichur_Thermal_Power_Station
    rtps_value = IN.read_value_from_span_id(html, 'lblrtptot')

    # BTPS Production: https://en.wikipedia.org/wiki/Bellary_Thermal_Power_station
    btps_value = IN.read_value_from_span_id(html, 'lblbtptot')

    # YTPS Production: https://en.wikipedia.org/wiki/Yermarus_Thermal_Power_Station
    ytps_value = IN.read_value_from_span_id(html, 'ytptot')

    # UPCL Production: https://en.wikipedia.org/wiki/Udupi_Power_Plant
    upcl_value = IN.read_value_from_span_id(html, 'lblupctot')

    # JINDAl Production
    jindal_value = IN.read_value_from_span_id(html, 'lbljintot')

    # Coal Production
    coal_value = rtps_value + btps_value + ytps_value + upcl_value + jindal_value

    # Sharavati Production
    sharavati_value = IN.read_value_from_span_id(html, 'lblshvytot')

    # Nagjhari Production
    nagjhari_value = IN.read_value_from_span_id(html, 'lblngjtot')

    # Varahi Production
    varahi_value = IN.read_value_from_span_id(html, 'lblvrhtot')

    # Kodsalli Production
    kodsalli_value = IN.read_value_from_span_id(html, 'lblkdsltot')

    # Kadra Production
    kadra_value = IN.read_value_from_span_id(html, 'lblkdrtot')

    # GERUSOPPA production
    gerusoppa_value = IN.read_value_from_span_id(html, 'lblgrsptot')

    # JOG production
    jog_value = IN.read_value_from_span_id(html, 'lbljogtot')

    # LPH Production
    lph_value = IN.read_value_from_span_id(html, 'lbllphtot')

    # Supa production
    supa_value = IN.read_value_from_span_id(html, 'lblsupatot')

    # SHIMSHA
    shimsha_value = IN.read_value_from_span_id(html, 'lblshimtot')

    # SHIVASAMUDRA
    shivasamudra_value = IN.read_value_from_span_id(html, 'lblshivtot')

    # MANIDAM
    manidam_value = IN.read_value_from_span_id(html, 'lblmanitot')

    # MUNRABAD
    munrabad_value = IN.read_value_from_span_id(html, 'lblmbdtot')

    # BHADRA
    bhadra_value = IN.read_value_from_span_id(html, 'lblbdratot')

    # GHATAPRABHA
    ghataprabha_value = IN.read_value_from_span_id(html, 'lblgtprtot')

    # ALMATTI
    almatti_value = IN.read_value_from_span_id(html, 'lblalmttot')

    # CGS Production
    # TODO: Search CGS production type
    cgs_value = IN.read_value_from_span_id(html, 'lblcgs')

    # NCEP Production
    ncep_html = web.get_response_soup(country_code, 'http://kptclsldc.com/StateNCEP.aspx', session)
    ncep_date_time = IN.read_datetime_from_span_id(ncep_html, 'Label1', 'DD/MM/YYYY HH:mm:ss')

    # Check ncep date is similar than state gen date
    if abs(india_date_time.timestamp - ncep_date_time.timestamp) > 600:
        raise ParserException('IN-KA', 'NCEP or State datetime is not valid')

    biomass_value = IN.read_value_from_span_id(ncep_html, 'lbl_tb')

    # TODO: Cogeneration value production type?
    cogen_value = IN.read_value_from_span_id(ncep_html, 'lbl_tc')

    mini_hydro_value = IN.read_value_from_span_id(ncep_html, 'lbl_tm')

    wind_value = IN.read_value_from_span_id(ncep_html, 'lbl_tw')

    solar_value = IN.read_value_from_span_id(ncep_html, 'lbl_ts')

    # Hydro production
    hydro_value = sharavati_value + nagjhari_value + varahi_value + kodsalli_value \
                  + kadra_value + gerusoppa_value + jog_value + lph_value + supa_value \
                  + shimsha_value + shivasamudra_value + manidam_value + munrabad_value \
                  + bhadra_value + ghataprabha_value + almatti_value + mini_hydro_value

    # Unknown production
    unknown_value = cgs_value + cogen_value

    data = {
        'countryCode': country_code,
        'datetime': india_date_time.datetime,
        'production': {
            'biomass': biomass_value,
            'coal': coal_value,
            'gas': 0.0,
            'hydro': hydro_value,
            'nuclear': 0.0,
            'oil': 0.0,
            'solar': solar_value,
            'wind': wind_value,
            'geothermal': 0.0,
            'unknown': unknown_value
        },
        'storage': {
            'hydro': 0.0
        },
        'source': 'kptclsldc.com',
    }

    return data