Skip to content

Commit

Permalink
fixed italian bidding zones
Browse files Browse the repository at this point in the history
  • Loading branch information
fboerman committed Apr 12, 2022
1 parent d38234f commit 281ae94
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion entsoe/geo/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .utils import *
from .utils import load_zones
1 change: 1 addition & 0 deletions entsoe/geo/geojson/IT_CALA.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"zoneName": "IT_CALA"}, "geometry": {"type": "Polygon", "coordinates": [[[16.561371290000068, 38.41632721600007], [16.52198326900009, 38.387152411000045], [16.508148634000065, 38.371527411000045], [16.497569207000083, 38.36928945500006], [16.467051629000082, 38.34870026200008], [16.435069207000083, 38.33999258000006], [16.339854363000086, 38.300848700000074], [16.30632571700005, 38.27708567900004], [16.169444207000083, 38.14321523600006], [16.151866082000083, 38.11082591400009], [16.12549889400009, 38.00482819200005], [16.110850457000083, 37.97361888200004], [16.10132897200009, 37.96051666900007], [16.090017123000052, 37.949204820000034], [16.07715905000009, 37.939886786000045], [16.063161655000044, 37.93268463700008], [16.015879754000082, 37.924709377000056], [16.00098717500009, 37.91901276200008], [15.942149285000085, 37.93309153900009], [15.76148522200009, 37.92523834800005], [15.734873894000089, 37.930975653000075], [15.708262566000087, 37.94098541900007], [15.684418165000068, 37.95351797100005], [15.66578209700009, 37.966864325000074], [15.645518425000091, 37.988348700000074], [15.635101759000065, 38.009100653000075], [15.63835696700005, 38.02773672100005], [15.658457879000082, 38.04254791900007], [15.632660352000073, 38.074204820000034], [15.624034050000091, 38.09210846600007], [15.627452019000089, 38.10736725500004], [15.641612175000091, 38.12592194200005], [15.64779707100007, 38.14313385600008], [15.646494988000086, 38.162095445000034], [15.637950066000087, 38.18593984600005], [15.632823113000086, 38.22028229400007], [15.650563998000052, 38.24103424700007], [15.684255405000044, 38.253119208000044], [15.78646894600007, 38.27802155200004], [15.795664910000085, 38.28554922100005], [15.798675977000073, 38.290716864000046], [15.812836134000065, 38.30060455900008], [15.81617272200009, 38.30605703300006], [15.82976321700005, 38.35101959800005], [15.904795769000089, 38.473944403000075], [15.914422375735041, 38.50562195682928], [15.917816602000073, 38.516791083000044], [15.916026238000086, 38.55036041900007], [15.90007571700005, 38.57827383000006], [15.87077884200005, 38.60423411700009], [15.863536004000082, 38.60822174700007], [15.849945509000065, 38.613348700000074], [15.844004754000082, 38.61790599200009], [15.835459832000083, 38.628241278000075], [15.83366946700005, 38.63377513200004], [15.835215691000087, 38.63922760600008], [15.836599155000044, 38.64899323100008], [15.844493035000085, 38.66038646000004], [15.863129102000073, 38.66828034100007], [15.904795769000089, 38.679388739000046], [15.968028191000087, 38.712591864000046], [16.002614780000044, 38.72540924700007], [16.048838738000086, 38.727728583000044], [16.12086022200009, 38.72093333500004], [16.135996941000087, 38.723822333000044], [16.152598504000082, 38.730902411000045], [16.179209832000083, 38.74827708500004], [16.20093834700009, 38.77643463700008], [16.213689025479642, 38.81039980499315], [16.215098504000082, 38.814154364000046], [16.22169030000009, 38.85659414300005], [16.22006269600007, 38.89907461100006], [16.214691602000073, 38.91901276200008], [16.204600457000083, 38.93406810100004], [16.189626498000052, 38.94354889500005], [16.16895592500009, 38.94684479400007], [16.154307488000086, 38.95502350500004], [16.13965905000009, 38.97378164300005], [16.096887947545625, 39.05041320096651], [16.08301842500009, 39.07526276200008], [16.04200280000009, 39.310614325000074], [16.03402716100004, 39.34524176800005], [15.995396030000052, 39.438768236000044], [15.958075525000083, 39.47756361200004], [15.933116082000083, 39.513657945000034], [15.904795769000089, 39.53595612200007], [15.876231316000087, 39.55145905200004], [15.867523634000065, 39.56391022300005], [15.859716355000046, 39.58876446000005], [15.850271030000044, 39.61473216400009], [15.836599155000044, 39.65265534100007], [15.815684441000087, 39.678900458000044], [15.80640709700009, 39.69550202000005], [15.78874759200005, 39.79661692900004], [15.78874759200005, 39.790350653000075], [15.783946160000085, 39.81000397300005], [15.778819207000083, 39.82013580900008], [15.771332227000073, 39.82453034100007], [15.769704623000052, 39.830145575000074], [15.781911655000044, 39.86859772300005], [15.774424675000091, 39.89109935100004], [15.745807744060896, 39.92460382764366], [15.748469380957147, 39.92738654835051], [15.763213033854413, 39.94432746713886], [15.768003073083321, 39.95539069942123], [15.772968893799373, 39.96161994800218], [15.776528464417083, 39.96533332697146], [15.84112807639957, 40.003972244523425], [15.851213526183244, 40.007476883651236], [15.858332666519345, 40.008180007801116], [15.87755874194238, 39.999940261833615], [15.881601710750317, 39.99776496907805], [15.887644190826734, 39.993161697454354], [15.89012710118476, 39.990557937099084], [15.893423000471103, 39.98815193136653], [15.89731216002815, 39.98624030994233], [15.903508449355456, 39.985515212656935], [15.90676040326997, 39.9883057397181], [15.912341457392301, 39.999105300669044], [15.915901028010012, 40.00221443145085], [15.920251614420465, 40.0040161898952], [15.937148587837044, 40.005675125206835], [15.946355131084431, 40.005620193716936], [15.951936186106082, 40.00437873898761], [15.955495756723792, 40.00262092591498], [15.957187651289075, 40.00101692209324], [15.970063628133914, 39.985570144146834], [15.97270034684351, 39.98304328841698], [15.97687515176682, 39.98063728268443], [15.981994780834441, 39.97890144274737], [15.990520172168203, 39.97776985099779], [15.997507476388932, 39.97949470481677], [16.01616226287814, 39.98696540812705], [16.021281891945762, 39.98686653126538], [16.023435212465074, 39.98489997835128], [16.02235855220539, 39.98172492906218], [16.014294586825713, 39.96888191147099], [16.010888824559572, 39.96164192023838], [16.010427399504863, 39.957565993076116], [16.01104263381046, 39.95401740857653], [16.01291030896357, 39.950996168538325], [16.015393219321595, 39.94835944892941], [16.03802505611145, 39.92914436052382], [16.049956208811977, 39.91559821788343], [16.053669587781258, 39.91286262141284], [16.05909683445134, 39.91012702584152], [16.068918612004325, 39.90668830522111], [16.075598300421234, 39.90588630331024], [16.081333163794454, 39.90590827554644], [16.090319980182926, 39.90753425250375], [16.197392738683902, 39.91451057150567], [16.206533363423944, 39.916971508728125], [16.209477699736055, 39.92387092310457], [16.21196061009408, 39.92670539553757], [16.214904945506817, 39.92903449754402], [16.23202164578231, 39.93624152862361], [16.25324723247377, 39.94185554289896], [16.262717447951843, 39.94218513273768], [16.303059246187274, 39.93717536664985], [16.30771744930081, 39.93593391192047], [16.31127701991852, 39.934000318260075], [16.31685807494017, 39.92918830589559], [16.320110027955423, 39.927023999258154], [16.32740495067793, 39.92324470268085], [16.330810712044695, 39.92108039514409], [16.33329362240272, 39.91854255329616], [16.335468915158287, 39.91573005309942], [16.33887467742443, 39.90970954525926], [16.342280438791192, 39.90653449686954], [16.346674970573417, 39.9036670651829], [16.354277509999065, 39.90079963349626], [16.357683271365886, 39.90221686971273], [16.359858565020716, 39.90536994586631], [16.360166181723912, 39.90940192855612], [16.3586280955102, 39.92071784695105], [16.357529463014316, 39.924310375923085], [16.355683760097463, 39.92725471223514], [16.352563642298264, 39.92939704663638], [16.348542646625845, 39.930693432855605], [16.345290692711274, 39.932550122789905], [16.34403825186382, 39.9352417729894], [16.344983076008134, 39.938186109301455], [16.34731217711527, 39.940943677108976], [16.35304704138781, 39.94588752558883], [16.35550797861032, 39.9485681896702], [16.35737565466269, 39.95193000566519], [16.359089521464227, 39.9555445077728], [16.362187666127852, 39.967717360467816], [16.365285810791534, 39.974869460057505], [16.36761491279799, 39.97792365934936], [16.370251631507585, 39.98048347433286], [16.376140303232376, 39.98520759505442], [16.381413741550944, 39.990404128747514], [16.383742842658023, 39.99337043729582], [16.387302413275734, 39.99998420720539], [16.387610030878193, 40.00070930449078], [16.388532881886988, 40.004873123295965], [16.388686691137877, 40.00871833838056], [16.386533370618565, 40.027845536042605], [16.386994796572594, 40.03182258724257], [16.38807145683228, 40.03559089770175], [16.391323409847473, 40.04269905281899], [16.395827804609496, 40.049851152408735], [16.39882130146185, 40.05553034594868], [16.40672624242211, 40.07052742240262], [16.409209152780136, 40.08365608536002], [16.41028581303982, 40.108199543574074], [16.41169206313816, 40.11605476821296], [16.4134059299397, 40.122075276053124], [16.415097824504983, 40.12540413369379], [16.41758073486301, 40.12928230803209], [16.42114030548072, 40.13274300088875], [16.42687516885394, 40.13656624373715], [16.43184098956999, 40.136851888204035], [16.435246750936813, 40.13530281587225], [16.43959733734721, 40.129666829360644], [16.442234056056805, 40.12700813751553], [16.445639818322945, 40.12530525683212], [16.44999040383408, 40.124371418805936], [16.47934587441256, 40.12641487634545], [16.516743336335878, 40.12132820563215], [16.52201677375507, 40.121119465790684], [16.527290212073638, 40.121372151003925], [16.558908865251908, 40.12679939767406], [16.621135429856167, 40.122668538122525], [16.640048698588544, 40.11874851563147], [16.624522332000083, 40.10797760600008], [16.604746941000087, 40.08445872600004], [16.596934441000087, 40.04677969000005], [16.59937584700009, 40.03412506700005], [16.613617384000065, 39.99664948100008], [16.631602410000085, 39.96621328300006], [16.621755405000044, 39.953558661000045], [16.605479363000086, 39.94293854400007], [16.58920332100007, 39.91982656500005], [16.542246941000087, 39.88540273600006], [16.508148634000065, 39.837591864000046], [16.491709832000083, 39.80548737200007], [16.489756707000083, 39.77521393400008], [16.502126498000052, 39.74705638200004], [16.528575066000087, 39.72150299700007], [16.528575066000087, 39.71466705900008], [16.515635613000086, 39.68960195500006], [16.54590905000009, 39.66087474200009], [16.59148196700005, 39.636786200000074], [16.624847852000073, 39.62531159100007], [16.74976647200009, 39.620021877000056], [16.782481316000087, 39.61163971600007], [16.798106316000087, 39.60346100500004], [16.81609134200005, 39.591050523000035], [16.830902540000068, 39.576157945000034], [16.837168816000087, 39.56045156500005], [16.84620201900009, 39.55267975500004], [16.90601647200009, 39.529730536000045], [16.952972852000073, 39.499212958000044], [16.970876498000052, 39.49494049700007], [16.995371941000087, 39.49274323100008], [17.01148522200009, 39.48615143400008], [17.019200709742577, 39.47922324146484], [17.023448113000086, 39.47540924700007], [17.035817905000044, 39.46076080900008], [17.05713951900009, 39.44163646000004], [17.088552280000044, 39.42259349200009], [17.124196811000047, 39.40900299700007], [17.15870201900009, 39.40619538000004], [17.122243686000047, 39.338324286000045], [17.11491946700005, 39.28278229400007], [17.114512566000087, 39.26935455900008], [17.11768639400009, 39.25600820500006], [17.12476647200009, 39.24461497600004], [17.142100457000083, 39.222316799000055], [17.145681186000047, 39.21067942900004], [17.14039147200009, 39.178900458000044], [17.122243686000047, 39.12103913000004], [17.124522332000083, 39.09088776200008], [17.147959832000083, 39.05418528900009], [17.151866082000083, 39.04588450700004], [17.158457879000082, 39.04047272300005], [17.192556186000047, 39.03107330900008], [17.20639082100007, 39.02948639500005], [17.18685957100007, 39.01902903900009], [17.176605665000068, 39.01211172100005], [17.17237389400009, 39.005194403000075], [17.17156009200005, 38.966009833000044], [17.17237389400009, 38.96051666900007], [17.138845248000052, 38.936712958000044], [17.135020379000082, 38.93260325700004], [17.127696160000085, 38.92877838700008], [17.11890709700009, 38.91966380400004], [17.10401451900009, 38.89907461100006], [17.094981316000087, 38.919134833000044], [17.070567254000082, 38.92279694200005], [17.042246941000087, 38.91624583500004], [17.02198326900009, 38.905951239000046], [16.996348504000082, 38.92951080900008], [16.981293165000068, 38.937201239000046], [16.957286004000082, 38.94009023600006], [16.935069207000083, 38.938706773000035], [16.892234624183345, 38.929605326842946], [16.838552280000044, 38.91819896000004], [16.727793816000087, 38.87885163000004], [16.687754754000082, 38.85586172100005], [16.67945397200009, 38.84756094000005], [16.670746290000068, 38.84064362200007], [16.610606316000087, 38.81655508000006], [16.58562259200005, 38.79783763200004], [16.574392123000052, 38.78506094000005], [16.563731316000087, 38.756740627000056], [16.550954623000052, 38.741400458000044], [16.53882897200009, 38.72333405200004], [16.53484134200005, 38.69989655200004], [16.546885613000086, 38.69318268400008], [16.549082879000082, 38.68992747600004], [16.54851321700005, 38.67206452000005], [16.558848504000082, 38.59601471600007], [16.576996290000068, 38.528550523000035], [16.57715905000009, 38.50287506700005], [16.573491658469187, 38.467325027888535], [16.569590691000087, 38.42951080900008], [16.561371290000068, 38.41632721600007]]]}}]}
9 changes: 1 addition & 8 deletions entsoe/geo/geojson/IT_CNOR.geojson

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions entsoe/geo/geojson/IT_CNOR_2020.geojson

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion entsoe/geo/geojson/IT_CSUD.geojson

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions entsoe/geo/geojson/IT_CSUD_2020.geojson

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions entsoe/geo/geojson/IT_NORD.geojson

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion entsoe/geo/geojson/IT_SUD.geojson

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions entsoe/geo/geojson/IT_SUD_2020.geojson

