-
Notifications
You must be signed in to change notification settings - Fork 16
281 Scaling of commuter migration/mobility data #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #291 +/- ##
==========================================
+ Coverage 91.23% 91.36% +0.13%
==========================================
Files 77 79 +2
Lines 4721 4854 +133
==========================================
+ Hits 4307 4435 +128
- Misses 414 419 +5
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Only some small modifications necessary. But let us also again discuss implications/statistics for the changes.
@@ -0,0 +1 @@ | |||
[{"0":9.445720205,"1":54.7883332098},{"0":10.1328367704,"1":54.3195019409},{"0":10.723672945,"1":53.8690910876},{"0":9.9909155313,"1":54.0787251589},{"0":9.1115286419,"1":54.1364413387},{"0":10.6063142269,"1":53.5898215396},{"0":8.9671138443,"1":54.597562528},{"0":10.770974213,"1":54.1450763123},{"0":9.7457166902,"1":53.719567184},{"0":10.3639025329,"1":54.2462081427},{"0":9.7838865852,"1":54.2923217793},{"0":9.4999288387,"1":54.6275781144},{"0":10.1456999704,"1":53.9219054532},{"0":9.5190001644,"1":53.9296733146},{"0":10.3372712145,"1":53.7225049839},{"0":10.0219589124,"1":53.5445592919},{"0":10.5244254212,"1":52.2750621552},{"0":10.3690960264,"1":52.1198645306},{"0":10.7852816541,"1":52.4089218389},{"0":10.6076802931,"1":52.5802001767},{"0":10.3987720463,"1":51.8731698432},{"0":10.8958025558,"1":52.2584628998},{"0":9.8477480903,"1":51.7411793244},{"0":10.2501530923,"1":52.3051129141},{"0":10.6506489556,"1":52.13720032},{"0":10.0945917849,"1":51.565929685},{"0":9.718007146,"1":52.4224473294},{"0":8.6998891832,"1":52.7270941047},{"0":9.3954249279,"1":52.0954508164},{"0":9.947657946,"1":52.090515494},{"0":9.5527325259,"1":51.8861430938},{"0":9.1149358217,"1":52.6137130429},{"0":9.2061048695,"1":52.2930490617},{"0":10.102293569,"1":52.7125636727},{"0":8.8063814777,"1":53.612996569},{"0":9.9635632031,"1":53.315766016},{"0":11.1289774269,"1":53.0197048246},{"0":10.5743556874,"1":53.2298966365},{"0":8.8118649291,"1":53.2483538621},{"0":9.3031045066,"1":53.2545882554},{"0":9.7731896364,"1":52.9305401781},{"0":9.4166131334,"1":53.5786764206},{"0":10.5545577464,"1":52.9782094635},{"0":9.1781783575,"1":52.9775861847},{"0":8.6488795252,"1":53.0541659743},{"0":7.176085073,"1":53.3609943285},{"0":8.2339205488,"1":53.1451211349},{"0":8.0584846728,"1":52.2737098094},{"0":8.0777242825,"1":53.5730712673},{"0":8.0087530181,"1":53.2152494077},{"0":7.372895054,"1":53.4888636656},{"0":7.908177463,"1":52.9087049979},{"0":7.4048014538,"1":52.7384557212},{"0":7.9851124153,"1":53.5063328223},{"0":7.0186542831,"1":52.4782438711},{"0":7.4985384689,"1":53.2266474514},{"0":8.3970865937,"1":52.9876410547},{"0":8.0427190583,"1":52.3834299723},{"0":8.2210480627,"1":52.6618968113},{"0":8.3930621529,"1":53.3493549265},{"0":7.7181018594,"1":53.5562504504},{"0":8.7992774587,"1":53.1023733756},{"0":8.5791192382,"1":53.5411205418},{"0":6.8087115966,"1":51.2297268444},{"0":6.7315201332,"1":51.441093023},{"0":7.0164290752,"1":51.43571111},{"0":6.5758238513,"1":51.346153838},{"0":6.4050352714,"1":51.1693532487},{"0":6.8758133618,"1":51.4165840911},{"0":6.8475642519,"1":51.5104809306},{"0":7.2281332255,"1":51.1800398463},{"0":7.0507773643,"1":51.1607694665},{"0":7.1724324835,"1":51.2464694681},{"0":6.2640220484,"1":51.6518286643},{"0":6.9654949516,"1":51.256146659},{"0":6.6399037695,"1":51.1421740096},{"0":6.3261382577,"1":51.2857926329},{"0":6.6184058248,"1":51.626583815},{"0":7.1146523871,"1":50.6999802109},{"0":6.9742895435,"1":50.9494358674},{"0":7.0044961684,"1":51.0580260621},{"0":6.21730394,"1":50.7327670554},{"0":6.4447895646,"1":50.8229314139},{"0":6.7229383264,"1":50.9001296458},{"0":6.635991869,"1":50.5327960503},{"0":6.1605645398,"1":51.0512469457},{"0":7.5098491903,"1":51.0104948909},{"0":7.1887923176,"1":51.0289211164},{"0":7.2258638906,"1":50.7614941087},{"0":6.9150776915,"1":51.5716281427},{"0":7.0701994457,"1":51.554431316},{"0":7.6215297281,"1":51.9551148313},{"0":6.9064164988,"1":51.9654111445},{"0":7.3682016323,"1":51.86343094},{"0":7.1511320038,"1":51.6739368049},{"0":7.5845626505,"1":52.2086750888},{"0":7.9528582304,"1":51.8710857684},{"0":8.5411696471,"1":52.0106682884},{"0":8.3520179983,"1":51.9296918182},{"0":8.6408779491,"1":52.1688705786},{"0":9.1840454112,"1":51.6856119864},{"0":8.9494345957,"1":51.9809217149},{"0":8.7408869056,"1":52.352338248},{"0":8.7225270592,"1":51.6620215495},{"0":7.2228029049,"1":51.4728603529},{"0":7.4717787301,"1":51.5179110317},{"0":7.506996061,"1":51.3537416688},{"0":7.8166673588,"1":51.6677638926},{"0":7.2107491337,"1":51.5363215523},{"0":7.3297386543,"1":51.3455507618},{"0":8.3842585919,"1":51.3061412076},{"0":7.7120343729,"1":51.262359709},{"0":7.9764957376,"1":51.0841266593},{"0":8.1966052481,"1":50.9363922761},{"0":8.2150667848,"1":51.5653482322},{"0":7.6364826515,"1":51.5806549468},{"0":8.6644847172,"1":49.8747633437},{"0":8.6413922097,"1":50.1168063147},{"0":8.7856573374,"1":50.0949633762},{"0":8.2599987917,"1":50.0774257896},{"0":8.6412604954,"1":49.632923653},{"0":8.7933396813,"1":49.8543380822},{"0":8.4680003843,"1":49.9099679396},{"0":8.5114522226,"1":50.2766955568},{"0":9.280207352,"1":50.2424243181},{"0":8.4269621969,"1":50.101616799},{"0":8.9728816721,"1":49.6676570367},{"0":8.8031924874,"1":50.0169148705},{"0":8.07546985,"1":50.1430234654},{"0":8.9194647197,"1":50.35497872},{"0":8.8012772307,"1":50.567240567},{"0":8.367352154,"1":50.6502191402},{"0":8.2031020532,"1":50.4288175044},{"0":8.7376794296,"1":50.8363949268},{"0":9.2657454878,"1":50.6399084537},{"0":9.4588850985,"1":51.3146053726},{"0":9.751829682,"1":50.5645454865},{"0":9.7511302453,"1":50.9078964566},{"0":9.4075185822,"1":51.4044368866},{"0":9.3730443867,"1":51.0286384501},{"0":8.8918573184,"1":51.1905575689},{"0":9.9281178839,"1":51.1911855775},{"0":7.5785243731,"1":50.3457274206},{"0":7.0521152704,"1":50.4732269472},{"0":7.7421796221,"1":50.7489105397},{"0":7.6908241436,"1":49.8292345276},{"0":7.27243936,"1":49.7132067906},{"0":7.1755875217,"1":50.1356756587},{"0":7.3231256817,"1":50.3317622929},{"0":7.4706002013,"1":50.5590223681},{"0":7.5002941404,"1":50.0469796359},{"0":7.8418192019,"1":50.2647567618},{"0":7.8674915386,"1":50.5472725355},{"0":6.660069872,"1":49.7678215926},{"0":6.9701461286,"1":49.9253326416},{"0":6.415888434,"1":50.0585753403},{"0":6.7512801794,"1":50.2375838618},{"0":6.6903192159,"1":49.6991512715},{"0":8.3711045737,"1":49.5388638244},{"0":7.7546917331,"1":49.4275573162},{"0":8.1126666667,"1":49.1876666667},{"0":8.4016153412,"1":49.4792581312},{"0":8.2351292019,"1":49.9820753052},{"0":8.142680757,"1":49.3461898484},{"0":7.5914878607,"1":49.197234845},{"0":8.4390342824,"1":49.3270338409},{"0":8.3315039703,"1":49.6481994676},{"0":7.3650608418,"1":49.2554704169},{"0":8.1602073137,"1":49.7540497033},{"0":8.1063836409,"1":49.4534913377},{"0":7.9071342993,"1":49.628626269},{"0":8.2501702636,"1":49.1195807231},{"0":7.6841802283,"1":49.4432902886},{"0":7.4696580426,"1":49.5539112331},{"0":8.0588027614,"1":49.1925417015},{"0":8.3565182757,"1":49.414535347},{"0":8.0849494979,"1":49.9222595817},{"0":7.6579110632,"1":49.2080184892},{"0":9.1707177622,"1":48.7735135352},{"0":8.9516820896,"1":48.6843069342},{"0":9.367179658,"1":48.6430482368},{"0":9.7161667308,"1":48.6607075582},{"0":9.1212915146,"1":48.9390704634},{"0":9.4975909978,"1":48.8977072922},{"0":9.1808570647,"1":49.1535516953},{"0":9.1916212654,"1":49.1736157576},{"0":9.6202166166,"1":49.2737060837},{"0":9.9106789355,"1":49.1425213538},{"0":9.7290547225,"1":49.5603033271},{"0":10.1821015513,"1":48.6622332755},{"0":10.0924369666,"1":48.8737352858},{"0":8.2277238852,"1":48.74929241},{"0":8.4087219741,"1":49.0098543248},{"0":8.5641840229,"1":49.0839850903},{"0":8.2410079784,"1":48.7595248294},{"0":8.6849782678,"1":49.4052523426},{"0":8.5005651529,"1":49.4998194145},{"0":9.2805923829,"1":49.4684986573},{"0":8.7657685335,"1":49.3715301958},{"0":8.7062344938,"1":48.8810968671},{"0":8.6374689496,"1":48.680363096},{"0":8.7313476272,"1":48.9109416604},{"0":8.4628685447,"1":48.4754147347},{"0":7.8137961239,"1":47.9999150651},{"0":7.9168675449,"1":47.9258593287},{"0":7.8958298659,"1":48.1471664812},{"0":8.0148557087,"1":48.4193180944},{"0":8.532062164,"1":48.2563693803},{"0":8.414845829,"1":48.0198720049},{"0":8.7986487967,"1":48.0122306958},{"0":8.9121811792,"1":47.7999091074},{"0":7.7757118412,"1":47.7025183803},{"0":8.2182364147,"1":47.695858008},{"0":9.3692998192,"1":48.4063081201},{"0":8.9823162164,"1":48.4851537321},{"0":8.9358689399,"1":48.2658873614},{"0":9.9491466973,"1":48.3983118138},{"0":9.8325665704,"1":48.3958892511},{"0":9.7697026509,"1":48.1065069744},{"0":9.408548327,"1":47.73081919},{"0":9.7801535185,"1":47.8268511553},{"0":9.2375143921,"1":48.0411834866},{"0":11.3968180148,"1":48.7520864194},{"0":11.5505696526,"1":48.157927953},{"0":12.1017242372,"1":47.8427009211},{"0":12.7015156034,"1":48.2124975372},{"0":12.9021961998,"1":47.6950042158},{"0":11.4823684388,"1":47.7276602697},{"0":11.3558724504,"1":48.3319545338},{"0":11.9118726368,"1":48.0775958329},{"0":11.3694919468,"1":48.8997394401},{"0":11.9991539023,"1":48.3017746782},{"0":11.7361157979,"1":48.449066451},{"0":11.1933324277,"1":48.1883906445},{"0":11.125728322,"1":47.5560787341},{"0":10.9444149825,"1":48.0272340431},{"0":11.8060425427,"1":47.746046719},{"0":12.3742043805,"1":48.2359941066},{"0":11.6234263923,"1":48.0693821169},{"0":11.1975913481,"1":48.6640813919},{"0":11.5208268742,"1":48.5972382826},{"0":12.1568571956,"1":47.8729095124},{"0":11.2792849379,"1":48.0098659041},{"0":12.580617045,"1":47.8961201385},{"0":11.0540560419,"1":47.7933538999},{"0":12.178,"1":48.543},{"0":13.4237424547,"1":48.5853501006},{"0":12.5742065698,"1":48.8813176115},{"0":12.9947621134,"1":48.7785157079},{"0":13.5137239822,"1":48.8255338161},{"0":11.8619419276,"1":48.8205201824},{"0":12.1977781382,"1":48.5578301434},{"0":13.3601144014,"1":48.5593349966},{"0":13.1033185969,"1":49.0235000014},{"0":12.8683792855,"1":48.4234609886},{"0":12.5856552543,"1":48.8979555359},{"0":12.612319795,"1":48.6402083326},{"0":11.8388666667,"1":49.4499333333},{"0":12.1109633082,"1":49.0148710238},{"0":12.1504726986,"1":49.6742160706},{"0":11.804571095,"1":49.4843931954},{"0":12.6927748503,"1":49.2350979351},{"0":11.5706933431,"1":49.2160314612},{"0":12.1055885065,"1":49.6859430838},{"0":12.1211930997,"1":49.0196050647},{"0":12.2479906408,"1":49.3680657902},{"0":12.1982294464,"1":49.899134716},{"0":10.8896666667,"1":49.889},{"0":11.5895806852,"1":49.9368471035},{"0":10.9650102146,"1":50.2583642792},{"0":11.8941254902,"1":50.3116666667},{"0":10.8912112364,"1":49.8960578207},{"0":11.5501456152,"1":49.8845638919},{"0":10.9457304282,"1":50.2688648514},{"0":11.1784347209,"1":49.7218360642},{"0":11.8187969738,"1":50.2769092937},{"0":11.376022315,"1":50.3256369975},{"0":11.4830664641,"1":50.105505992},{"0":11.1182059593,"1":50.116570931},{"0":12.0320582612,"1":50.0928481359},{"0":10.5689649355,"1":49.2933099529},{"0":10.9832861549,"1":49.5812311881},{"0":10.9669484579,"1":49.4910980341},{"0":11.0698814289,"1":49.4388126211},{"0":11.028,"1":49.337},{"0":10.4783982802,"1":49.2507306327},{"0":10.9174995202,"1":49.6368069083},{"0":10.8430622501,"1":49.4498861214},{"0":11.3657973389,"1":49.4899982326},{"0":10.4625820498,"1":49.5735290233},{"0":11.1258388684,"1":49.2051677687},{"0":10.8911802396,"1":49.0343608826},{"0":9.1439095877,"1":49.9637675112},{"0":10.2166666667,"1":50.0476666667},{"0":9.9351619346,"1":49.7829976226},{"0":9.2375947494,"1":50.0086965524},{"0":9.9605430671,"1":50.2206359682},{"0":10.246440179,"1":50.3759407187},{"0":10.6058026911,"1":50.0631272904},{"0":10.2538393703,"1":49.7551462604},{"0":9.2250738367,"1":49.7590465323},{"0":9.6575284858,"1":49.9916583995},{"0":10.2636783822,"1":50.0141396585},{"0":9.9372659248,"1":49.739178154},{"0":10.8947221385,"1":48.3483257476},{"0":10.6206666667,"1":47.8796666667},{"0":10.3050144536,"1":47.7429716331},{"0":10.1652987495,"1":47.990176271},{"0":11.0561663226,"1":48.4281344956},{"0":10.7314777514,"1":48.3559006702},{"0":10.5241733834,"1":48.5945622537},{"0":10.3786164181,"1":48.3566628569},{"0":10.144762971,"1":48.2990263728},{"0":9.888920092,"1":47.6052338247},{"0":10.6402302515,"1":47.7686487735},{"0":10.3950224336,"1":48.0408889099},{"0":10.713133513,"1":48.808094219},{"0":10.2666323371,"1":47.5807266909},{"0":6.9584648992,"1":49.2558293185},{"0":6.6871076964,"1":49.4944070815},{"0":7.1227646841,"1":49.3740335188},{"0":6.7749544315,"1":49.3565035732},{"0":7.2450529898,"1":49.2480906911},{"0":7.0938894873,"1":49.5160280043},{"0":13.3995233004,"1":52.4990949978},{"0":12.5109545077,"1":52.3968652266},{"0":14.3696747877,"1":51.7761737117},{"0":14.4917441916,"1":52.3158789938},{"0":13.0334251358,"1":52.4220291007},{"0":13.7026957512,"1":52.8210154228},{"0":13.8199336057,"1":52.0429179395},{"0":13.4678454642,"1":51.6160855899},{"0":12.629251696,"1":52.6187221515},{"0":14.1512526331,"1":52.6086409559},{"0":13.2102298911,"1":52.9108281588},{"0":13.9493046124,"1":51.6197670362},{"0":14.2118277401,"1":52.245302714},{"0":12.6412115875,"1":52.9898788552},{"0":12.6902680116,"1":52.2432862169},{"0":11.9657802936,"1":53.1133666775},{"0":14.4297213001,"1":51.7555625972},{"0":13.2735890507,"1":52.0707683664},{"0":13.8626391892,"1":53.2055588547},{"0":12.1416516735,"1":54.1488613691},{"0":11.4190128509,"1":53.6158832476},{"0":13.0014290942,"1":53.5420099636},{"0":12.2245416746,"1":53.9120446966},{"0":12.8070589283,"1":54.2118651757},{"0":11.2462766434,"1":53.8208136976},{"0":13.7803695712,"1":53.7861718857},{"0":11.5368692393,"1":53.451917341},{"0":12.9162676793,"1":50.8274408928},{"0":12.9467634985,"1":50.611103845},{"0":13.1367572596,"1":50.9569249775},{"0":12.2336570503,"1":50.4579546794},{"0":12.5264006383,"1":50.7505814552},{"0":13.7932993105,"1":51.0695962421},{"0":14.2311511879,"1":51.2701799305},{"0":14.7535069856,"1":51.2231911489},{"0":13.4838976987,"1":51.2410843386},{"0":13.8790847723,"1":50.9191101584},{"0":12.3792916759,"1":51.3458797475},{"0":12.5939570205,"1":51.2220218247},{"0":12.7919276144,"1":51.4728427251},{"0":12.2236368187,"1":51.8557598377},{"0":11.9745883562,"1":51.4811924965},{"0":11.6417661617,"1":52.11131316},{"0":11.2329202225,"1":52.6792602075},{"0":12.1387221577,"1":51.7987672475},{"0":11.3514962746,"1":52.2200529084},{"0":11.8956726171,"1":51.1442471439},{"0":10.9543694733,"1":51.8214230297},{"0":12.0317481038,"1":52.2669375184},{"0":11.3514163044,"1":51.5330292326},{"0":11.8790112163,"1":51.4324827853},{"0":11.6379244181,"1":51.851277957},{"0":11.8350287492,"1":52.7013601698},{"0":12.6995378625,"1":51.8212575086},{"0":11.0189167263,"1":50.9819431382},{"0":12.08245984,"1":50.8912572335},{"0":11.5901874925,"1":50.9165363342},{"0":10.6874671384,"1":50.6140234704},{"0":11.3179645589,"1":50.9767429584},{"0":10.2560470274,"1":51.3834208596},{"0":10.7322890736,"1":51.4996713865},{"0":10.2150460337,"1":50.8916557381},{"0":10.5478743638,"1":51.1853576065},{"0":10.9780269605,"1":51.3234771734},{"0":10.4048306509,"1":50.6336928377},{"0":10.6951671126,"1":50.9108984979},{"0":11.1542475403,"1":51.1581093648},{"0":10.7381499716,"1":50.4372988278},{"0":10.9689664962,"1":50.7378645291},{"0":11.3650226134,"1":50.9719718617},{"0":11.1371984168,"1":50.4063033701},{"0":11.3029843304,"1":50.631813032},{"0":11.7365465187,"1":50.9037978123},{"0":11.7090318201,"1":50.5800002585},{"0":12.0686099591,"1":50.7433983369},{"0":12.4023769496,"1":50.9499059988}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to tag the centers with the county ID? Then we would also only need one bigger file and one with the changes with respect to the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the tags in the dataframe.
I had also considered creating a large file and uploading only the changes for the reduced dimension. However, both files are created from different geojsons and therefore the coordinates are slightly different. Thus, it may be better to upload 2 individual files.
|
||
# check migration from Herzogtum Lauenburg to Flensburg, Stadt | ||
city_from = countykey2numlist['01001'] | ||
city_to = countykey2numlist['01053'] | ||
self.assertEqual(mat_commuter_migration.iat[city_from, city_to], 14) | ||
self.assertEqual(mat_commuter_migration.iat[city_from, city_to], 7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please introduce some value tests where no scaling happened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in latest commit
return df_commuter_migration | ||
# Short end for cases where no center coordinates are given. | ||
# this is especially important for 'test_epidata_get_vaccination_data' | ||
if isinstance(center_coordinates, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use default argument 'None' and check if this is 'None'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in latest commit
if isinstance(center_coordinates, str): | ||
return df_commuter_migration | ||
|
||
commuter_migration_scaled = scale_commuter_mobility( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you replace migration with mobility everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this in the last commit for getCommuterMobility.py
and test_epidata_getCommuterMobility.py
Co-authored-by: Martin J. Kühn <[email protected]>
Implements scaling for the commuter mobility data.
Merge Request - GuideLine Checklist
Guideline to check code before resolve WIP and approval, respectively.
As many checkboxes as possible should be ticked.
Checks by code author:
is present or referenced. Please provide your references.
Checks by code reviewer(s):
Closes #281