This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from mpi4py import MPI | |
| import numpy as np | |
| # Define the size of the grid | |
| n = 100 | |
| # Initialize MPI and get the rank of the current process | |
| comm = MPI.COMM_WORLD | |
| rank = comm.Get_rank() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| headers = {"Authorization": "Token super-secret-token", | |
| "Content-Type": "text/plain; charset=utf-8", | |
| "Accept": "application/json"} | |
| data = "airSensors,sensor_id=THP0101 temperature=37.94,humidity=35.231,pressure=1010" | |
| res = requests.post("http://INFLUXDB_IP:8086/api/v2/write?org=home&bucket=weather-pi&precision=ns", |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # unpacking a tuple returning function within an if statement | |
| # inspired by this stackoverflow answer https://stackoverflow.com/questions/68122210/python-function-returning-tuple | |
| def check_something(): | |
| return True, "string" | |
| if (x := check_something())[0]: | |
| print(x[1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Totnes CLP | York Central CLP | Almond Valley CLP | Chatham and Aylesford CLP | Edmonton CLP | Enfield North CLP | Aberavon CLP | Aberdeen Central CLP | Airdrie and Shotts CLP | Altrincham and Sale West CLP | Amber Valley CLP | Arundel and South Downs CLP | Barking CLP | Barrow and Furness CLP | Bassetlaw CLP | Beckenham CLP | Bermondsey and Old Southwark CLP | Bexhill and Battle CLP | Bexleyheath and Crayford CLP | Birmingham, Northfield CLP | Birmingham, Selly Oak CLP | Bracknell CLP | Braintree CLP | Brentwood and Ongar CLP | Bristol West CLP | Bromley and Chislehurst CLP | Buckingham CLP | Bury North CLP | Bury South CLP | Caerphilly CLP | Chelsea and Fulham CLP | Chesham and Amersham CLP | Chesterfield CLP | Cities of London and Westminster CLP | Coventry North East CLP | Coventry South CLP | Croydon North CLP | Cunninghame North CLP | Dagenham and Rainham CLP | Darlington CLP | Derby North CLP | Don Valley CLP | Doncaster North CLP | Dundee City East CLP | Dundee City West CLP | East Lothian CLP | East Surrey CLP | Eastleigh CLP | Eastwood CLP | Edinburgh Pentlands CLP | Edinburgh Southern CLP | En |
|---|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print("Hello, world!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # function for mapping between OA, LSOA, MSOA | |
| import sys | |
| import pandas as pd | |
| # moved data read out of function call | |
| lookup_table = pd.read_csv('data/OA_lookup_table.csv') | |
| def ONS_OA_lookup(code, level, lookup_tbl=lookup_table): | |
| """ | |
| Using http://geoportal1-ons.opendata.arcgis.com/datasets/fe6c55f0924b4734adf1cf7104a0173e_0.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import json | |
| import pandas as pd | |
| from shapely.geometry import shape, Point | |
| from geopy.geocoders import Nominatim | |
| from collections import Counter | |
| import time | |
| def get_POI_in_LSOA(location=None, POI_type=None): | |