Large diffs are not rendered by default.

19 changes: 17 additions & 2 deletions entsoe/geo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,20 @@ def extract_naturalearthdata(shpfile, countrylist, outputfolder):
s.to_file(os.path.join(outputfolder, f"{s['zoneName'].iloc[0]}.geojson"), driver='GeoJSON')


def load_zones(zones):
return pd.concat([gpd.read_file(os.path.join(os.path.dirname(__file__), 'geojson', f'{x}.geojson')) for x in zones]).set_index('zoneName').sort_index()
def load_zones(zones: list, d: pd.Timestamp):
# make sure to select the right files for changed bidding zones
# this is probably a little bit over explicit but that makes the confusing bidding zone situation a bit more clearer

zones_corrected = []
if d < pd.Timestamp('2021-01-01'):
for zone in zones:
if zone in ['IT_CNOR', 'IT_CSUD', 'IT_SUD']:
zones_corrected.append(zone + '_2020')
elif zone in ['IT_CALA']:
raise ValueError(f'Zones {["IT_CALA"]} does not exist at this date')
else:
zones_corrected.append(zone)
else:
zones_corrected = zones

return pd.concat([gpd.read_file(os.path.join(os.path.dirname(__file__), 'geojson', f'{x}.geojson')) for x in zones_corrected]).set_index('zoneName').sort_index()

0 comments on commit 281ae94

Please sign in to comment.